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 STATE = yarp::os::createVocab32(
's',
't',
'a',
't'),
46 INV = yarp::os::createVocab32(
'i',
'n',
'v'),
47 MOVEJ = yarp::os::createVocab32(
'm',
'o',
'v',
'j'),
48 MOVEL = yarp::os::createVocab32(
'm',
'o',
'v',
'l'),
49 MOVEV = yarp::os::createVocab32(
'm',
'o',
'v',
'v'),
50 GCMP = yarp::os::createVocab32(
'g',
'c',
'm',
'p'),
51 FORCE = yarp::os::createVocab32(
'f',
'o',
'r',
'c'),
52 STOP = yarp::os::createVocab32(
's',
't',
'o',
'p'),
53 TOOL = yarp::os::createVocab32(
't',
'o',
'o',
'l'),
54 ACT = yarp::os::createVocab32(
'a',
'c',
't')
64 POSE = yarp::os::createVocab32(
'p',
'o',
's',
'e'),
65 TWIST = yarp::os::createVocab32(
't',
'w',
's',
't'),
66 WRENCH = yarp::os::createVocab32(
'w',
'r',
'n',
'c')
76 NONE = yarp::os::createVocab32(
'n',
'c',
't',
'l'),
77 MOVEJ = yarp::os::createVocab32(
'm',
'o',
'v',
'j'),
78 MOVEL = yarp::os::createVocab32(
'm',
'o',
'v',
'l'),
79 MOVEV = yarp::os::createVocab32(
'm',
'o',
'v',
'v'),
80 GCMP = yarp::os::createVocab32(
'g',
'c',
'm',
'p'),
81 FORCE = yarp::os::createVocab32(
'f',
'o',
'r',
'c')
91 NONE = yarp::os::createVocab32(
'a',
'c',
'n'),
92 CLOSE = yarp::os::createVocab32(
'a',
'c',
'c',
'g'),
93 OPEN = yarp::os::createVocab32(
'a',
'c',
'o',
'g'),
94 STOP = yarp::os::createVocab32(
'a',
'c',
's',
'g'),
95 GENERIC = yarp::os::createVocab32(
'a',
'c',
'g')
105 GAIN = yarp::os::createVocab32(
'c',
'p',
'c',
'g'),
107 TRAJ_REF_SPD = yarp::os::createVocab32(
'c',
'p',
't',
's'),
108 TRAJ_REF_ACC = yarp::os::createVocab32(
'c',
'p',
't',
'a'),
109 CMC_PERIOD = yarp::os::createVocab32(
'c',
'p',
'c',
'p'),
110 FRAME = yarp::os::createVocab32(
'c',
'p',
'f'),
121 std::vector<double>
x;
166 virtual yarp::dev::ReturnValue
solvePose(
const std::vector<double> & xd, std::vector<double> & q) = 0;
180 virtual yarp::dev::ReturnValue
moveJoint(
const std::vector<double> & xd) = 0;
193 virtual yarp::dev::ReturnValue
moveLinear(
const std::vector<double> & xd) = 0;
206 virtual yarp::dev::ReturnValue
moveVelocity(
const std::vector<double> & xdotd) = 0;
228 virtual yarp::dev::ReturnValue
forceControl(
const std::vector<double> & fd) = 0;
250 virtual yarp::dev::ReturnValue
changeTool(
const std::vector<double> & x) = 0;
286 virtual void pose(
const std::vector<double> & x) = 0;
297 virtual void twist(
const std::vector<double> & xdot) = 0;
307 virtual void wrench(
const std::vector<double> & w) = 0;
322 using config_value_t = std::variant<double, yarp::conf::vocab32_t>;
323 using config_map_t = std::map<Config, config_value_t>;
358 virtual yarp::dev::ReturnValue
setParameters(
const config_map_t & params) = 0;
373#ifndef SWIG_PREPROCESSOR_SHOULD_SKIP_THIS
374 [[deprecated(
"use `ICartesianControl::getState` instead")]]
375 virtual bool stat(std::vector<double> & x,
int * state =
nullptr,
double * timestamp =
nullptr)
378 auto ret =
getState(controllerState);
379 x = controllerState.
x;
380 if (state !=
nullptr) *state =
static_cast<int>(controllerState.
mode);
381 if (timestamp !=
nullptr) *timestamp = controllerState.
timestamp;
385 [[deprecated(
"use `ICartesianControl::solvePose` instead")]]
386 virtual bool inv(
const std::vector<double> & xd, std::vector<double> & q)
389 [[deprecated(
"use `ICartesianControl::moveJoint` instead")]]
390 virtual bool movj(
const std::vector<double> & xd)
393 [[deprecated(
"use `ICartesianControl::getState and moveJoint` instead")]]
394 virtual bool relj(
const std::vector<double> & xd)
397 [[deprecated(
"use `ICartesianControl::moveLinear` instead")]]
398 virtual bool movl(
const std::vector<double> & xd)
401 [[deprecated(
"use `ICartesianControl::moveVelocity` instead")]]
402 virtual bool movv(
const std::vector<double> & xdotd)
405 [[deprecated(
"use `ICartesianControl::gravityCompensation` instead")]]
409 [[deprecated(
"use `ICartesianControl::forceControl` instead")]]
410 virtual bool forc(
const std::vector<double> & fd)
413 [[deprecated(
"use `ICartesianControl::getState` instead")]]
414 virtual bool wait(
double timeout = 0.0)
417 [[deprecated(
"use `ICartesianControl::changeTool` instead")]]
418 virtual bool tool(
const std::vector<double> & x)
421 [[deprecated(
"use `ICartesianControl::Actuator` signature instead")]]
422 virtual bool act(
int command)
425 [[deprecated(
"use `ICartesianControl::Config` signature instead")]]
429 [[deprecated(
"use `ICartesianControl::Config` signature instead")]]
433 [[deprecated(
"use `ICartesianControl::Config` signature instead")]]
434 virtual bool setParameters(
const std::map<int, double> & params)
437 [[deprecated(
"use `ICartesianControl::Config` signature instead")]]
445#ifndef SWIG_PREPROCESSOR_SHOULD_SKIP_THIS
446[[deprecated(
"use `ICartesianControl::Vocabs::OK` instead")]]
449[[deprecated(
"use `ICartesianControl::Vocabs::FAILED` instead")]]
452[[deprecated(
"use `ICartesianControl::Vocabs::SET` instead")]]
455[[deprecated(
"use `ICartesianControl::Vocabs::GET` instead")]]
458[[deprecated(
"use `ICartesianControl::Vocabs::NOT_SET` instead")]]
461[[deprecated(
"use `ICartesianControl::RPC::STATE` instead")]]
464[[deprecated(
"use `ICartesianControl::RPC::INV` instead")]]
467[[deprecated(
"use `ICartesianControl::RPC::MOVEJ` instead")]]
470[[deprecated(
"use `ICartesianControl::RPC::MOVJ` instead")]]
471constexpr auto VOCAB_CC_RELJ = 0;
473[[deprecated(
"use `ICartesianControl::RPC::MOVEL` instead")]]
476[[deprecated(
"use `ICartesianControl::RPC::MOVEV` instead")]]
479[[deprecated(
"use `ICartesianControl::RPC::GCMP` instead")]]
482[[deprecated(
"use `ICartesianControl::RPC::FORCE` instead")]]
485[[deprecated(
"use `ICartesianControl::RPC::STOP` instead")]]
488[[deprecated(
"use `ICartesianControl::RPC::STATE` instead")]]
489constexpr auto VOCAB_CC_WAIT = 0;
491[[deprecated(
"use `ICartesianControl::RPC::TOOL` instead")]]
494[[deprecated(
"use `ICartesianControl::RPC::ACT` instead")]]
497[[deprecated(
"use `ICartesianControl::Streaming::POSE` instead")]]
500[[deprecated(
"use `ICartesianControl::Streaming::TWIST` instead")]]
503[[deprecated(
"use `ICartesianControl::Streaming::WRENCH` instead")]]
506[[deprecated(
"use `ICartesianControl::State::NONE` instead")]]
509[[deprecated(
"use `ICartesianControl::State::MOVEJ` instead")]]
512[[deprecated(
"use `ICartesianControl::State::MOVEL` instead")]]
515[[deprecated(
"use `ICartesianControl::State::MOVEV` instead")]]
518[[deprecated(
"use `ICartesianControl::State::GCMP` instead")]]
521[[deprecated(
"use `ICartesianControl::State::FORCE` instead")]]
524[[deprecated(
"use `ICartesianControl::Actuator::NONE` instead")]]
527[[deprecated(
"use `ICartesianControl::Actuator::CLOSE` instead")]]
530[[deprecated(
"use `ICartesianControl::Actuator::OPEN` instead")]]
533[[deprecated(
"use `ICartesianControl::Actuator::STOP` instead")]]
536[[deprecated(
"use `ICartesianControl::Actuator::GENERIC` instead")]]
539[[deprecated(
"unused")]]
540constexpr auto VOCAB_CC_CONFIG_PARAMS = 0;
542[[deprecated(
"use `ICartesianControl::Config::GAIN` instead")]]
545[[deprecated(
"use `ICartesianControl::Config::TRAJ_DURATION` instead")]]
548[[deprecated(
"use `ICartesianControl::Config::TRAJ_REF_SPD` instead")]]
551[[deprecated(
"use `ICartesianControl::Config::TRAJ_REF_ACC` instead")]]
554[[deprecated(
"use `ICartesianControl::Config::CMC_PERIOD` instead")]]
557[[deprecated(
"unused")]]
558constexpr auto VOCAB_CC_CONFIG_WAIT_PERIOD = 0;
560[[deprecated(
"use `ICartesianControl::Config::FRAME` instead")]]
563[[deprecated(
"use `ICartesianControl::Config::STREAMING_CMD` instead")]]
Abstract base class for a cartesian controller.
Definition ICartesianControl.h:22
Streaming
Streaming vocabs.
Definition ICartesianControl.h:63
@ 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:75
@ 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:90
@ 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:104
@ 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 getParameter(Config vocab, config_value_t *value)=0
Retrieve a configuration parameter.
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.
RPC
RPC vocabs.
Definition ICartesianControl.h:44
@ STATE
Current state and position.
@ MOVEL
Linear move to target position.
@ GCMP
Gravity compensation.
@ MOVEJ
Move in joint space, absolute coordinates.
@ MOVEV
Linear move with given velocity.
virtual yarp::dev::ReturnValue solvePose(const std::vector< double > &xd, std::vector< double > &q)=0
Inverse kinematics.
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:120
float progress
Progress of the current trajectory, if any (0.0 to 1.0)
Definition ICartesianControl.h:125
Mode mode
Current controller mode.
Definition ICartesianControl.h:122
std::vector< double > x
Current pose: translation (3, meters) + rotation (3, radians, scaled axis-angle)
Definition ICartesianControl.h:121
double timestamp
Timestamp of the last received pose.
Definition ICartesianControl.h:123
double duration
Duration of the current trajectory, if any (seconds)
Definition ICartesianControl.h:124
bool success
Whether the last trajectory command was successful.
Definition ICartesianControl.h:126