19 #ifndef __SERVERCARTESIANCONTROLLER_H__
20 #define __SERVERCARTESIANCONTROLLER_H__
23 #include <condition_variable>
30 #include <yarp/os/all.h>
31 #include <yarp/dev/all.h>
32 #include <yarp/sig/all.h>
59 bool read(yarp::os::ConnectionReader &connection);
70 void onRead(yarp::os::Bottle &command);
85 void reset(
const yarp::sig::Vector &x0);
86 yarp::sig::Vector
integrate(
const yarp::sig::Vector &vel);
105 public yarp::dev::IMultipleWrapper,
106 public yarp::dev::ICartesianControl,
107 public yarp::os::PeriodicThread,
144 std::deque<DriverDescriptor>
lDsc;
145 std::deque<yarp::dev::IControlMode*>
lMod;
146 std::deque<yarp::dev::IEncoders*>
lEnc;
147 std::deque<yarp::dev::IEncodersTimed*>
lEnt;
148 std::deque<yarp::dev::IPidControl*>
lPid;
149 std::deque<yarp::dev::IControlLimits*>
lLim;
150 std::deque<yarp::dev::IVelocityControl*>
lVel;
151 std::deque<yarp::dev::IPositionDirect*>
lPos;
152 std::deque<yarp::dev::IPositionControl*>
lStp;
184 yarp::sig::Vector
fb;
185 yarp::sig::Vector
q0;
219 std::map<std::string,yarp::dev::CartesianEvent*>
eventsMap;
233 bool respond(
const yarp::os::Bottle &command, yarp::os::Bottle &reply);
240 void stopLimb(
const bool execStopPosition=
true);
241 bool goTo(
unsigned int _ctrlPose,
const yarp::sig::Vector &xd,
const double t,
const bool latchToken=
false);
243 void notifyEvent(
const std::string &event,
const double checkPoint=-1.0);
273 bool open(yarp::os::Searchable &config);
279 bool attachAll(
const yarp::dev::PolyDriverList &
p);
288 bool getPose(yarp::sig::Vector &
x, yarp::sig::Vector &o, yarp::os::Stamp *stamp=NULL);
289 bool getPose(
const int axis, yarp::sig::Vector &
x, yarp::sig::Vector &o, yarp::os::Stamp *stamp=NULL);
290 bool goToPose(
const yarp::sig::Vector &xd,
const yarp::sig::Vector &od,
const double t=0.0);
291 bool goToPosition(
const yarp::sig::Vector &xd,
const double t=0.0);
292 bool goToPoseSync(
const yarp::sig::Vector &xd,
const yarp::sig::Vector &od,
const double t=0.0);
294 bool getDesired(yarp::sig::Vector &xdhat, yarp::sig::Vector &odhat, yarp::sig::Vector &qdhat);
295 bool askForPose(
const yarp::sig::Vector &xd,
const yarp::sig::Vector &od, yarp::sig::Vector &xdhat,
296 yarp::sig::Vector &odhat, yarp::sig::Vector &qdhat);
297 bool askForPose(
const yarp::sig::Vector &
q0,
const yarp::sig::Vector &xd,
const yarp::sig::Vector &od,
298 yarp::sig::Vector &xdhat, yarp::sig::Vector &odhat, yarp::sig::Vector &qdhat);
299 bool askForPosition(
const yarp::sig::Vector &xd, yarp::sig::Vector &xdhat, yarp::sig::Vector &odhat,
300 yarp::sig::Vector &qdhat);
301 bool askForPosition(
const yarp::sig::Vector &
q0,
const yarp::sig::Vector &xd, yarp::sig::Vector &xdhat,
302 yarp::sig::Vector &odhat, yarp::sig::Vector &qdhat);
303 bool getDOF(yarp::sig::Vector &curDof);
304 bool setDOF(
const yarp::sig::Vector &newDof, yarp::sig::Vector &curDof);
305 bool getRestPos(yarp::sig::Vector &curRestPos);
306 bool setRestPos(
const yarp::sig::Vector &newRestPos, yarp::sig::Vector &curRestPos);
308 bool setRestWeights(
const yarp::sig::Vector &newRestWeights, yarp::sig::Vector &curRestWeights);
317 bool setTaskVelocities(
const yarp::sig::Vector &xdot,
const yarp::sig::Vector &odot);
318 bool attachTipFrame(
const yarp::sig::Vector &
x,
const yarp::sig::Vector &o);
319 bool getTipFrame(yarp::sig::Vector &
x, yarp::sig::Vector &o);
322 bool waitMotionDone(
const double period=0.1,
const double timeout=0.0);
330 bool tweakSet(
const yarp::os::Bottle &options);
331 bool tweakGet(yarp::os::Bottle &options);
ServerCartesianController * server
void onRead(yarp::os::Bottle &command)
CartesianCtrlCommandPort(ServerCartesianController *server)
ServerCartesianController * server
CartesianCtrlRpcProcessor(ServerCartesianController *server)
bool read(yarp::os::ConnectionReader &connection)
servercartesiancontroller : implements the server part of the Cartesian Interface.
bool tweakSet(const yarp::os::Bottle &options)
yarp::os::BufferedPort< yarp::os::Bottle > portEvent
bool setTrackingMode(const bool f)
iCub::iKin::MultiRefMinJerkCtrl * ctrl
iCub::iKin::iKinLimb * limbState
double txTokenLatchedStopControl
bool deleteContexts(yarp::os::Bottle *contextIdList)
yarp::os::Property plantModelProperties
std::deque< yarp::dev::IVelocityControl * > lVel
yarp::os::Bottle sendCtrlCmdSingleJointPosition()
yarp::os::Bottle listMotionOngoingEvents()
ServerCartesianController(yarp::os::Searchable &config)
virtual ~ServerCartesianController()
yarp::os::BufferedPort< yarp::sig::Vector > portState
void notifyEvent(const std::string &event, const double checkPoint=-1.0)
std::deque< yarp::dev::IPositionControl * > lStp
yarp::os::Bottle sendCtrlCmdMultipleJointsVelocity()
bool askForPosition(const yarp::sig::Vector &xd, yarp::sig::Vector &xdhat, yarp::sig::Vector &odhat, yarp::sig::Vector &qdhat)
std::map< int, Context > contextMap
bool getDOF(yarp::sig::Vector &curDof)
yarp::os::Bottle sendCtrlCmdMultipleJointsPosition()
yarp::os::RpcClient portSlvRpc
bool getPose(const int axis, yarp::sig::Vector &x, yarp::sig::Vector &o, yarp::os::Stamp *stamp=NULL)
std::deque< DriverDescriptor > lDsc
bool getRestWeights(yarp::sig::Vector &curRestWeights)
bool setTrajTimeHelper(const double t)
yarp::os::Stamp debugInfo
double txTokenLatchedGoToRpc
yarp::os::BufferedPort< yarp::os::Bottle > portDebugInfo
yarp::sig::Vector xdot_set
CartesianCtrlRpcProcessor * rpcProcessor
bool getTipFrame(yarp::sig::Vector &x, yarp::sig::Vector &o)
bool getTrajTime(double *t)
bool goToPosition(const yarp::sig::Vector &xd, const double t=0.0)
bool attachAll(const yarp::dev::PolyDriverList &p)
void motionOngoingEventsHandling()
std::deque< yarp::dev::IEncodersTimed * > lEnt
iCub::iKin::iKinChain * chainState
bool setLimits(const int axis, const double min, const double max)
double getFeedback(yarp::sig::Vector &_fb)
bool multipleJointsControlEnabled
bool checkMotionDone(bool *f)
bool open(yarp::os::Searchable &config)
bool setTrackingModeHelper(const bool f)
yarp::os::Bottle sendCtrlCmdSingleJointVelocity()
bool getReferenceMode(bool *f)
bool getPosePriority(std::string &p)
bool getInTargetTol(double *tol)
bool askForPose(const yarp::sig::Vector &q0, const yarp::sig::Vector &xd, const yarp::sig::Vector &od, yarp::sig::Vector &xdhat, yarp::sig::Vector &odhat, yarp::sig::Vector &qdhat)
bool setRestWeights(const yarp::sig::Vector &newRestWeights, yarp::sig::Vector &curRestWeights)
yarp::os::Bottle(ServerCartesianController::* sendCtrlCmd)()
std::multiset< double > motionOngoingEventsCurrent
bool attachTipFrame(const yarp::sig::Vector &x, const yarp::sig::Vector &o)
yarp::os::BufferedPort< yarp::os::Bottle > portSlvOut
bool setTrajTime(const double t)
bool getTask2ndOptions(yarp::os::Value &v)
std::deque< yarp::dev::IControlMode * > lMod
bool registerEvent(yarp::dev::CartesianEvent &event)
bool getLimits(const int axis, double *min, double *max)
bool unregisterMotionOngoingEvent(const double checkPoint)
yarp::os::RpcServer portRpc
std::deque< yarp::dev::IControlLimits * > lLim
void setJointsCtrlMode(const std::vector< int > &jointsToSet)
bool tweakGet(yarp::os::Bottle &options)
bool waitMotionDone(const double period=0.1, const double timeout=0.0)
bool setTask2ndOptions(const yarp::os::Value &v)
bool setInTargetTolHelper(const double tol)
bool respond(const yarp::os::Bottle &command, yarp::os::Bottle &reply)
bool getSolverConvergenceOptions(yarp::os::Bottle &options)
bool setPosePriority(const std::string &p)
bool askForPose(const yarp::sig::Vector &xd, const yarp::sig::Vector &od, yarp::sig::Vector &xdhat, yarp::sig::Vector &odhat, yarp::sig::Vector &qdhat)
bool getTaskVelocities(yarp::sig::Vector &xdot, yarp::sig::Vector &odot)
int taskRefVelPeriodFactor
bool goToPoseSync(const yarp::sig::Vector &xd, const yarp::sig::Vector &od, const double t=0.0)
bool askForPosition(const yarp::sig::Vector &q0, const yarp::sig::Vector &xd, yarp::sig::Vector &xdhat, yarp::sig::Vector &odhat, yarp::sig::Vector &qdhat)
bool getInfo(yarp::os::Bottle &info)
bool setSolverConvergenceOptions(const yarp::os::Bottle &options)
iCub::iKin::iKinLimb * limbPlan
TaskRefVelTargetGenerator * taskRefVelTargetGen
bool goToPose(const yarp::sig::Vector &xd, const yarp::sig::Vector &od, const double t=0.0)
std::map< std::string, yarp::dev::CartesianEvent * > eventsMap
bool unregisterEvent(yarp::dev::CartesianEvent &event)
bool goTo(unsigned int _ctrlPose, const yarp::sig::Vector &xd, const double t, const bool latchToken=false)
bool areJointsHealthyAndSet(std::vector< int > &jointsToSet)
void motionOngoingEventsFlush()
yarp::os::BufferedPort< yarp::os::Bottle > portSlvIn
bool setTaskVelocities(const yarp::sig::Vector &xdot, const yarp::sig::Vector &odot)
std::multiset< double > motionOngoingEvents
bool goToPositionSync(const yarp::sig::Vector &xd, const double t=0.0)
CartesianCtrlCommandPort * portCmd
bool setRestPos(const yarp::sig::Vector &newRestPos, yarp::sig::Vector &curRestPos)
iCub::iKin::iKinChain * chainPlan
bool storeContext(int *id)
ServerCartesianController()
bool restoreContext(const int id)
bool getTrackingMode(bool *f)
std::deque< yarp::dev::IPositionDirect * > lPos
bool setReferenceMode(const bool f)
std::deque< yarp::dev::IEncoders * > lEnc
yarp::os::Stamp eventInfo
void stopLimb(const bool execStopPosition=true)
yarp::dev::PolyDriverList drivers
std::condition_variable cv_syncEvent
bool setInTargetTol(const double tol)
bool deleteContext(const int id)
bool setDOF(const yarp::sig::Vector &newDof, yarp::sig::Vector &curDof)
bool getRestPos(yarp::sig::Vector &curRestPos)
bool getPose(yarp::sig::Vector &x, yarp::sig::Vector &o, yarp::os::Stamp *stamp=NULL)
bool getDesired(yarp::sig::Vector &xdhat, yarp::sig::Vector &odhat, yarp::sig::Vector &qdhat)
bool getJointsVelocities(yarp::sig::Vector &qdot)
SmithPredictor smithPredictor
bool registerMotionOngoingEvent(const double checkPoint)
std::deque< yarp::dev::IPidControl * > lPid
iCub::ctrl::Integrator * I
void reset(const yarp::sig::Vector &x0)
yarp::sig::Vector integrate(const yarp::sig::Vector &vel)
virtual ~TaskRefVelTargetGenerator()
TaskRefVelTargetGenerator(const double Ts, const yarp::sig::Vector &x0)
A class for defining a saturated integrator based on Tustin formula: .
Helper class providing useful methods to deal with Cartesian Solver options.
A class derived from iKinCtrl implementing the multi-referential approach.
A Base class for defining a Serial Link Chain.
A class for defining generic Limb.
yarp::sig::Vector minAbsVels
yarp::os::Bottle solverConvergence
yarp::sig::Vector restPos
yarp::sig::Vector restWeights