3#ifndef __I_CARTESIAN_CONTROL__
4#define __I_CARTESIAN_CONTROL__
10#include <yarp/os/Vocab.h>
11#include <yarp/dev/ReturnValue.h>
13#include <ICartesianSolver.h>
31 OK = yarp::os::createVocab32(
'o',
'k'),
32 FAILED = yarp::os::createVocab32(
'f',
'a',
'i',
'l'),
33 SET = yarp::os::createVocab32(
's',
'e',
't'),
34 GET = yarp::os::createVocab32(
'g',
'e',
't'),
35 NOT_SET = yarp::os::createVocab32(
'n',
's',
'e',
't')
45 NOT_SET = yarp::os::createVocab32(
'n',
's',
'e',
't'),
46 POSE = yarp::os::createVocab32(
'p',
'o',
's',
'e'),
47 TWIST = yarp::os::createVocab32(
't',
'w',
's',
't'),
48 WRENCH = yarp::os::createVocab32(
'w',
'r',
'n',
'c')
58 NONE = yarp::os::createVocab32(
'n',
'c',
't',
'l'),
59 MOVEJ = yarp::os::createVocab32(
'm',
'o',
'v',
'j'),
60 MOVEL = yarp::os::createVocab32(
'm',
'o',
'v',
'l'),
61 MOVEV = yarp::os::createVocab32(
'm',
'o',
'v',
'v'),
62 GCMP = yarp::os::createVocab32(
'g',
'c',
'm',
'p'),
63 FORCE = yarp::os::createVocab32(
'f',
'o',
'r',
'c')
73 NONE = yarp::os::createVocab32(
'a',
'c',
'n'),
74 CLOSE = yarp::os::createVocab32(
'a',
'c',
'c',
'g'),
75 OPEN = yarp::os::createVocab32(
'a',
'c',
'o',
'g'),
76 STOP = yarp::os::createVocab32(
'a',
'c',
's',
'g'),
77 GENERIC = yarp::os::createVocab32(
'a',
'c',
'g')
87 GAIN = yarp::os::createVocab32(
'c',
'p',
'c',
'g'),
91 CMC_PERIOD = yarp::os::createVocab32(
'c',
'p',
'c',
'p'),
92 FRAME = yarp::os::createVocab32(
'c',
'p',
'f'),
103 std::vector<double>
x;
148 virtual yarp::dev::ReturnValue
solvePose(
const std::vector<double> & xd, std::vector<double> & q) = 0;
162 virtual yarp::dev::ReturnValue
moveJoint(
const std::vector<double> & xd) = 0;
175 virtual yarp::dev::ReturnValue
moveLinear(
const std::vector<double> & xd) = 0;
188 virtual yarp::dev::ReturnValue
moveVelocity(
const std::vector<double> & xdotd) = 0;
210 virtual yarp::dev::ReturnValue
forceControl(
const std::vector<double> & fd) = 0;
232 virtual yarp::dev::ReturnValue
changeTool(
const std::vector<double> & x) = 0;
268 virtual void pose(
const std::vector<double> & x) = 0;
279 virtual void twist(
const std::vector<double> & xdot) = 0;
289 virtual void wrench(
const std::vector<double> & w) = 0;
304 using config_value_t = std::variant<double, yarp::conf::vocab32_t>;
305 using config_map_t = std::map<Config, config_value_t>;
340 virtual yarp::dev::ReturnValue
setParameters(
const config_map_t & params) = 0;
355#ifndef SWIG_PREPROCESSOR_SHOULD_SKIP_THIS
356 [[deprecated(
"use `ICartesianControl::getState` instead")]]
357 virtual bool stat(std::vector<double> & x,
int * state =
nullptr,
double * timestamp =
nullptr)
360 auto ret =
getState(controllerState);
361 x = controllerState.
x;
362 if (state !=
nullptr) *state =
static_cast<int>(controllerState.
mode);
363 if (timestamp !=
nullptr) *timestamp = controllerState.
timestamp;
367 [[deprecated(
"use `ICartesianControl::solvePose` instead")]]
368 virtual bool inv(
const std::vector<double> & xd, std::vector<double> & q)
371 [[deprecated(
"use `ICartesianControl::moveJoint` instead")]]
372 virtual bool movj(
const std::vector<double> & xd)
375 [[deprecated(
"use `ICartesianControl::getState and moveJoint` instead")]]
376 virtual bool relj(
const std::vector<double> & xd)
379 [[deprecated(
"use `ICartesianControl::moveLinear` instead")]]
380 virtual bool movl(
const std::vector<double> & xd)
383 [[deprecated(
"use `ICartesianControl::moveVelocity` instead")]]
384 virtual bool movv(
const std::vector<double> & xdotd)
387 [[deprecated(
"use `ICartesianControl::gravityCompensation` instead")]]
391 [[deprecated(
"use `ICartesianControl::forceControl` instead")]]
392 virtual bool forc(
const std::vector<double> & fd)
395 [[deprecated(
"use `ICartesianControl::getState` instead")]]
396 virtual bool wait(
double timeout = 0.0)
399 [[deprecated(
"use `ICartesianControl::changeTool` instead")]]
400 virtual bool tool(
const std::vector<double> & x)
403 [[deprecated(
"use `ICartesianControl::Actuator` signature instead")]]
404 virtual bool act(
int command)
407 [[deprecated(
"use `ICartesianControl::Config` signature instead")]]
411 [[deprecated(
"use `ICartesianControl::Config` signature instead")]]
415 [[deprecated(
"use `ICartesianControl::Config` signature instead")]]
416 virtual bool setParameters(
const std::map<int, double> & params)
419 [[deprecated(
"use `ICartesianControl::Config` signature instead")]]
427#ifndef SWIG_PREPROCESSOR_SHOULD_SKIP_THIS
428[[deprecated(
"use `ICartesianControl::Vocabs::OK` instead")]]
431[[deprecated(
"use `ICartesianControl::Vocabs::FAILED` instead")]]
434[[deprecated(
"use `ICartesianControl::Vocabs::SET` instead")]]
437[[deprecated(
"use `ICartesianControl::Vocabs::GET` instead")]]
440[[deprecated(
"use `ICartesianControl::Vocabs::NOT_SET` instead")]]
443[[deprecated(
"not used anymore")]]
444constexpr auto VOCAB_CC_STAT = 0;
446[[deprecated(
"not used anymore")]]
447constexpr auto VOCAB_CC_INV = 0;
449[[deprecated(
"not used anymore")]]
450constexpr auto VOCAB_CC_MOVJ = 0;
452[[deprecated(
"not used anymore")]]
453constexpr auto VOCAB_CC_RELJ = 0;
455[[deprecated(
"not used anymore")]]
456constexpr auto VOCAB_CC_MOVL = 0;
458[[deprecated(
"not used anymore")]]
459constexpr auto VOCAB_CC_MOVV = 0;
461[[deprecated(
"not used anymore")]]
462constexpr auto VOCAB_CC_GCMP = 0;
464[[deprecated(
"not used anymore")]]
465constexpr auto VOCAB_CC_FORC = 0;
467[[deprecated(
"not used anymore")]]
468constexpr auto VOCAB_CC_STOP = 0;
470[[deprecated(
"not used anymore")]]
471constexpr auto VOCAB_CC_WAIT = 0;
473[[deprecated(
"not used anymore")]]
474constexpr auto VOCAB_CC_TOOL = 0;
476[[deprecated(
"not used anymore")]]
477constexpr auto VOCAB_CC_ACT = 0;
479[[deprecated(
"use `ICartesianControl::Streaming::POSE` instead")]]
482[[deprecated(
"use `ICartesianControl::Streaming::TWIST` instead")]]
485[[deprecated(
"use `ICartesianControl::Streaming::WRENCH` instead")]]
488[[deprecated(
"use `ICartesianControl::State::NONE` instead")]]
491[[deprecated(
"use `ICartesianControl::State::MOVEJ` instead")]]
494[[deprecated(
"use `ICartesianControl::State::MOVEL` instead")]]
497[[deprecated(
"use `ICartesianControl::State::MOVEV` instead")]]
500[[deprecated(
"use `ICartesianControl::State::GCMP` instead")]]
503[[deprecated(
"use `ICartesianControl::State::FORCE` instead")]]
506[[deprecated(
"use `ICartesianControl::Actuator::NONE` instead")]]
509[[deprecated(
"use `ICartesianControl::Actuator::CLOSE` instead")]]
512[[deprecated(
"use `ICartesianControl::Actuator::OPEN` instead")]]
515[[deprecated(
"use `ICartesianControl::Actuator::STOP` instead")]]
518[[deprecated(
"use `ICartesianControl::Actuator::GENERIC` instead")]]
521[[deprecated(
"unused")]]
522constexpr auto VOCAB_CC_CONFIG_PARAMS = 0;
524[[deprecated(
"use `ICartesianControl::Config::GAIN` instead")]]
527[[deprecated(
"use `ICartesianControl::Config::TRAJ_DURATION` instead")]]
530[[deprecated(
"use `ICartesianControl::Config::TRAJ_REF_SPD` instead")]]
533[[deprecated(
"use `ICartesianControl::Config::TRAJ_REF_ACC` instead")]]
536[[deprecated(
"use `ICartesianControl::Config::CMC_PERIOD` instead")]]
539[[deprecated(
"unused")]]
540constexpr auto VOCAB_CC_CONFIG_WAIT_PERIOD = 0;
542[[deprecated(
"use `ICartesianControl::Config::FRAME` instead")]]
545[[deprecated(
"use `ICartesianControl::Config::STREAMING_CMD` instead")]]
Abstract base class for a cartesian controller.
Definition ICartesianControl.h:22
Streaming
Streaming vocabs.
Definition ICartesianControl.h:44
@ TWIST
Instantaneous velocity steps.
virtual ~ICartesianControl()=default
Destructor.
virtual yarp::dev::ReturnValue moveJoint(const std::vector< double > &xd)=0
Move in joint space.
virtual yarp::dev::ReturnValue forceControl(const std::vector< double > &fd)=0
Force control.
virtual yarp::dev::ReturnValue moveVelocity(const std::vector< double > &xdotd)=0
Linear move with given velocity.
virtual yarp::dev::ReturnValue setParameters(const config_map_t ¶ms)=0
Set multiple configuration parameters.
virtual yarp::dev::ReturnValue gravityCompensation()=0
Gravity compensation.
virtual yarp::dev::ReturnValue getParameters(config_map_t ¶ms)=0
Retrieve multiple configuration parameters.
virtual yarp::dev::ReturnValue setParameter(Config vocab, config_value_t value)=0
Set a configuration parameter.
virtual yarp::dev::ReturnValue getState(ControllerState &state)=0
Current state and position.
Mode
Controller mode vocabs.
Definition ICartesianControl.h:57
@ FORCE
Executing FORCE command.
@ MOVEL
Executing MOVEL command.
@ GCMP
Executing GCMP command.
@ MOVEJ
Executing MOVEJ command.
@ MOVEV
Executing MOVEV command.
Actuator
Actuator control vocabs.
Definition ICartesianControl.h:72
@ NONE
No actuator or no action.
@ GENERIC
Generic actuator.
Vocabs
General-purpose vocabs.
Definition ICartesianControl.h:30
virtual void twist(const std::vector< double > &xdot)=0
Instantaneous velocity steps.
Config
Controller configuration vocabs.
Definition ICartesianControl.h:86
@ STREAMING_CMD
Preset streaming command.
@ TRAJ_REF_ACC
Trajectory reference acceleration [m/s^2].
@ CMC_PERIOD
CMC period [s].
@ TRAJ_REF_SPD
Trajectory reference speed [m/s].
@ TRAJ_DURATION
Trajectory duration [s].
virtual yarp::dev::ReturnValue stopControl()=0
Stop control.
virtual yarp::dev::ReturnValue changeTool(const std::vector< double > &x)=0
Change tool.
virtual void pose(const std::vector< double > &x)=0
Achieve pose.
virtual yarp::dev::ReturnValue moveLinear(const std::vector< double > &xd)=0
Linear move to target position.
virtual void wrench(const std::vector< double > &w)=0
Exert force.
virtual yarp::dev::ReturnValue solvePose(const std::vector< double > &xd, std::vector< double > &q)=0
Inverse kinematics.
virtual yarp::dev::ReturnValue getParameter(Config vocab, config_value_t &value)=0
Retrieve a configuration parameter.
virtual yarp::dev::ReturnValue actuateTool(Actuator command)=0
Actuate tool.
The main, catch-all namespace for Robotics Lab UC3M.
Definition groups.dox:6
Controller state structure.
Definition ICartesianControl.h:102
float progress
Progress of the current trajectory, if any (0.0 to 1.0)
Definition ICartesianControl.h:107
Mode mode
Current controller mode.
Definition ICartesianControl.h:104
std::vector< double > x
Current pose: translation (3, meters) + rotation (3, radians, scaled axis-angle)
Definition ICartesianControl.h:103
double timestamp
Timestamp of the last received pose.
Definition ICartesianControl.h:105
double duration
Duration of the current trajectory, if any (seconds)
Definition ICartesianControl.h:106
bool success
Whether the last trajectory command was successful.
Definition ICartesianControl.h:108