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");
90 yInfo(
"--reduce_bandwidth: attempts to reduce network bandwidth usage by throttling streaming communication with the robot");
91 yInfo(
"--rcb_protocol <carrier>: the yarp network protocol to connect with the ports opened by the robot (e.g. tcp, udp). Portmonitors can be included too.");
97 LOG(
"Calibrate buttons on\n");
101 if (
finder.check(
"admin"))
103 LOG(
"Admin mode on.\n");
107 if (
finder.check(
"debug"))
109 LOG(
"Debug interface requested.\n");
112 if (
finder.check(
"speed"))
114 LOG(
"Speed view requested.\n");
120 if (
finder.check(
"rcb_protocol")) {
123 if (
finder.check(
"reduce_bandwidth")) {
126 rcb_protocol =
"fast_tcp+send.portmonitor+type.dll+file.throttleDown+period_ms.100";
130 if (
finder.check(
"remoteRobotDescriptionPort"))
135 if (
finder.check(
"skip_description_server")==
false)
139 std::string
descLocalName =
"/yarpmotorgui" + std::to_string(count) +
"/descriptionClient";
141 while (
adr.isValid())
144 descLocalName =
"/yarpmotorgui" + std::to_string(count) +
"/descriptionClient";
152 std::vector<DeviceDescription>
cbw2_list;
170 yDebug() << i.device_name;
171 yDebug() << i.device_configuration;
179 yError() <<
"Unable to get IRobotDescription interface? This is a bug";
186 yError() <<
"Unable to open robotDescription_nwc_yarp, robot parts will be set manually.";
192 yWarning() <<
"robotDescription_nws_yarp not found, robot parts will be set manually.";
204 LOG_ERROR(
"You cannot use both --robot and --names options simultaneously\n");
205 QMessageBox::critical(
nullptr,
"Error",
"You cannot use both --robot and --names options simultaneously");
211 LOG_ERROR(
"You cannot use both --parts and --names options simultaneously\n");
212 QMessageBox::critical(
nullptr,
"Error",
"You cannot use both --parts and --names options simultaneously");
219 for (
size_t i = 0; i <
b_name->size(); i++)
227 for (
size_t i = 0; i <
b_part->size(); i++)
229 std::string
ss =
b_part->get(i).asString();
236 LOG_ERROR(
"Option --parts should not contain /, please remove it\n");
237 QMessageBox::critical(
nullptr,
"Error",
"Option --parts should not contain /, please remove it");
255 pParts =
Bottle(
"/icub/head /icub/torso /icub/left_arm /icub/right_arm /icub/left_leg /icub/right_leg");
260 for(
size_t n = 0;
n <
pParts.size();
n++)
262 std::string part =
pParts.get(
n).asString();
270 yDebug(
"Appending %s", part.c_str());
279 if(
dlg.exec() == QDialog::Accepted)
281 enabled =
dlg.getEnabledParts();
285 yInfo(
"Cancel Button pressed. Closing..");
290 for(
int i = 0; i <
partsName.size(); i++)
312 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.