iCub-main
Public Member Functions | List of all members
iCub::action::ActionPrimitivesLayer1 Class Reference

#include <actionPrimitives.h>

+ Inheritance diagram for iCub::action::ActionPrimitivesLayer1:

Public Member Functions

 ActionPrimitivesLayer1 ()
 Default Constructor. More...
 
 ActionPrimitivesLayer1 (yarp::os::Property &opt)
 Constructor. More...
 
virtual bool grasp (const yarp::sig::Vector &x, const yarp::sig::Vector &o, const yarp::sig::Vector &d)
 Grasp the given target (combined action). More...
 
virtual bool touch (const yarp::sig::Vector &x, const yarp::sig::Vector &o, const yarp::sig::Vector &d)
 Touch the given target (combined action). More...
 
virtual bool tap (const yarp::sig::Vector &x1, const yarp::sig::Vector &o1, const yarp::sig::Vector &x2, const yarp::sig::Vector &o2, const double execTime=ACTIONPRIM_DISABLE_EXECTIME)
 Tap the given target (combined action). More...
 
- Public Member Functions inherited from iCub::action::ActionPrimitives
 ActionPrimitives ()
 Default Constructor. More...
 
 ActionPrimitives (yarp::os::Property &opt)
 Constructor. More...
 
virtual ~ActionPrimitives ()
 Destructor. More...
 
virtual bool open (yarp::os::Property &opt)
 Configure the object. More...
 
virtual bool isValid () const
 Check if the object is initialized correctly. More...
 
virtual void close ()
 Deallocate the object. More...
 
virtual bool pushAction (const yarp::sig::Vector &x, const yarp::sig::Vector &o, const std::string &handSeqKey, const double execTime=ACTIONPRIM_DISABLE_EXECTIME, ActionPrimitivesCallback *clb=NULL)
 Insert a combination of arm and hand primitive actions in the actions queue. More...
 
virtual bool pushAction (const yarp::sig::Vector &x, const std::string &handSeqKey, const double execTime=ACTIONPRIM_DISABLE_EXECTIME, ActionPrimitivesCallback *clb=NULL)
 Insert a combination of arm and hand primitive actions in the actions queue. More...
 
virtual bool pushAction (const yarp::sig::Vector &x, const yarp::sig::Vector &o, const double execTime=ACTIONPRIM_DISABLE_EXECTIME, ActionPrimitivesCallback *clb=NULL)
 Insert the arm-primitive action reach for target in the actions queue. More...
 
virtual bool pushAction (const yarp::sig::Vector &x, const double execTime=ACTIONPRIM_DISABLE_EXECTIME, ActionPrimitivesCallback *clb=NULL)
 Insert the arm-primitive action reach for target in the actions queue. More...
 
virtual bool pushAction (const std::string &handSeqKey, ActionPrimitivesCallback *clb=NULL)
 Insert a hand-primitive action in the actions queue. More...
 
virtual bool pushAction (const std::deque< ActionPrimitivesWayPoint > &wayPoints, ActionPrimitivesCallback *clb=NULL)
 Insert in the actions queue a trajectory in the operational space parametrized in terms of waypoints. More...
 
virtual bool pushAction (const std::deque< ActionPrimitivesWayPoint > &wayPoints, const std::string &handSeqKey, ActionPrimitivesCallback *clb=NULL)
 Insert in the actions queue a combination of hand and arm trajectory in the operational space parametrized in terms of waypoints. More...
 
virtual bool pushWaitState (const double tmo, ActionPrimitivesCallback *clb=NULL)
 Insert a wait state in the actions queue. More...
 
virtual bool reachPose (const yarp::sig::Vector &x, const yarp::sig::Vector &o, const double execTime=ACTIONPRIM_DISABLE_EXECTIME)
 Immediately update the current reaching target (without affecting the actions queue) or initiate a new reach (if the actions queue is empty). More...
 
