|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
40 if (stream_IPosCtrl) {
41 stream_IPosCtrl->getAxes(&stream_nJoints);
57 if (
static_cast<int>(cmdVector.
size()) > stream_nJoints) {
59 yCError(
CONTROLBOARDWRAPPER,
"Received command vector with number of elements bigger than axis controlled by this wrapper (cmd: %s requested jnts: %d received jnts: %d)\n", str.c_str(), stream_nJoints, (
int)cmdVector.
size());
62 if (cmdVector.
data() ==
nullptr) {
73 bool ok = stream_IPWM->setRefDutyCycle(b.
get(2).
asInt32(), cmdVector[0]);
83 bool ok = stream_IPWM->setRefDutyCycles(cmdVector.
data());
97 if (stream_ICurrent) {
98 bool ok = stream_ICurrent->setRefCurrent(b.
get(2).
asInt32(), cmdVector[0]);
105 if (stream_ICurrent) {
106 bool ok = stream_ICurrent->setRefCurrents(cmdVector.
data());
113 if (stream_ICurrent) {
116 if ((
static_cast<int>(jlut->
size()) != n_joints) && (
static_cast<int>(cmdVector.
size()) != n_joints)) {
117 yCError(
CONTROLBOARDWRAPPER,
"Received VOCAB_CURRENT_REF_GROUP size of joints vector or currents vector does not match the selected joint number\n");
120 int* joint_list =
new int[n_joints];
121 for (
int i = 0; i < n_joints; i++) {
126 bool ok = stream_ICurrent->setRefCurrents(n_joints, joint_list, cmdVector.
data());
148 if (stream_IPosCtrl) {
149 bool ok = stream_IPosCtrl->positionMove(cmdVector.
data());
163 stream_IVel->velocityMove(b.
get(1).
asInt32(), cmdVector[0]);
168 bool ok = stream_IVel->velocityMove(cmdVector.
data());
176 if (stream_IPosDirect) {
177 bool ok = stream_IPosDirect->setPosition(b.
get(1).
asInt32(), cmdVector[0]);
185 if (stream_ITorque) {
186 bool ok = stream_ITorque->setRefTorque(b.
get(1).
asInt32(), cmdVector[0]);
194 if (stream_ITorque) {
195 bool ok = stream_ITorque->setRefTorques(cmdVector.
data());
203 if (stream_ITorque) {
206 if ((
static_cast<int>(jlut->
size()) != n_joints) && (
static_cast<int>(cmdVector.
size()) != n_joints)) {
207 yCError(
CONTROLBOARDWRAPPER,
"Received VOCAB_TORQUES_DIRECT_GROUP size of joints vector or torques vector does not match the selected joint number\n");
210 int* joint_list =
new int[n_joints];
211 for (
int i = 0; i < n_joints; i++) {
216 bool ok = stream_ITorque->setRefTorques(n_joints, joint_list, cmdVector.
data());
226 if (stream_IPosDirect) {
229 if ((
static_cast<int>(jlut->
size()) != n_joints) && (
static_cast<int>(cmdVector.
size()) != n_joints)) {
230 yCError(
CONTROLBOARDWRAPPER,
"Received VOCAB_POSITION_DIRECT_GROUP size of joints vector or positions vector does not match the selected joint number\n");
233 int* joint_list =
new int[n_joints];
234 for (
int i = 0; i < n_joints; i++) {
239 bool ok = stream_IPosDirect->setPositions(n_joints, joint_list, cmdVector.
data());
249 if (stream_IPosDirect) {
250 bool ok = stream_IPosDirect->setPositions(cmdVector.
data());
260 if ((
static_cast<int>(jlut->
size()) != n_joints) && (
static_cast<int>(cmdVector.
size()) != n_joints)) {
261 yCError(
CONTROLBOARDWRAPPER,
"Received VOCAB_VELOCITY_MOVE_GROUP size of joints vector or positions vector does not match the selected joint number\n");
264 int* joint_list =
new int[n_joints];
265 for (
int i = 0; i < n_joints; i++) {
269 bool ok = stream_IVel->velocityMove(n_joints, joint_list, cmdVector.
data());
A simple collection of objects that can be described and transmitted in a portable way.
virtual std::int32_t asVocab() const
Get vocabulary identifier as an integer.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
Group a pair of objects to be sent and received together.
size_type size() const
Gets the number of elements in the bottle.
BODY body
An object of the second type (BODY).
constexpr yarp::conf::vocab32_t VOCAB_CURRENT_REF_GROUP
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_REF_PWMS
constexpr yarp::conf::vocab32_t VOCAB_POSITION_MOVES
Interface implemented by all device drivers.
constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECT
constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECTS
void onRead(CommandMessage &v) override
Callback function.
constexpr yarp::conf::vocab32_t VOCAB_POSITION_DIRECTS
void init(yarp::dev::DeviceDriver *x)
Initialization.
An interface for the device drivers.
constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECT_GROUP
constexpr yarp::conf::vocab32_t VOCAB_VELOCITY_MOVES
std::string decode(NetInt32 code)
Convert a vocabulary identifier into a string.
constexpr yarp::conf::vocab32_t VOCAB_VELOCITY_MODE
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
const yarp::os::LogComponent & CONTROLBOARDWRAPPER()
constexpr yarp::conf::vocab32_t VOCAB_CURRENT_REFS
constexpr yarp::conf::vocab32_t VOCAB_POSITION_DIRECT
Interface for controlling an axis, by sending directly a PWM reference signal to a motor.
Interface for control boards implementing velocity control.
T * data()
Return a pointer to the first element of the vector.
#define yCError(component,...)
constexpr yarp::conf::vocab32_t VOCAB_CURRENTCONTROL_INTERFACE
virtual std::int32_t asInt32() const
Get 32-bit integer value.
std::string toString(int precision=-1, int width=-1) const
Creates a string object containing a text representation of the object.
Interface for control boards implementing current control.
HEAD head
An object of the first type (HEAD).
An interface to the operating system, including Port based communication.
Interface for a generic control board device implementing position control.
virtual Bottle * asList() const
Get list value.
Interface for control boards implementing torque control.
#define yCTrace(component,...)
constexpr yarp::conf::vocab32_t VOCAB_VELOCITY_MOVE
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_REF_PWM
constexpr yarp::conf::vocab32_t VOCAB_CURRENT_REF
Interface for a generic control board device implementing position control.
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_INTERFACE
constexpr yarp::conf::vocab32_t VOCAB_POSITION_MODE
constexpr yarp::conf::vocab32_t VOCAB_VELOCITY_MOVE_GROUP
constexpr yarp::conf::vocab32_t VOCAB_POSITION_DIRECT_GROUP