Skip to content

Commit

Permalink
don't start/stop rc_dynamics for imu stream
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed Aug 31, 2017
1 parent 8594afb commit b74fe9e
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions tools/rcdynamics_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,21 @@ int main(int argc, char *argv[])
cout << "connecting rc_visard " << ip_str << "..." << endl;
auto dyn = RemoteInterface::create(ip_str);

try
/* For all streams except 'imu' the rc_dynamcis node has to be started */
if (type_str != "imu")
{
// start the rc::dynamics module on the rc_visard
cout << "starting rc_dynamics module on rc_visard..." << endl;
dyn->start();
}
catch (exception &e)
{
cout << "ERROR! Could not start rc_dynamics module on rc_visard: "
<< e.what() << endl;
return EXIT_FAILURE;
try
{
// start the rc::dynamics module on the rc_visard
cout << "starting rc_dynamics module on rc_visard..." << endl;
dyn->start();
}
catch (exception &e)
{
cout << "ERROR! Could not start rc_dynamics module on rc_visard: "
<< e.what() << endl;
return EXIT_FAILURE;
}
}

/**
Expand Down Expand Up @@ -326,16 +330,19 @@ int main(int argc, char *argv[])

/**
* Stopping streaming and clean-up
* 'imu' stream works regardless if the rc_dynamics module is running, so no need to stop it
*/
try
{
cout << "stopping rc_dynamics module on rc_visard..." << endl;
dyn->stop();

}
catch (exception &e)
if (type_str != "imu")
{
cout << "Caught exception: " << e.what() << endl;
try
{
cout << "stopping rc_dynamics module on rc_visard..." << endl;
dyn->stop();
}
catch (exception &e)
{
cout << "Caught exception: " << e.what() << endl;
}
}

if (outputFile.is_open())
Expand Down

0 comments on commit b74fe9e

Please sign in to comment.