virtual bool reachPosition (const yarp::sig::Vector &x, const double execTime=ACTIONPRIM_DISABLE_EXECTIME)
 Immediately update the current reaching target (without affecting the actions queue) or initiate a new reach (if the actions queue is empty). More...
 
virtual bool clearActionsQueue ()
 Empty the actions queue. More...
 
virtual bool lockActions ()
 Disable the possibility to yield any new action. More...
 
virtual bool unlockActions ()
 Enable the possibility to yield new actions. More...
 
virtual bool getActionsLockStatus () const
 Return the actions lock status. More...
 
virtual bool addHandSeqWP (const std::string &handSeqKey, const yarp::sig::Vector &poss, const yarp::sig::Vector &vels, const yarp::sig::Vector &tols, const yarp::sig::Vector &thres, const double tmo)
 Define an hand WayPoint (WP) to be added at the bottom of the hand motion sequence pointed by the key. More...
 
virtual bool addHandSequence (const std::string &handSeqKey, const yarp::os::Bottle &sequence)
 Define an hand motion sequence from a configuration bottle. More...
 
virtual bool isValidHandSeq (const std::string &handSeqKey)
 Check whether a sequence key is defined. More...
 
virtual bool removeHandSeq (const std::string &handSeqKey)
 Remove an already existing hand motion sequence. More...
 
std::deque< std::stringgetHandSeqList ()
 Return the list of available hand sequence keys. More...
 
virtual bool getHandSequence (const std::string &handSeqKey, yarp::os::Bottle &sequence)
 Return a hand sequence. More...
 
virtual bool areFingersMoving (bool &f)
 Query if fingers are moving. More...
 
virtual bool areFingersInPosition (bool &f)
 Query if fingers are in position (cumulative response). More...
 
virtual bool areFingersInPosition (std::deque< bool > &f)
 Query if fingers are in position (finger-wise response). More...
 
virtual bool getGraspModel (perception::Model *&model) const
 Return the model used internally to detect external contacts. More...
 
virtual bool getCartesianIF (yarp::dev::ICartesianControl *&ctrl) const
 Return the cartesian interface used internally to control the limb. More...
 
virtual bool getTorsoJoints (yarp::sig::Vector &torso)
 Return the control status of torso joints. More...
 
virtual bool setTorsoJoints (const yarp::sig::Vector &torso)
 Change the control status of torso joints. More...
 
virtual bool getPose (yarp::sig::Vector &x, yarp::sig::Vector &o) const
 Get the current arm pose. More...
 
virtual bool stopControl ()
 Stop any ongoing arm/hand movements. More...
 
virtual bool setDefaultExecTime (const double execTime)
 Set the default arm movement execution time. More...
 
virtual double getDefaultExecTime () const
 Get the current default arm movement execution time. More...
 
virtual bool setTrackingMode (const bool f)
 Set the task space controller in tracking or non-tracking mode. More...
 
virtual bool getTrackingMode () const
 Get the current controller mode. More...
 
virtual bool enableArmWaving (const yarp::sig::Vector &restPos)
 Enable the waving mode that keeps on moving the arm around a predefined position. More...
 
virtual bool disableArmWaving ()
 Disable the waving mode. More...
 
virtual bool enableReachingTimeout (const double tmo)
 Enable timeout while reaching. More...
 
virtual bool disableReachingTimeout ()
 Disable timeout while reaching. More...
 
virtual bool checkActionsDone (bool &f, const bool sync=false)
 Check whether all the actions in queue are accomplished. More...
 
virtual bool checkActionOnGoing (bool &f, const bool sync=false)
 Check whether an action is still ongoing. More...
 
virtual bool syncCheckInterrupt (const bool disable=false)
 Suddenly interrupt any blocking call that is pending on querying the action status. More...
 
virtual bool syncCheckReinstate ()
 Reinstate the blocking feature for future calls with sync switch on. More...
 

Additional Inherited Members

- Protected Member Functions inherited from iCub::action::ActionPrimitives
virtual void printMessage (const int logtype, const char *format,...) const
 
