PR2 / pr2_mechanism

Infrastructure to control the PR2 robot in a hard realtime control loop.
Other
29 stars 27 forks source link

Suspicious use of ros::Ok() #328

Open ledvinap opened 9 years ago

ledvinap commented 9 years ago

https://github.com/PR2/pr2_mechanism/blob/hydro-devel/pr2_controller_manager/src/controller_manager.cpp#L228 and later

this idiom is used:

  while (ros::ok() && free_controllers_list == used_by_realtime_){
    if (!ros::ok())
      return false;
    usleep(200);
  }

IMO this does not make sense - the ros:ok() test should be done after the while loop, not inside

Also at https://github.com/PR2/pr2_mechanism/blob/hydro-devel/pr2_controller_manager/src/controller_manager.cpp#L345 pub_mech_stats_ is locked, but unlock may be skipped by if (!ros::ok()) return false; (but that is probably OK)