Skip to content

Commit 90105df

Browse files
committed
Rename ICartesianControl::movi to pose
1 parent 9a3e621 commit 90105df

17 files changed

+71
-53
lines changed

libraries/YarpPlugins/BasicCartesianControl/BasicCartesianControl.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ bool BasicCartesianControl::presetStreamingCommand(int command)
251251

252252
switch (command)
253253
{
254-
case VOCAB_CC_MOVI:
254+
case VOCAB_CC_POSE:
255+
case VOCAB_CC_MOVI: // deprecated
255256
return setControlModes(VOCAB_CM_POSITION_DIRECT);
256257
case VOCAB_CC_TWIST:
257258
return setControlModes(VOCAB_CM_VELOCITY);

libraries/YarpPlugins/BasicCartesianControl/BasicCartesianControl.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class BasicCartesianControl : public yarp::dev::DeviceDriver,
125125
bool wait(double timeout) override;
126126
bool tool(const std::vector<double> & x) override;
127127
bool act(int command) override;
128-
void movi(const std::vector<double> & x) override;
128+
void pose(const std::vector<double> & x) override;
129129
void twist(const std::vector<double> & xdot) override;
130130
void wrench(const std::vector<double> & w) override;
131131
bool setParameter(int vocab, double value) override;

libraries/YarpPlugins/BasicCartesianControl/ICartesianControlImpl.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,10 @@ bool BasicCartesianControl::act(int command)
426426

427427
// -----------------------------------------------------------------------------
428428

429-
void BasicCartesianControl::movi(const std::vector<double> &x)
429+
void BasicCartesianControl::pose(const std::vector<double> &x)
430430
{
431-
if (getCurrentState() != VOCAB_CC_NOT_CONTROLLING || streamingCommand != VOCAB_CC_MOVI
431+
if (getCurrentState() != VOCAB_CC_NOT_CONTROLLING || streamingCommand != VOCAB_CC_POSE
432+
|| streamingCommand != VOCAB_CC_MOVI // deprecated
432433
|| !checkControlModes(VOCAB_CM_POSITION_DIRECT))
433434
{
434435
yCError(BCC) << "Streaming command not preset";

libraries/YarpPlugins/CartesianControlClient/CartesianControlClient.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class CartesianControlClient : public yarp::dev::DeviceDriver,
6666
bool wait(double timeout) override;
6767
bool tool(const std::vector<double> &x) override;
6868
bool act(int command) override;
69-
void movi(const std::vector<double> &x) override;
69+
void pose(const std::vector<double> &x) override;
7070
void twist(const std::vector<double> &xdot) override;
7171
void wrench(const std::vector<double> &w) override;
7272
bool setParameter(int vocab, double value) override;

libraries/YarpPlugins/CartesianControlClient/ICartesianControlImpl.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -276,16 +276,16 @@ bool CartesianControlClient::act(int command)
276276

277277
// -----------------------------------------------------------------------------
278278

279-
void CartesianControlClient::twist(const std::vector<double> &xdot)
279+
void CartesianControlClient::pose(const std::vector<double> &x)
280280
{
281-
handleStreamingConsumerCmd(VOCAB_CC_TWIST, xdot);
281+
handleStreamingConsumerCmd(VOCAB_CC_POSE, x);
282282
}
283283

284284
// -----------------------------------------------------------------------------
285285

286-
void CartesianControlClient::movi(const std::vector<double> &x)
286+
void CartesianControlClient::twist(const std::vector<double> &xdot)
287287
{
288-
handleStreamingConsumerCmd(VOCAB_CC_MOVI, x);
288+
handleStreamingConsumerCmd(VOCAB_CC_TWIST, xdot);
289289
}
290290

291291
// -----------------------------------------------------------------------------

libraries/YarpPlugins/CartesianControlServer/RpcResponder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ void RpcResponder::makeUsage()
188188

189189
std::stringstream ss_cmd;
190190
ss_cmd << "(config param) preset streaming command, available:";
191-
ss_cmd << " [" << Vocab::decode(VOCAB_CC_MOVI) << "]";
191+
ss_cmd << " [" << Vocab::decode(VOCAB_CC_POSE) << "]";
192192
ss_cmd << " [" << Vocab::decode(VOCAB_CC_TWIST) << "]";
193193
ss_cmd << " [" << Vocab::decode(VOCAB_CC_WRENCH) << "]";
194194

libraries/YarpPlugins/CartesianControlServer/StreamResponder.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ void StreamResponder::onRead(yarp::os::Bottle& b)
1919

2020
switch (b.get(0).asVocab32())
2121
{
22-
case VOCAB_CC_MOVI:
23-
handleConsumerCmdMsg(b, &ICartesianControl::movi);
22+
case VOCAB_CC_POSE:
23+
case VOCAB_CC_MOVI: // deprecated
24+
handleConsumerCmdMsg(b, &ICartesianControl::pose);
2425
break;
2526
case VOCAB_CC_TWIST:
2627
handleConsumerCmdMsg(b, &ICartesianControl::twist);

libraries/YarpPlugins/ICartesianControl.h

+14-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ constexpr int VOCAB_CC_ACT = yarp::os::createVocab32('a','c','t'); ///< Act
7373
*/
7474

7575
// Streaming commands
76-
constexpr int VOCAB_CC_MOVI = yarp::os::createVocab32('m','o','v','i'); ///< Achieve pose (position control)
76+
constexpr int VOCAB_CC_POSE = yarp::os::createVocab32('p','o','s','e'); ///< Achieve pose
77+
#ifndef SWIG_PREPROCESSOR_SHOULD_SKIP_THIS
78+
[[deprecated("use `VOCAB_CC_POSE` instead")]]
79+
constexpr int VOCAB_CC_MOVI = yarp::os::createVocab32('m','o','v','i');
80+
#endif
7781
constexpr int VOCAB_CC_TWIST = yarp::os::createVocab32('t','w','s','t'); ///< Instantaneous velocity steps
7882
constexpr int VOCAB_CC_WRENCH = yarp::os::createVocab32('w','r','n','c'); ///< Exert force
7983

@@ -332,7 +336,15 @@ class ICartesianControl
332336
* @param x 6-element vector describing desired instantaneous pose in cartesian space;
333337
* first three elements denote translation (meters), last three denote rotation (radians).
334338
*/
335-
virtual void movi(const std::vector<double> &x) = 0;
339+
virtual void pose(const std::vector<double> &x) = 0;
340+
341+
#ifndef SWIG_PREPROCESSOR_SHOULD_SKIP_THIS
342+
[[deprecated("use `pose` instead")]]
343+
virtual void movi(const std::vector<double> &x)
344+
{
345+
pose(x);
346+
}
347+
#endif
336348

337349
/**
338350
* @brief Instantaneous velocity steps

programs/keyboardController/KeyboardController.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,11 @@ bool KeyboardController::configure(yarp::os::ResourceFinder & rf)
220220

221221
currentCartVels.resize(NUM_CART_COORDS, 0.0);
222222

223-
usingThread = rf.check("movi", "use MOVI command");
223+
usingThread = rf.check("pose", "use POSE command");
224+
usingThread = usingThread || rf.check("movi", "use POSE command"); // deprecated
224225

225-
int threadMs = rf.check("moviPeriodMs", yarp::os::Value(DEFAULT_THREAD_MS), "MOVI thread period [ms]").asInt32();
226+
// `moviPeriodMs` is deprecated
227+
int threadMs = rf.check("posePeriodMs", rf.check("moviPeriodMs", yarp::os::Value(DEFAULT_THREAD_MS)), "POSE thread period [ms]").asInt32();
226228

227229
if (usingThread)
228230
{
@@ -239,7 +241,7 @@ bool KeyboardController::configure(yarp::os::ResourceFinder & rf)
239241

240242
if (!linTrajThread->start())
241243
{
242-
yCError(KC) << "Unable to start MOVI thread";
244+
yCError(KC) << "Unable to start POSE thread";
243245
return false;
244246
}
245247
}

programs/keyboardController/LinearTrajectoryThread.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ bool LinearTrajectoryThread::checkStreamingConfig()
5151

5252
bool LinearTrajectoryThread::configure(const std::vector<double> & vels)
5353
{
54-
if (usingStreamingCommandConfig && !iCartesianControl->setParameter(VOCAB_CC_CONFIG_STREAMING_CMD, VOCAB_CC_MOVI))
54+
if (usingStreamingCommandConfig && !iCartesianControl->setParameter(VOCAB_CC_CONFIG_STREAMING_CMD, VOCAB_CC_POSE))
5555
{
5656
yCWarning(KC) << "Unable to preset streaming command";
5757
return false;
@@ -110,7 +110,7 @@ void LinearTrajectoryThread::run()
110110
deltaX = this->deltaX;
111111
mtx.unlock();
112112

113-
iCartesianControl->movi(deltaX);
113+
iCartesianControl->pose(deltaX);
114114
}
115115
else
116116
{
@@ -119,6 +119,6 @@ void LinearTrajectoryThread::run()
119119
mtx.unlock();
120120

121121
std::vector<double> position = KdlVectorConverter::frameToVector(H);
122-
iCartesianControl->movi(position);
122+
iCartesianControl->pose(position);
123123
}
124124
}

programs/streamingDeviceController/LeapMotionSensorDevice.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515

1616
using namespace roboticslab;
1717

18-
LeapMotionSensorDevice::LeapMotionSensorDevice(yarp::os::Searchable & config, bool usingMovi)
18+
LeapMotionSensorDevice::LeapMotionSensorDevice(yarp::os::Searchable & config, bool usingPose)
1919
: StreamingDevice(config),
2020
iAnalogSensor(nullptr),
21-
usingMovi(usingMovi),
21+
usingPose(usingPose),
2222
previousTimestamp(0.0),
2323
hasActuator(false),
2424
grab(false), pinch(false)
@@ -60,7 +60,7 @@ bool LeapMotionSensorDevice::initialize(bool usingStreamingPreset)
6060
{
6161
if (usingStreamingPreset)
6262
{
63-
int cmd = usingMovi ? VOCAB_CC_MOVI : VOCAB_CC_TWIST;
63+
int cmd = usingPose ? VOCAB_CC_POSE : VOCAB_CC_TWIST;
6464

6565
if (!iCartesianControl->setParameter(VOCAB_CC_CONFIG_STREAMING_CMD, cmd))
6666
{
@@ -211,9 +211,9 @@ int LeapMotionSensorDevice::getActuatorState()
211211

212212
void LeapMotionSensorDevice::sendMovementCommand(double timestamp)
213213
{
214-
if (usingMovi)
214+
if (usingPose)
215215
{
216-
iCartesianControl->movi(data);
216+
iCartesianControl->pose(data);
217217
}
218218
else
219219
{

programs/streamingDeviceController/LeapMotionSensorDevice.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class LeapMotionSensorDevice : public StreamingDevice
2222
{
2323
public:
2424
//! Constructor
25-
LeapMotionSensorDevice(yarp::os::Searchable & config, bool usingMovi);
25+
LeapMotionSensorDevice(yarp::os::Searchable & config, bool usingPose);
2626

2727
bool acquireInterfaces() override;
2828

@@ -42,7 +42,7 @@ class LeapMotionSensorDevice : public StreamingDevice
4242
private:
4343
yarp::dev::IAnalogSensor * iAnalogSensor;
4444

45-
bool usingMovi;
45+
bool usingPose;
4646

4747
std::vector<double> initialTcpOffset;
4848
std::vector<double> initialLeapOffset;

programs/streamingDeviceController/SpnavSensorDevice.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
using namespace roboticslab;
99

10-
SpnavSensorDevice::SpnavSensorDevice(yarp::os::Searchable & config, bool usingMovi, double gain)
10+
SpnavSensorDevice::SpnavSensorDevice(yarp::os::Searchable & config, bool usingPose, double gain)
1111
: StreamingDevice(config),
1212
iAnalogSensor(nullptr),
13-
usingMovi(usingMovi),
13+
usingPose(usingPose),
1414
gain(gain),
1515
buttonClose(false),
1616
buttonOpen(false)
@@ -31,15 +31,15 @@ bool SpnavSensorDevice::acquireInterfaces()
3131

3232
bool SpnavSensorDevice::initialize(bool usingStreamingPreset)
3333
{
34-
if (usingMovi && gain <= 0.0)
34+
if (usingPose && gain <= 0.0)
3535
{
36-
yCWarning(SDC) << "Invalid gain for movi command:" << gain;
36+
yCWarning(SDC) << "Invalid gain for pose command:" << gain;
3737
return false;
3838
}
3939

4040
if (usingStreamingPreset)
4141
{
42-
int cmd = usingMovi ? VOCAB_CC_MOVI : VOCAB_CC_TWIST;
42+
int cmd = usingPose ? VOCAB_CC_POSE : VOCAB_CC_TWIST;
4343

4444
if (!iCartesianControl->setParameter(VOCAB_CC_CONFIG_STREAMING_CMD, cmd))
4545
{
@@ -54,7 +54,7 @@ bool SpnavSensorDevice::initialize(bool usingStreamingPreset)
5454
return false;
5555
}
5656

57-
if (usingMovi && !iCartesianControl->stat(currentX))
57+
if (usingPose && !iCartesianControl->stat(currentX))
5858
{
5959
yCWarning(SDC) << "Unable to stat initial position, assuming zero";
6060
currentX.resize(6, 0.0);
@@ -92,7 +92,7 @@ bool SpnavSensorDevice::acquireData()
9292

9393
bool SpnavSensorDevice::transformData(double scaling)
9494
{
95-
if (usingMovi)
95+
if (usingPose)
9696
{
9797
for (int i = 0; i < 6; i++)
9898
{
@@ -145,7 +145,7 @@ int SpnavSensorDevice::getActuatorState()
145145

146146
bool SpnavSensorDevice::hasValidMovementData() const
147147
{
148-
if (usingMovi)
148+
if (usingPose)
149149
{
150150
for (int i = 0; i < 6; i++)
151151
{
@@ -165,9 +165,9 @@ bool SpnavSensorDevice::hasValidMovementData() const
165165

166166
void SpnavSensorDevice::sendMovementCommand(double timestamp)
167167
{
168-
if (usingMovi)
168+
if (usingPose)
169169
{
170-
iCartesianControl->movi(data);
170+
iCartesianControl->pose(data);
171171

172172
for (int i = 0; i < 6; i++)
173173
{
@@ -182,7 +182,7 @@ void SpnavSensorDevice::sendMovementCommand(double timestamp)
182182

183183
void SpnavSensorDevice::stopMotion()
184184
{
185-
if (!usingMovi)
185+
if (!usingPose)
186186
{
187187
std::vector<double> zeros(6, 0.0);
188188
iCartesianControl->twist(zeros);

programs/streamingDeviceController/SpnavSensorDevice.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class SpnavSensorDevice : public StreamingDevice
4141

4242
std::vector<double> currentX;
4343

44-
bool usingMovi;
44+
bool usingPose;
4545
double gain;
4646
bool buttonClose;
4747
bool buttonOpen;

programs/streamingDeviceController/StreamingDevice.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,26 @@ using namespace roboticslab;
1515
StreamingDevice * StreamingDeviceFactory::makeDevice(const std::string & deviceName, yarp::os::Searchable & config)
1616
{
1717
auto & deviceConfig = config.findGroup(deviceName.c_str());
18-
bool usingMovi = config.check("movi", "enable movi command");
18+
bool usingPose = config.check("pose", "enable pose command");
19+
usingPose = usingPose || config.check("movi", "enable pose command"); // deprecated
1920

2021
yCDebug(SDC) << "Device configuration:" << deviceConfig.toString();
2122

2223
// https://github.com/roboticslab-uc3m/kinematics-dynamics/issues/186
23-
yCWarning(SDC) << "Using MOVI commands, beware NOT TO EXCEED JOINT LIMITS";
24+
yCWarning(SDC) << "Using POSE commands, beware NOT TO EXCEED JOINT LIMITS";
2425

2526
if (deviceName == "SpaceNavigator")
2627
{
2728
double gain = config.check("gain", yarp::os::Value(0.0)).asFloat64();
28-
return new SpnavSensorDevice(deviceConfig, usingMovi, gain);
29+
return new SpnavSensorDevice(deviceConfig, usingPose, gain);
2930
}
3031
else if (deviceName == "LeapMotionSensor")
3132
{
32-
return new LeapMotionSensorDevice(deviceConfig, usingMovi);
33+
return new LeapMotionSensorDevice(deviceConfig, usingPose);
3334
}
3435
else if (deviceName == "WiimoteSensor")
3536
{
36-
return new WiimoteSensorDevice(deviceConfig, usingMovi);
37+
return new WiimoteSensorDevice(deviceConfig, usingPose);
3738
}
3839
else
3940
{

programs/streamingDeviceController/WiimoteSensorDevice.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
using namespace roboticslab;
1212

13-
WiimoteSensorDevice::WiimoteSensorDevice(yarp::os::Searchable & config, bool usingMovi)
13+
WiimoteSensorDevice::WiimoteSensorDevice(yarp::os::Searchable & config, bool usingPose)
1414
: StreamingDevice(config),
1515
iAnalogSensor(nullptr),
1616
mode(NONE),
17-
usingMovi(usingMovi),
17+
usingPose(usingPose),
1818
step(0.0)
1919
{
2020
data.resize(3); // already called by base constructor
@@ -37,15 +37,15 @@ bool WiimoteSensorDevice::acquireInterfaces()
3737

3838
bool WiimoteSensorDevice::initialize(bool usingStreamingPreset)
3939
{
40-
if (usingMovi && step <= 0.0)
40+
if (usingPose && step <= 0.0)
4141
{
4242
yCWarning(SDC) << "Invalid step:" << step;
4343
return false;
4444
}
4545

4646
if (usingStreamingPreset)
4747
{
48-
int cmd = usingMovi ? VOCAB_CC_MOVI : VOCAB_CC_TWIST;
48+
int cmd = usingPose ? VOCAB_CC_POSE : VOCAB_CC_TWIST;
4949

5050
if (!iCartesianControl->setParameter(VOCAB_CC_CONFIG_STREAMING_CMD, cmd))
5151
{
@@ -149,9 +149,9 @@ void WiimoteSensorDevice::sendMovementCommand(double timestamp)
149149
return;
150150
}
151151

152-
if (usingMovi)
152+
if (usingPose)
153153
{
154-
iCartesianControl->movi(xdot);
154+
iCartesianControl->pose(xdot);
155155
}
156156
else
157157
{
@@ -161,7 +161,7 @@ void WiimoteSensorDevice::sendMovementCommand(double timestamp)
161161

162162
void WiimoteSensorDevice::stopMotion()
163163
{
164-
if (!usingMovi)
164+
if (!usingPose)
165165
{
166166
std::vector<double> zeros(6, 0.0);
167167
iCartesianControl->twist(zeros);

0 commit comments

Comments
 (0)