-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#ifndef MANIPULATOR_CC
#define MANIPULATOR_CC
class Manipulator : public Map {
static const int sqsize = 16;
+
Polygon *_touching_polygon, *_current_polygon;
scalar_t _grab_relative_x, _grab_relative_y;
scalar_t _xmax, _ymax;
scalar_t _force_x, _force_y;
bool _grab, _release;
int _current_action;
+
enum { FEEL_TOUCHING_OBJECT, FEEL_GRABBING_OBJECT, NB_DISCRETE_PARAMETERS };
+
enum { MAP_LOCATION_X, MAP_LOCATION_Y, MAP_RESISTANCE_X, MAP_RESISTANCE_Y, NB_CONTINUOUS_MAPS };
+
static const int continuous_map_size = 25;
+
scalar_t _kernel_continuous_maps[continuous_map_size * 2 + 1];
+
public:
- enum { ACTION_IDLE,
- ACTION_MOVE_UP, ACTION_MOVE_RIGHT, ACTION_MOVE_DOWN, ACTION_MOVE_LEFT,
- ACTION_GRAB, ACTION_RELEASE,
- NB_ACTIONS };
+
+ enum {
+ ACTION_IDLE,
+ ACTION_MOVE_UP, ACTION_MOVE_RIGHT, ACTION_MOVE_DOWN, ACTION_MOVE_LEFT,
+ ACTION_GRAB, ACTION_RELEASE,
+ NB_ACTIONS
+ };
+
Manipulator(Task *task);
inline scalar_t hand_x() { return _hand_x; }
int random_action();
-// void force_grab(Universe *universe, scalar_t x, scalar_t y);
+ // void force_grab(Universe *universe, scalar_t x, scalar_t y);
void force_move(scalar_t x, scalar_t y);
void force_release();
};