236 #ifndef __IKINSLV_H__
237 #define __IKINSLV_H__
240 #include <condition_variable>
244 #include <yarp/os/BufferedPort.h>
245 #include <yarp/os/PeriodicThread.h>
246 #include <yarp/sig/Vector.h>
247 #include <yarp/sig/Matrix.h>
249 #include <yarp/dev/ControlBoardInterfaces.h>
250 #include <yarp/dev/PolyDriver.h>
262 class CartesianSolver;
269 virtual bool read(yarp::os::ConnectionReader &connection);
276 class InputPort :
public yarp::os::BufferedPort<yarp::os::Bottle>
292 yarp::sig::Vector
xd;
294 virtual void onRead(yarp::os::Bottle &b);
303 yarp::sig::Vector
get_xd();
305 void set_dof(
const yarp::sig::Vector &_dof);
306 void reset_xd(
const yarp::sig::Vector &_xd);
323 virtual void exec(
const yarp::sig::Vector &xd,
const yarp::sig::Vector &q);
332 std::deque<yarp::os::Property>
prp;
348 std::deque<yarp::dev::PolyDriver*>
drv;
349 std::deque<yarp::dev::IControlLimits*>
lim;
350 std::deque<yarp::dev::IEncoders*>
enc;
360 yarp::os::BufferedPort<yarp::os::Bottle> *
outPort;
401 virtual yarp::sig::Vector
solve(yarp::sig::Vector &xd);
404 virtual bool decodeDOF(
const yarp::sig::Vector &_dof);
407 yarp::os::Bottle *reply=NULL);
409 yarp::os::Bottle *reply=NULL);
411 yarp::dev::PolyDriver *
waitPart(
const yarp::os::Property &partOpt);
413 bool isNewDOF(
const yarp::sig::Vector &_dof);
414 bool changeDOF(
const yarp::sig::Vector &_dof);
428 void send(
const yarp::sig::Vector &xd,
const yarp::sig::Vector &
x,
const yarp::sig::Vector &q,
double *tok);
429 void printInfo(
const std::string &typ,
const yarp::sig::Vector &xd,
const yarp::sig::Vector &
x,
430 const yarp::sig::Vector &q,
const double t);
433 virtual void respond(
const yarp::os::Bottle &command, yarp::os::Bottle &reply);
530 virtual bool open(yarp::os::Searchable &options);
541 virtual void close();
587 virtual bool decodeDOF(
const yarp::sig::Vector &_dof);
599 virtual bool open(yarp::os::Searchable &options);
Helper class providing useful methods to deal with Cartesian Solver options.
Abstract class defining the core of on-line solvers.
yarp::sig::Vector idx_3rdTask
std::deque< yarp::dev::IControlLimits * > lim
yarp::os::BufferedPort< yarp::os::Bottle > * outPort
virtual yarp::sig::Vector & encodeDOF()
virtual bool handleJointsRestWeights(const yarp::os::Bottle *options, yarp::os::Bottle *reply=NULL)
bool setLimits(int axis, double min, double max)
virtual bool open(yarp::os::Searchable &options)
Configure the solver and start it up.
std::condition_variable cv_dofEvent
virtual PartDescriptor * getPartDesc(yarp::os::Searchable &options)=0
yarp::sig::Vector xd_2ndTask
bool changeDOF(const yarp::sig::Vector &_dof)
virtual yarp::sig::Vector solve(yarp::sig::Vector &xd)
virtual void respond(const yarp::os::Bottle &command, yarp::os::Bottle &reply)
yarp::sig::Vector w_3rdTask
RpcProcessor * cmdProcessor
virtual void interrupt()
Interrupt the open() method waiting for motor parts to be ready.
yarp::sig::Vector restWeights
virtual void resume()
Resume the solver's main loop.
void countUncontrolledJoints()
CartesianSolver(const std::string &_slvName)
Constructor.
yarp::sig::Matrix swLimits
std::deque< yarp::dev::IEncoders * > enc
yarp::sig::Matrix hwLimits
virtual void afterStart(bool)
virtual bool decodeDOF(const yarp::sig::Vector &_dof)
yarp::sig::Vector restJntPos
virtual void threadRelease()
yarp::sig::Vector unctrlJointsOld
void printInfo(const std::string &typ, const yarp::sig::Vector &xd, const yarp::sig::Vector &x, const yarp::sig::Vector &q, const double t)
virtual bool handleJointsRestPosition(const yarp::os::Bottle *options, yarp::os::Bottle *reply=NULL)
void latchUncontrolledJoints(yarp::sig::Vector &joints)
virtual void suspend()
Suspend the solver's main loop.
virtual ~CartesianSolver()
Default destructor.
virtual bool isClosed() const
To be called to check whether the solver has received a [quit] request.
yarp::dev::PolyDriver * waitPart(const yarp::os::Property &partOpt)
void getFeedback(const bool wait=false)
virtual void close()
Stop the solver and dispose it.
virtual bool & getTimeoutFlag()
To be called to check whether communication timeout has been detected.
void fillDOFInfo(yarp::os::Bottle &reply)
yarp::sig::Vector w_2ndTask
virtual void prepareJointsRestTask()
void send(const yarp::sig::Vector &xd, const yarp::sig::Vector &x, const yarp::sig::Vector &q, double *tok)
std::deque< yarp::dev::PolyDriver * > drv
yarp::sig::Vector qd_3rdTask
bool isNewDOF(const yarp::sig::Vector &_dof)
virtual bool threadInit()
virtual bool read(yarp::os::ConnectionReader &connection)
RpcProcessor(CartesianSolver *_slv)
virtual void exec(const yarp::sig::Vector &xd, const yarp::sig::Vector &q)
Defines the callback body to be called at each iteration.
SolverCallback(CartesianSolver *_slv)
Derived class which implements the on-line solver for the chain torso+arm.
iCubArmCartesianSolver(const std::string &_slvName="armCartSolver")
Constructor.
virtual PartDescriptor * getPartDesc(yarp::os::Searchable &options)
virtual bool decodeDOF(const yarp::sig::Vector &_dof)
virtual bool open(yarp::os::Searchable &options)
Configure the solver and start it up.
Derived class which implements the on-line solver for the leg chain.
virtual PartDescriptor * getPartDesc(yarp::os::Searchable &options)
iCubLegCartesianSolver(const std::string &_slvName="legCartSolver")
Constructor.
A Base class for defining a Serial Link Chain.
Class for inverting chain's kinematics based on IpOpt lib.
Class for defining iteration callback.
A class for defining generic Limb.
Class for defining Linear Inequality Constraints of the form lB <= C*q <= uB for the nonlinear proble...
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.
std::deque< yarp::os::Property > prp