3 #ifndef __YARP_OPENRAVE_CONTROL_BOARD_HPP__
4 #define __YARP_OPENRAVE_CONTROL_BOARD_HPP__
7 #include <yarp/dev/ControlBoardInterfaces.h>
9 #include <openrave/openrave.h>
11 #include "YarpOpenraveBase.hpp"
29 public yarp::dev::DeviceDriver,
30 public yarp::dev::IAxisInfo,
31 public yarp::dev::IControlLimits,
32 public yarp::dev::IControlMode,
33 public yarp::dev::IEncodersTimed,
34 public yarp::dev::IPositionControl,
35 public yarp::dev::IPositionDirect,
36 public yarp::dev::IVelocityControl
40 bool open(yarp::os::Searchable& config)
override;
41 bool close()
override;
44 bool getAxisName(
int axis, std::string& name)
override;
45 bool getJointType(
int axis, yarp::dev::JointTypeEnum& type)
override;
48 bool getAxes(
int *ax)
override;
49 bool positionMove(
int j,
double ref)
override;
50 bool positionMove(
const double *refs)
override;
51 bool relativeMove(
int j,
double delta)
override;
52 bool relativeMove(
const double *deltas)
override;
53 bool checkMotionDone(
int j,
bool *flag)
override;
54 bool checkMotionDone(
bool *flag)
override;
55 bool setRefSpeed(
int j,
double sp)
override;
56 bool setRefSpeeds(
const double *spds)
override;
57 bool setRefAcceleration(
int j,
double acc)
override;
58 bool setRefAccelerations(
const double *accs)
override;
59 bool getRefSpeed(
int j,
double *ref)
override;
60 bool getRefSpeeds(
double *spds)
override;
61 bool getRefAcceleration(
int j,
double *acc)
override;
62 bool getRefAccelerations(
double *accs)
override;
63 bool stop(
int j)
override;
65 bool positionMove(
const int n_joint,
const int *joints,
const double *refs)
override;
66 bool relativeMove(
const int n_joint,
const int *joints,
const double *deltas)
override;
67 bool checkMotionDone(
const int n_joint,
const int *joints,
bool *flags)
override;
68 bool setRefSpeeds(
const int n_joint,
const int *joints,
const double *spds)
override;
69 bool setRefAccelerations(
const int n_joint,
const int *joints,
const double *accs)
override;
70 bool getRefSpeeds(
const int n_joint,
const int *joints,
double *spds)
override;
71 bool getRefAccelerations(
const int n_joint,
const int *joints,
double *accs)
override;
72 bool stop(
const int n_joint,
const int *joints)
override;
73 bool getTargetPosition(
const int joint,
double *ref)
override;
74 bool getTargetPositions(
double *refs)
override;
75 bool getTargetPositions(
const int n_joint,
const int *joints,
double *refs)
override;
78 bool setPosition(
int j,
double ref)
override;
79 bool setPositions(
const int n_joint,
const int *joints,
const double *refs)
override;
80 bool setPositions(
const double *refs)
override;
81 bool getRefPosition(
const int joint,
double *ref)
override;
82 bool getRefPositions(
double *refs)
override;
83 bool getRefPositions(
const int n_joint,
const int *joints,
double *refs)
override;
86 bool resetEncoder(
int j)
override;
87 bool resetEncoders()
override;
88 bool setEncoder(
int j,
double val)
override;
89 bool setEncoders(
const double *vals)
override;
90 bool getEncoder(
int j,
double *v)
override;
91 bool getEncoders(
double *encs)
override;
92 bool getEncoderSpeed(
int j,
double *sp)
override;
93 bool getEncoderSpeeds(
double *spds)
override;
94 bool getEncoderAcceleration(
int j,
double *spds)
override;
95 bool getEncoderAccelerations(
double *accs)
override;
96 bool getEncodersTimed(
double *encs,
double *time)
override;
97 bool getEncoderTimed(
int j,
double *encs,
double *time)
override;
100 bool velocityMove(
int j,
double sp)
override;
101 bool velocityMove(
const double *sp)
override;
102 bool velocityMove(
const int n_joint,
const int *joints,
const double *spds)
override;
103 bool getRefVelocity(
const int joint,
double *vel)
override;
104 bool getRefVelocities(
double *vels)
override;
105 bool getRefVelocities(
const int n_joint,
const int *joints,
double *vels)
override;
108 bool setLimits(
int axis,
double min,
double max)
override;
109 bool getLimits(
int axis,
double *min,
double *max)
override;
110 bool setVelLimits(
int axis,
double min,
double max)
override;
111 bool getVelLimits(
int axis,
double *min,
double *max)
override;
114 bool getControlMode(
int j,
int *mode)
override;
115 bool getControlModes(
int *modes)
override;
116 bool getControlModes(
const int n_joint,
const int *joints,
int *modes)
override;
117 bool setControlMode(
const int j,
const int mode)
override;
118 bool setControlModes(
const int n_joint,
const int *joints,
int *modes)
override;
119 bool setControlModes(
int *modes)
override;
124 std::vector<int> controlModes;
125 std::vector<double> refSpeeds;
128 OpenRAVE::MultiControllerBasePtr multi;
129 std::vector<OpenRAVE::ControllerBasePtr> pcontrols;
130 std::vector<int> manipulatorIDs;
131 std::vector<OpenRAVE::dReal> manipulatorTargetRads;
132 std::vector<OpenRAVE::RobotBase::JointPtr> vectorOfJointPtr;
139 inline double degToRad(
double deg) {
return deg * M_PI / 180.0; }
146 inline double radToDeg(
double rad) {
return rad * 180.0 / M_PI; }
156 if (vectorOfJointPtr[j]->IsPrismatic(0))
return deg;
168 if (vectorOfJointPtr[j]->IsPrismatic(0))
return rad;
Implements shared configuration functions.
Definition: YarpOpenraveBase.hpp:32
Implements the YARP_dev IPositionControl, IVelocityControl, IEncodersTimed, etc. interface class memb...
Definition: YarpOpenraveControlBoard.hpp:37
double radToDeg(double rad)
Converts radians to degrees.
Definition: YarpOpenraveControlBoard.hpp:146
double radToDegIfNotPrismatic(int j, double rad)
Converts radians to degrees, unless joint j is prismatic.
Definition: YarpOpenraveControlBoard.hpp:166
double degToRadIfNotPrismatic(int j, double deg)
Converts degrees to radians, unless joint j is prismatic.
Definition: YarpOpenraveControlBoard.hpp:154
double degToRad(double deg)
Converts degrees to radians.
Definition: YarpOpenraveControlBoard.hpp:139
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:5