YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#include <yarp/os/Network.h>
7#include <yarp/os/RFModule.h>
8#include <yarp/os/Time.h>
9#include <yarp/os/Log.h>
10#include <yarp/os/LogStream.h>
12#include <yarp/sig/Vector.h>
14
15#include <yarp/dev/PolyDriver.h>
17
18#include <fstream>
19#include <iostream>
20#include <iomanip>
21#include <string>
22#include <vector>
23#include <deque>
24#include <cmath>
25#include <map>
26#include <mutex>
27
28#include "robotDriver.h"
29#include "robotAction.h"
30#include "broadcastingThread.h"
31#include "controlThread.h"
32
33// ******************** THE MODULE
35{
36protected:
38 std::string m_name;
40 std::map<std::string,yarp::dev::PolyDriver*> m_robotClients;
41 std::map<std::string,yarp::dev::PolyDriver*> m_robotRemappers;
42 std::map<std::string,robotDriver*> m_robotControllers;
43 std::map<std::string,action_class> m_actions;
46
48
49 public: //yarpActionsPlayer_IDL methods
50 bool start() override;
51 bool stop() override;
52 bool reset() override;
53 bool forever() override;
54 bool print_frames() override;
55 bool speed_factor(const double value) override;
56 bool resample(const double value) override;
57 bool choose_action(const std::string& action_name) override;
58 bool play_action(const std::string& action_name) override;
59 bool show_actions() override;
60 bool set_thread_period(const double value) override;
61 bool set_initial_move_time(const double value) override;
62
63 std::string vectorToString(const std::vector<double>& vec)
64 {
65 std::ostringstream oss;
66 oss << std::fixed << std::setprecision(2);
67 oss << "[";
68 for (size_t i = 0; i < vec.size(); ++i) {
69 oss << vec[i];
70 if (i + 1 != vec.size()) oss << ", ";
71 }
72 oss << "]";
73 return oss.str();
74 }
75
76 public:
78 {
79 m_verbose=true;
80 }
81
83 {
84 // stop the threads
85 if (m_wthread)
86 {
87 m_wthread->stop();
89 delete m_wthread;
90 m_wthread=nullptr;
91 }
92
93 if (m_bthread)
94 {
95 m_bthread->stop();
97 delete m_bthread;
98 m_bthread=nullptr;
99 }
100
101 //clear the controllers
102 for (auto it = m_robotControllers.begin(); it != m_robotControllers.end(); it++)
103 {
104 if (it->second)
105 {
106 delete it->second;
107 it->second = nullptr;
108 }
109 }
110 m_robotControllers.clear();
111
112 //clear the remappers
113 for (auto it = m_robotRemappers.begin(); it != m_robotRemappers.end(); it++)
114 {
115 if (it->second)
116 {
117 delete it->second;
118 it->second = nullptr;
119 }
120 }
121 m_robotRemappers.clear();
122
123 //clear the clients
124 for (auto it = m_robotClients.begin(); it != m_robotClients.end(); it++)
125 {
126 if (it->second)
127 {
128 delete it->second;
129 it->second = nullptr;
130 }
131 }
132 m_robotClients.clear();
133
134 //clear the storages
135 m_actions.clear();
136
137 yInfo() << "cleanup complete";
138 }
139
140 bool chooseActionByName(std::string id)
141 {
142 if (m_actions.find(id) == m_actions.end())
143 {
144 yError() << "action id not found";
145 return false;
146 }
148
149 action_class *action = &m_actions[id];
150 std::string controller_name = action->controller_name;
151 robotDriver *driver = m_robotControllers[controller_name];
152
153 if (!driver || !action)
154 {
155 yError() << "invalid driver/action pointer";
156 return false;
157 }
158 yInfo() << "action selected:" << id;
159 yDebug() << "action controller:" << controller_name;
160 yDebug() << "number of action frames:" << action->action_frames_vector.size();
161 return m_wthread->action_change(action, driver);
162 }
163
165 {
166 std::string ss = "actions:\n";
167 size_t i = 0;
168 for (auto it=m_actions.begin(); it!=m_actions.end();it++)
169 {
170 ss = ss + "(" + std::to_string(i++) + ") " + it->second.action_name + "\n";
171 }
172 return ss;
173 }
174
175 bool loadConfiguration(std::string filename, double resample_period)
176 {
178 if (!p.fromConfigFile(filename))
179 {
180 yError() << "Unable to read configuration file!";
181 return false;
182 }
183
184 //load the clients
185 yarp::os::Bottle& bot_clients = p.findGroup("CLIENTS");
186 if (bot_clients.size() == 0)
187 {
188 yError() << "Unable to read CLIENTS section";
189 return false;
190 }
191 size_t num_of_clients = bot_clients.size();
192 for (size_t i = 1; i < num_of_clients; i++)
193 {
194 yDebug() << bot_clients.get(i).toString();
195 yarp::os::Bottle* bot_client_elem = bot_clients.get(i).asList();
196 if (bot_client_elem == nullptr)
197 {
198 yError() << "Invalid entry in CLIENTS section";
199 return false;
200 }
201 size_t num_of_client_elems = bot_client_elem->size();
202 if (num_of_client_elems == 2)
203 {
204 //parse a line of the CLIENTS section
205 std::string client_name = bot_client_elem->get(0).toString();
206 std::string remoteControlBoards = bot_client_elem->get(1).toString();
207 if (m_robotClients[client_name] != nullptr)
208 {
209 yError() << "Duplicate client entry: " << client_name;
210 return false;
211 }
213 yarp::os::Property clientoptions;
214 clientoptions.put("device", "controlBoard_nwc_yarp");
215 clientoptions.put("remote", remoteControlBoards);
216 clientoptions.put("local", m_name + "/client/" + client_name);
217 clientoptions.put("carrier", "fast_tcp");
218
219 //configure the client
220 bool rob_ok = pd_client->open(clientoptions);
221 if (!rob_ok)
222 {
223 yError() << "Unable to initialize client: " << client_name;
224 delete pd_client;
225 return false;
226 }
227 m_robotClients[client_name] = pd_client;
228 }
229 else
230 {
231 yError() << "Invalid number of entries in CLIENTS section";
232 return false;
233 }
234 }
235
236 //load the remappers
237 yarp::os::Bottle& bot_cont = p.findGroup("REMAPPERS");
238 if (bot_cont.size() == 0)
239 {
240 yError() << "Unable to read REMAPPERS section";
241 return false;
242 }
243 size_t num_of_controllers = bot_cont.size();
244 for (size_t i = 1; i < num_of_controllers; i++)
245 {
246 yDebug() << bot_cont.get(i).toString();
247 yarp::os::Bottle* bot_cont_elem = bot_cont.get(i).asList();
248 if (bot_cont_elem == nullptr)
249 {
250 yError() << "Invalid entry in REMAPPERS section";
251 return false;
252 }
253 size_t num_of_celems = bot_cont_elem->size();
254 if (num_of_celems == 3)
255 {
256 //parse a line of the remappers section
257 std::string remapper_name = bot_cont_elem->get(0).toString();
258 yarp::os::Bottle* clients_name = bot_cont_elem->get(1).asList();
259 std::string axes_names = bot_cont_elem->get(2).toString();
260 if (clients_name==nullptr || clients_name->size() == 0)
261 {
262 yError() << "error in clients_name";
263 return false;
264 }
265 if (axes_names.empty())
266 {
267 yError() << "error in axes_names";
268 return false;
269 }
270
271 //configure the remapper
272 if (m_robotRemappers.count(remapper_name))
273 {
274 yError() << "Duplicate remapper entry: " << remapper_name;
275 return false;
276 }
278 yarp::os::Property rmoptions;
279 rmoptions.put("device", "controlboardremapper");
280 yarp::os::Value* jlist = yarp::os::Value::makeList(axes_names.c_str());
281 rmoptions.put("axesNames",jlist);
282 bool rob_ok = pd_remapper->open(rmoptions);
283 if (!rob_ok)
284 {
285 yError() << "Unable to initialize remapper: " << remapper_name;
286 delete pd_remapper;
287 return false;
288 }
289 m_robotRemappers[remapper_name] = pd_remapper;
290
291 //attach the remapper to one or more clients
292 {
293 yarp::dev::IMultipleWrapper* ww_rem=nullptr;
294 m_robotRemappers[remapper_name]->view(ww_rem);
296 for (size_t j=0; j<clients_name->size(); j++)
297 {
298 std::string cnn = clients_name->get(j).toString();
299 auto it = m_robotClients.find(cnn);
300 if (it == m_robotClients.end() || it->second == nullptr)
301 {
302 yError() << "Configuration error: client '" << cnn << "' not found or is invalid.";
303 return false;
304 }
305 yarp::dev::PolyDriver* ddnwc = it->second;
306 std::string boardname = "nwcboard" + std::to_string(j);
307 pdlist.push(ddnwc, boardname.c_str());
308 }
309 bool result_att = ww_rem->attachAll(pdlist);
310 if (!result_att)
311 {
312 yError() << "Configuration error while trying to attach the remapper: "
313 << remapper_name << " with the control_boards: " << clients_name->toString();
314 return false;
315 }
316 }
317
318 //put the controller in the list
319 if (m_robotControllers.count(remapper_name))
320 {
321 yError() << "Duplicate controller entry: " << remapper_name;
322 return false;
323 }
324 robotDriver* robDrv = new robotDriver;
325 rob_ok = robDrv->configure(m_robotRemappers[remapper_name]);
326 rob_ok &= robDrv->init();
327 if (!rob_ok)
328 {
329 yError() << "Unable to initialize controller: " << remapper_name;
330 delete robDrv;
331 return false;
332 }
333 m_robotControllers[remapper_name] = robDrv;
334 }
335 else
336 {
337 yError() << "Invalid number of entries in REMAPPERS section";
338 return false;
339 }
340 }
341
342 yarp::os::Bottle& bot_action = p.findGroup("ACTIONS");
343 if (bot_action.size() == 0)
344 {
345 yError() << "Unable to read ACTIONS section";
346 return false;
347 }
348 for (size_t i = 1; i < bot_action.size(); i++)
349 {
350 std::string str = bot_action.toString();
351 yDebug() << bot_action.get(i).toString();
352 yarp::os::Bottle* bot_act_elem = bot_action.get(i).asList();
353 if (bot_act_elem == nullptr)
354 {
355 yError() << "Invalid entry in ACTIONS section";
356 return false;
357 }
358 size_t num_of_aelems = bot_act_elem->size();
359 if (num_of_aelems==3 || num_of_aelems == 4)
360 {
361 //parse a line of the ACTIONS section
362 std::string action_name = bot_act_elem->get(0).toString();
363 std::string controller_name = bot_act_elem->get(1).toString();
364 std::string action_file_name = bot_act_elem->get(2).toString();
365 yarp::os::Bottle* tolerances_bot = bot_act_elem->get(3).asList();
366
367 //check if the controller name exists
368 if (m_robotControllers.find(controller_name) == m_robotControllers.end())
369 {
370 yError() << controller_name << "in action" << action_name << "does not exists";
371 return false;
372 }
373
374 //load the action file
375 action_class tmpAction;
376 tmpAction.action_name = action_name;
377 tmpAction.controller_name = controller_name;
378 size_t njoints = m_robotControllers[controller_name]->getNJoints();
379
380 if (!tmpAction.openFile(action_file_name, njoints, 0.010))
381 {
382 yError() << "Unable to parse file";
383 return false;
384 }
385 if (resample_period!=0.0)
386 {
387 tmpAction.interpolate_action_frames(resample_period);
388 }
389
390 tmpAction.m_tolerances.resize(njoints);
391 for (size_t i=0; i<njoints; i++)
392 {
393 tmpAction.m_tolerances[i] = 3.0; //deg
394 }
395 if (tolerances_bot)
396 {
397 if (tolerances_bot->size() != njoints)
398 {
399 yError() << "Invalid size of tolerances vector, should be"<<njoints << "got " << tolerances_bot->size();
400 return false;
401 }
402 for (size_t i=0; i<njoints; i++)
403 {
404 tmpAction.m_tolerances[i] = tolerances_bot->get(i).asFloat64();
405 }
406 }
407 yDebug() << "Tolerances for action:" << action_name << vectorToString(tmpAction.m_tolerances);
408
409 //put the action in the list
410 m_actions[action_name] = tmpAction;
411 }
412 else
413 {
414 yError() << "Invalid entry in ACTIONS section, size should be 3 or 4, got " <<num_of_aelems;
415 return false;
416 }
417 }
418
419 yInfo() << "configuration file successfully loaded";
420 return true;
421 }
422
424 {
425 yInfo();
426 yInfo() << "Command line:";
427 yInfo() << "yarpActionsPlayer --filename `name` [--name `module_name`] [--execute] [--period period_s] [--resample resample_period_s] [--pos_tolerance pos] [--pos_timeout pos] [--pos_strict_check enable] ";
428 yInfo();
429 yInfo() << "`name` : file containing the actions";
430 yInfo() << "`module_name` : prefix of the ports opened by the module (default: /yarpActionsPlayer)";
431 yInfo() << "`verbose` : if enabled, extra debug messages are shown.";
432 yInfo() << "`execute` : if enabled, the yarpActionsPlayer will send commands to the robot. Otherwise, only it will operate in simulation mode only";
433 yInfo() << "`pos_tolerance` : the tolerance (in degrees) that will be checked by the initial movement in position mode, before switching to positionDirect mode. Default: 2degrees";
434 yInfo() << "`pos_timeout` : the amount of time (in seconds) the robot will attempt to reach the target position within the specified position tolerance. Default: 2s";
435 yInfo() << "`pos_strict_check` : if set to true, the system will halt if home position is halted, otherwise it will continue after the timeout expires. Default: false";
436 yInfo() << "`period` : the period (in s) of the thread processing the commands. Default 0.010s";
437 yInfo() << "`resample`: all the loaded trajectory files are internally resampled at the specified period. Default: not enabled";
438 yInfo() << "`initial_move_time`: the duration (in seconds) of the initial homing position of the joints before starting the trajectory. Default: 4s";
439 yInfo();
440 }
441
443 {
444 std::string test_string = rf.toString();
445
446 // generic configuration
447 if (rf.check("name"))
448 m_name = std::string("/") + rf.find("name").asString().c_str();
449 else
450 m_name = "/yarpActionsPlayer";
451
452 // rpc port
453 m_rpcPort.open((m_name + "/rpc").c_str());
454 this->yarp().attachAsServer(m_rpcPort);
455
456 // get the configuration for parameter period
457 double period = 0.005;
458 if (rf.check("period") == true)
459 {
460 period = rf.find("period").asFloat64();
461 }
462
463 // Instantiate the thread
464 m_wthread = new ControlThread(m_name,period);
465
466 //set the configuration for parameter execute
467 if (rf.check("execute")==true)
468 {
469 yInfo() << "Enabling iPid->setReference() controller";
471 }
472 else
473 {
474 yInfo() << "Not using iPid->setReference() controller";
476 }
477
478 //set the configuration for parameter verbose
479 if (rf.check("verbose")==true)
480 {
481 yInfo() << "yarpActionPlayer running in verbose mode";
482 m_wthread->m_verbose = true;
483 }
484 else
485 {
486 yInfo() << "yarpActionPlayer running in non-verbose mode";
487 m_wthread->m_verbose = false;
488 }
489
490 //set the position tolerance
491 if (rf.check("help") == true)
492 {
493 print_help();
494 return false;
495 }
496
497 if (rf.check("initial_move_time") == true)
498 {
499 double imt = rf.find("initial_move_time").asFloat64();
501 }
502
503 //set the position tolerance
504 if (rf.check("pos_tolerance") == true)
505 {
506 double tol = rf.find("tolerance").asFloat64();
507 yInfo() << "Position tolerance set to " << tol << "degrees";
509 }
510
511 //set the position timeout
512 if (rf.check("pos_timeout") == true)
513 {
514 double timeout = rf.find("pos_timeout").asFloat64();
515 yInfo() << "Position timeout set to " << timeout << "seconds";
517 }
518
519 //set the position timeout
520 if (rf.check("pos_strict_check") == true)
521 {
522 bool enable = rf.find("pos_strict_check").asBool();
524 }
525
526 double resample_period = 0;
527 if (rf.check("resample") == true)
528 {
529 resample_period = rf.find("resample_period").asFloat64();
530 yInfo() << "Set resample period equal to:" << resample_period << "s";
531 }
532
533 //open the configuration file
534 if (rf.check("filename")==true)
535 {
536 if (rf.find("filename").isString())
537 {
538 std::string filename = rf.find("filename").asString();
539 bool b = loadConfiguration(filename, resample_period);
540 if (!b)
541 {
542 yError() << "Configuration error!";
543 return false;
544 }
545 }
546 else
547 {
548 yError() << "`filename` option syntax error.";
549 print_help();
550 return false;
551 }
552 }
553 else
554 {
555 yWarning() << "`filename` option not found. No sequence files loaded.";
556 }
557
558 //check if actions are valid
559 if (m_actions.empty())
560 {
561 yInfo() << "There are no actions!";
562 return false;
563 }
564
565 //select the first action
566 yInfo() << "automatically selecting the first action";
567 std::string first_action_name;
568 first_action_name = this->m_actions.begin()->first;
569 this->chooseActionByName(first_action_name);
570
571 //start the thread
572 if (!m_wthread->start())
573 {
574 yError() << "Working thread did not start, queue will not work";
575 }
576 else
577 {
578 yInfo() << "Working thread started";
579 }
580
581 yInfo() << "module successfully configured. ready.";
582 return true;
583 }
584
585 virtual bool close()
586 {
588 return true;
589 }
590
591 virtual double getPeriod() { return 1.0; }
592 virtual bool updateModule() { return true; }
593};
594
595//--------------------------------------------------------------------------
596int main(int argc, char *argv[])
597{
599 rf.setDefaultContext("yarpActionsPlayer");
600 rf.configure(argc,argv);
601
603
604 if (!yarp.checkNetwork())
605 {
606 yError() << "yarp.checkNetwork() failed.";
607 return -1;
608 }
609
610 scriptModule mod;
611
612 return mod.runModule(rf);
613}
614
616{
617 return this->m_wthread->action_start();
618}
619
621{
622 return this->m_wthread->action_stop();
623}
624
626{
627 return this->m_wthread->action_reset();
628}
629
631{
632 return this->m_wthread->action_forever();
633}
634
636{
637 return this->m_wthread->action_print();
638}
639
640bool scriptModule::speed_factor(const double value)
641{
642 return this->m_wthread->action_setSpeedFactor(value);
643}
644
645bool scriptModule::resample(const double value)
646{
647 return this->m_wthread->action_resample(value);
648}
649
650bool scriptModule::choose_action(const std::string& action_name)
651{
652 return this->chooseActionByName(action_name);
653}
654
655bool scriptModule::play_action(const std::string& action_name)
656{
657 bool b = this->chooseActionByName(action_name);
658 if (b)
659 {
660 bool b1 = this->m_wthread->action_start();
661 }
662 do { yarp::os::Time::delay(0.010); }
664 return true;
665}
666
668{
669 std::string actions_str = this->string_list_actions();
670 std::string current_action_name;
671 bool b = m_wthread->action_getname(current_action_name);
672 yInfo() << "current_action: " <<current_action_name;
673 yInfo() << actions_str;
674 return true;
675}
676
677bool scriptModule::set_thread_period(const double value)
678{
679 if (value > 0)
680 {
681 m_wthread->setPeriod(value);
682 yError("invalid period value");
683 }
684 else
685 {
686 yInfo("Period set to %f", value);
687 }
688 return true;
689}
690
692{
693 if (value > 0)
694 {
696 yError("invalid initial move time");
697 }
698 else
699 {
700 yInfo("Initial move time set to %f", value);
701 }
702 return true;
703}
#define yInfo(...)
Definition Log.h:319
#define yError(...)
Definition Log.h:361
#define yDebug(...)
Definition Log.h:275
#define yWarning(...)
Definition Log.h:340
contains the definition of a Vector type
bool action_getname(std::string &name)
void setPositionStrictCheck(bool enable)
bool m_enable_execute_joint_command
void setInitialMoveTime(double t)
action_status_enum getStatus()
bool action_resample(double value)
bool action_setSpeedFactor(double factor=1)
void setPositionTolerance(double tolerance)
bool action_change(action_class *action, robotDriver *driver)
void setPositionTimeout(double timeloops)
void interpolate_action_frames(double timestep)
std::string action_name
Definition robotAction.h:48
bool openFile(std::string filename, size_t njoints, double timestep=-1)
std::vector< double > m_tolerances
Definition robotAction.h:53
std::string controller_name
Definition robotAction.h:49
std::deque< action_frame > action_frames_vector
Definition robotAction.h:54
bool configure(yarp::dev::PolyDriver *pd)
bool reset() override
Rewinds the currently selected action.
Definition main.cpp:625
bool speed_factor(const double value) override
Sets the playback speed factor for the currently selected action (default value: 1....
Definition main.cpp:640
bool show_actions() override
Prints all the loaded actions.
Definition main.cpp:667
std::string string_list_actions()
Definition main.cpp:164
bool loadConfiguration(std::string filename, double resample_period)
Definition main.cpp:175
void print_help()
Definition main.cpp:423
std::map< std::string, action_class > m_actions
Definition main.cpp:43
virtual bool updateModule()
Override this to do whatever your module needs to do.
Definition main.cpp:592
BroadcastingThread * m_bthread
Definition main.cpp:45
bool resample(const double value) override
Resamples the currently selected action (in seconds, recommended value 0.010s).
Definition main.cpp:645
std::string m_name
Definition main.cpp:38
bool start() override
Start (or resumes, if stopped) the currently selected action.
Definition main.cpp:615
bool m_verbose
Definition main.cpp:39
bool choose_action(const std::string &action_name) override
Choose the current action and wait for further commands.
Definition main.cpp:650
bool forever() override
Similar to play, but it will automatically restart the playback when the last frame is reached.
Definition main.cpp:630
bool set_thread_period(const double value) override
Sets the period of the sampling thread (for advanced use only, default value: 0.010s).
Definition main.cpp:677
bool print_frames() override
Prints all the frames of the currently selected action.
Definition main.cpp:635
std::string m_current_action_id
Definition main.cpp:47
~scriptModule()
Definition main.cpp:82
virtual double getPeriod()
You can override this to control the approximate periodicity at which updateModule() is called by run...
Definition main.cpp:591
std::map< std::string, yarp::dev::PolyDriver * > m_robotClients
Definition main.cpp:40
yarp::os::Port m_rpcPort
Definition main.cpp:37
virtual bool configure(yarp::os::ResourceFinder &rf)
Configure the module, pass a ResourceFinder object to the module.
Definition main.cpp:442
bool stop() override
Stops the currently selected (running) action.
Definition main.cpp:620
bool play_action(const std::string &action_name) override
Play an action one single time.
Definition main.cpp:655
bool chooseActionByName(std::string id)
Definition main.cpp:140
virtual bool close()
Close function.
Definition main.cpp:585
std::map< std::string, yarp::dev::PolyDriver * > m_robotRemappers
Definition main.cpp:41
bool set_initial_move_time(const double value) override
Sets the uration for the initial homing movement (for advanced use only, default value: 2s).
Definition main.cpp:691
scriptModule()
Definition main.cpp:77
ControlThread * m_wthread
Definition main.cpp:44
std::string vectorToString(const std::vector< double > &vec)
Definition main.cpp:63
std::map< std::string, robotDriver * > m_robotControllers
Definition main.cpp:42
yarpActionsPlayer_IDL Interface.
Interface for an object that can wrap/attach to to another.
virtual bool attachAll(const PolyDriverList &drivers)=0
Attach to a list of objects.
void push(PolyDriver *p, const char *k)
A container for a device driver.
Definition PolyDriver.h:23
bool open(const std::string &txt)
Construct and configure a device by its common name.
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:65
size_type size() const
Gets the number of elements in the bottle.
Definition Bottle.cpp:257
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Definition Bottle.cpp:252
std::string toString() const override
Gives a human-readable textual representation of the bottle.
Definition Bottle.cpp:217
Utilities for manipulating the YARP network, including initialization and shutdown.
Definition Network.h:718
bool setPeriod(double period)
Set the (new) period of the thread.
bool start()
Call this to start the thread.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
A mini-server for network communication.
Definition Port.h:46
void close() override
Stop port activity.
Definition Port.cpp:330
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
Definition Port.cpp:79
A class for storing options and configuration information.
Definition Property.h:33
bool fromConfigFile(const std::string &fname, bool wipe=true)
Interprets a file as a list of properties.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
Definition Property.cpp:987
Bottle & findGroup(const std::string &key) const override
Gets a list corresponding to a given keyword.
A base-class for standard YARP modules that supports ResourceFinder.
Definition RFModule.h:20
virtual int runModule()
Calls updateModule() until that returns false.
Definition RFModule.cpp:323
Helper class for finding config files and other external resources.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
bool setDefaultContext(const std::string &contextName)
Sets the context for the current ResourceFinder object.
bool configure(int argc, char *argv[], bool skipFirstArgument=true)
Sets up the ResourceFinder.
std::string toString() const override
Return a standard text representation of the content of the object.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
A single value (typically within a Bottle).
Definition Value.h:44
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
Definition Value.cpp:228
virtual bool isString() const
Checks if value is a string.
Definition Value.cpp:156
static Value * makeList()
Create a list Value.
Definition Value.cpp:452
virtual bool asBool() const
Get boolean value.
Definition Value.cpp:192
virtual Bottle * asList() const
Get list value.
Definition Value.cpp:252
std::string toString() const override
Return a standard text representation of the content of the object.
Definition Value.cpp:368
virtual std::string asString() const
Get string value.
Definition Value.cpp:246
yarp::os::WireLink & yarp()
Get YARP state associated with this object.
Definition Wire.h:28
int main(int argc, char *argv[])
Definition main.cpp:596
void delay(double seconds)
Wait for a certain number of seconds.
Definition Time.cpp:111
The main, catch-all namespace for YARP.
Definition dirs.h:16
@ ACTION_IDLE
Definition robotAction.h:19