19#include <QApplication>
41 yDebug(
"\nCAUGHT Ctrl-c\n");
48int main(
int argc,
char *argv[])
50#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
51 QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
57 if (!
yarp.checkNetwork())
59 LOG_ERROR(
"Error initializing yarp network (is yarpserver running?)\n");
60 QMessageBox::critical(
nullptr,
"Error",
"Error initializing yarp network (is yarpserver running?)");
69 finder.setDefaultConfigFile(
"yarpmotorgui.ini");
70 finder.configure(argc, argv);
74 std::vector<bool> enabled;
83 yInfo(
"yarpmotorgui options:");
84 yInfo(
"--robot <name>: name of the robot");
85 yInfo(
"--parts ""( <name1> <name2> )"": parts of the robot to add to the list. (e.g. left_arm)");
86 yInfo(
"--names ""( <name1> <name2> )"": full name of the ports of the robot to add to the list. (e.g. /icub/left_arm). This option is mutually exclusive with --robot --parts options");
87 yInfo(
"--skip_parts ""( <name1> <name2> )"": parts of the robot to skip.");
88 yInfo(
"--calib to enable calibration buttons (be careful!)");
89 yInfo(
"--remoteRobotDescriptionPort <portname>: port opened by the robotDescription_nws_yarp (yarprbotinterface). Default Value is /yarpRobotInterface/devices/rpc");
95 LOG(
"Calibrate buttons on\n");
101 LOG(
"Admin mode on.\n");
105 if (
finder.check(
"debug"))
107 LOG(
"Debug interface requested.\n");
110 if (
finder.check(
"speed"))
112 LOG(
"Speed view requested.\n");
117 if (
finder.check(
"remoteRobotDescriptionPort"))
122 if (
finder.check(
"skip_description_server")==
false)
126 std::string
descLocalName =
"/yarpmotorgui" + std::to_string(count) +
"/descriptionClient";
128 while (
adr.isValid())
131 descLocalName =
"/yarpmotorgui" + std::to_string(count) +
"/descriptionClient";
139 std::vector<DeviceDescription>
cbw2_list;
157 yDebug() << i.device_name;
158 yDebug() << i.device_configuration;
166 yError() <<
"Unable to get IRobotDescription interface? This is a bug";
173 yError() <<
"Unable to open robotDescription_nwc_yarp, robot parts will be set manually.";
179 yWarning() <<
"robotDescription_nws_yarp not found, robot parts will be set manually.";
183 std::string robotName =
finder.find(
"robot").asString();
189 if (robotName !=
"" &&
b_name !=
nullptr)
191 LOG_ERROR(
"You cannot use both --robot and --names options simultaneously\n");
192 QMessageBox::critical(
nullptr,
"Error",
"You cannot use both --robot and --names options simultaneously");
198 LOG_ERROR(
"You cannot use both --parts and --names options simultaneously\n");
199 QMessageBox::critical(
nullptr,
"Error",
"You cannot use both --parts and --names options simultaneously");
206 for (
size_t i = 0; i <
b_name->size(); i++)
211 else if (robotName !=
"" &&
b_part !=
nullptr)
214 for (
size_t i = 0; i <
b_part->size(); i++)
216 std::string
ss =
b_part->get(i).asString();
219 ss.insert(0,
"/" + robotName +
"/");
223 LOG_ERROR(
"Option --parts should not contain /, please remove it\n");
224 QMessageBox::critical(
nullptr,
"Error",
"Option --parts should not contain /, please remove it");
230 else if (robotName !=
"" &&
b_part ==
nullptr)
232 pParts.addString(
"/" + robotName +
"/head");
233 pParts.addString(
"/" + robotName +
"/torso");
234 pParts.addString(
"/" + robotName +
"/left_arm");
235 pParts.addString(
"/" + robotName +
"/right_arm");
236 pParts.addString(
"/" + robotName +
"/left_leg");
237 pParts.addString(
"/" + robotName +
"/right_leg");
242 pParts =
Bottle(
"/icub/head /icub/torso /icub/left_arm /icub/right_arm /icub/left_leg /icub/right_leg");
247 for(
size_t n = 0;
n <
pParts.size();
n++)
249 std::string part =
pParts.get(
n).asString();
257 yDebug(
"Appending %s", part.c_str());
266 if(
dlg.exec() == QDialog::Accepted)
268 enabled =
dlg.getEnabledParts();
272 yInfo(
"Cancel Button pressed. Closing..");
277 for(
int i = 0; i <
partsName.size(); i++)
299 return (
appRet != 0 ? 1 : 0);
define control board standard interfaces
void init(yarp::os::Property config)
Init the application with the current configuration.
This interface allows users to retrieve a list which contains the names and the types of the currentl...
A container for a device driver.
A simple collection of objects that can be described and transmitted in a portable way.
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
static bool exists(const std::string &port, bool quiet=true, bool checkVer=true)
Check for a port to be ready and responsive.
Utilities for manipulating the YARP network, including initialization and shutdown.
A class for storing options and configuration information.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
Helper class for finding config files and other external resources.
static ResourceFinder & getResourceFinderSingleton()
Access a ResourceFinder singleton whose lifetime will match that of the YARP library.
virtual std::string asString() const
Get string value.
int main(int argc, char *argv[])
bool speedview_param_enabled
static void sighandler(int sig)
std::vector< std::string > partsName
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.
The main, catch-all namespace for YARP.