virtual bool handleTorsoDOF (yarp::os::Property &opt, const std::string &key)
 
virtual void disableTorsoDof ()
 
virtual void enableTorsoDof ()
 
virtual bool configHandSeq (yarp::os::Property &opt)
 
virtual bool configGraspModel (yarp::os::Property &opt)
 
virtual bool _pushAction (const bool execArm, const yarp::sig::Vector &x, const yarp::sig::Vector &o, const double execTime, const bool oEnabled, const bool execHand, const HandWayPoint &handWP, const bool handSeqTerminator, ActionPrimitivesCallback *clb)
 
virtual bool _pushAction (const yarp::sig::Vector &x, const yarp::sig::Vector &o, const std::string &handSeqKey, const double execTime, ActionPrimitivesCallback *clb, const bool oEnabled)
 
virtual bool handCheckMotionDone (const int jnt)
 
virtual bool wait (const Action &action)
 
virtual bool cmdArm (const Action &action)
 
virtual bool cmdArmWP (const Action &action)
 
virtual bool cmdHand (const Action &action)
 
virtual bool isHandSeqEnded ()
 
virtual void postReachCallback ()
 
virtual void init ()
 
virtual bool execQueuedAction ()
 
virtual bool execPendingHandSequences ()
 
virtual void run ()
 
- Protected Attributes inherited from iCub::action::ActionPrimitives
std::string robot
 
std::string local
 
std::string part
 
yarp::dev::PolyDriver polyHand
 
yarp::dev::PolyDriver polyCart
 
yarp::dev::IControlMode * modCtrl
 
yarp::dev::IEncoders * encCtrl
 
yarp::dev::IPositionControl * posCtrl
 
yarp::dev::ICartesianControl * cartCtrl
 
perception::ModelgraspModel
 
yarp::os::PeriodicThread * armWaver
 
std::mutex mtx
 
std::mutex mtx_motionStartEvent
 
std::condition_variable cv_motionStartEvent
 
std::mutex mtx_motionDoneEvent
 
std::condition_variable cv_motionDoneEvent
 
bool armMoveDone
 
bool handMoveDone
 
bool latchArmMoveDone
 
bool latchHandMoveDone
 
bool handSeqTerminator
 
bool fingersInPosition
 
std::deque< bool > fingerInPosition
 
bool configured
 
bool closed
 
bool checkEnabled
 
bool tracking_mode
 
bool torsoActive
 
bool reachTmoEnabled
 
bool locked
 
bool verbose
 
double default_exec_time
 
double waitTmo
 
double reachTmo
 
double latchTimerWait
 
double latchTimerReach
 
double latchTimerReachLog
 
int jHandMin
 
int jHandMax
 
yarp::sig::Vector enableTorsoSw
 
yarp::sig::Vector disableTorsoSw
 
yarp::sig::Vector curHandFinalPoss
 
yarp::sig::Vector curHandTols
 
yarp::sig::Vector curGraspDetectionThres
 
double curHandTmo
 
double latchTimerHand
 
std::vector< int > fingersJnts
 
std::set< int > fingersJntsSet
 
std::set< int > fingersMovingJntsSet
 
std::multimap< int, int > fingers2JntsMap
 
ActionPrimitivesCallbackactionClb
 
yarp::os::PeriodicThread * actionWP
 
iCub::action::ActionPrimitives::ActionsQueue actionsQueue
 
std::map< std::string, std::deque< HandWayPoint > > handSeqMap
 

Detailed Description

A derived class defining a first abstraction layer on top of actionPrimitives father class.

It internally predeclares (without actually defining) a set of hand sequence motions key ("open_hand", "close_hand" and "karate_hand" :) that are used for grasp(), touch() and tap() actions.

Note
Given as an example of how primitive actions can be combined in higher level actions, thus how further layers can be inherited from the base class.

Definition at line 931 of file actionPrimitives.h.

Constructor & Destructor Documentation

◆ ActionPrimitivesLayer1() [1/2]

iCub::action::ActionPrimitivesLayer1::ActionPrimitivesLayer1 ( )
inline

Default Constructor.

Definition at line 937 of file actionPrimitives.h.

◆ ActionPrimitivesLayer1() [2/2]

iCub::action::ActionPrimitivesLayer1::ActionPrimitivesLayer1 ( yarp::os::Property &  opt)
inline

Constructor.

Parameters
optthe Property used to configure the object after its creation.

Definition at line 944 of file actionPrimitives.h.

Member Function Documentation

◆ grasp()

bool ActionPrimitivesLayer1::grasp ( const yarp::sig::Vector &  x,
const yarp::sig::Vector &  o,
const yarp::sig::Vector &  d 
)
virtual

Grasp the given target (combined action).

Parameters
xthe 3-d target position [m].
othe 4-d hand orientation used while reaching/grasping (given in axis-angle representation: ax ay az angle in rad).
dthe displacement [m] wrt the target position that identifies a location to be reached prior to grasping.
Returns
true/false on success/fail.
Note
internal implementation (pseudo-code):
...
pushAction(x+d,o,"open_hand");
pushAction("close_hand");
...

It reachs for (x+d,o) opening the hand, then reachs for (x,o) and finally closes the hand.

Reimplemented in iCub::action::ActionPrimitivesLayer2.

Definition at line 2071 of file actionPrimitives.cpp.

◆ tap()

bool ActionPrimitivesLayer1::tap ( const yarp::sig::Vector &  x1,
const yarp::sig::Vector &  o1,
const yarp::sig::Vector &  x2,
const yarp::sig::Vector &  o2,
const double  execTime = ACTIONPRIM_DISABLE_EXECTIME 
)
virtual

Tap the given target (combined action).

Parameters
x1the fisrt 3-d target position [m].
o1the first 4-d hand orientation (given in axis-angle representation: ax ay az angle in rad).
x2the second 3-d target position [m].
o2the second 4-d hand orientation (given in axis-angle representation: ax ay az angle in rad).
execTimethe arm action execution time only while tapping [s] (to be specified iff different from default value).
Returns
true/false on success/fail.
Note
internal implementation (pseudo-code):
...
pushAction(x1,o1,"karate_hand");
pushAction(x2,o2,execTime);
...

It reachs for (x1,o1), then reachs for (x2,o2) and then again for (x1,o1).

Definition at line 2106 of file actionPrimitives.cpp.

◆ touch()

bool ActionPrimitivesLayer1::touch ( const yarp::sig::Vector &  x,
const yarp::sig::Vector &  o,
const yarp::sig::Vector &  d 
)
virtual

Touch the given target (combined action).

Parameters
xthe 3-d target position [m].
othe 4-d hand orientation used while reaching/touching (given in axis-angle representation: ax ay az angle in rad).
dthe displacement [m] wrt the target position that identifies a location to be reached prior to touching.
Returns
true/false on success/fail.
Note
internal implementation (pseudo-code):
...
pushAction(x+d,o,"karate_hand");
...

It reachs for (x+d,o), then reachs for (x,o). Similar to grasp but without final hand action.

Reimplemented in iCub::action::ActionPrimitivesLayer2.

Definition at line 2089 of file actionPrimitives.cpp.


The documentation for this class was generated from the following files:
iCub::action::ActionPrimitives::pushAction
virtual bool pushAction(const yarp::sig::Vector &x, const yarp::sig::Vector &o, const std::string &handSeqKey, const double execTime=ACTIONPRIM_DISABLE_EXECTIME, ActionPrimitivesCallback *clb=NULL)
Insert a combination of arm and hand primitive actions in the actions queue.
x2
x2
Definition: compute_ekf_fast.m:9
x
x
Definition: compute_ekf_sym.m:21
x1
x1
Definition: compute_ekf_sym.m:28