@@ -23,15 +23,15 @@ namespace mep3_controllers
2323 if (goal->max_velocity != 0 )
2424 max_velocity = goal->max_velocity ;
2525
26- double tolerance = 99999 ;
26+ double tolerance = std::numeric_limits< double >:: max () ;
2727 if (goal->tolerance != 0 )
2828 tolerance = goal->tolerance ;
2929
30- double timeout = 99999 ;
30+ double timeout = std::numeric_limits< double >:: max () ;
3131 if (goal->timeout != 0 )
3232 timeout = goal->timeout ;
3333
34- double max_effort = 99999 ;
34+ double max_effort = std::numeric_limits< double >:: max () ;
3535 if (goal->max_effort != 0 )
3636 max_effort = goal->max_effort ;
3737
@@ -157,7 +157,7 @@ namespace mep3_controllers
157157 joint->active = false ;
158158 RCLCPP_ERROR (get_node ()->get_logger (), " Joint %s timeout" , joint->name .c_str ());
159159 }
160- else if (joint->effort_handle ->get ().get_value () > joint->max_effort )
160+ else if (std::isinf (joint-> effort_handle -> get (). get_value ()) || joint->effort_handle ->get ().get_value () > joint->max_effort )
161161 {
162162 result->set__result (mep3_msgs::action::JointPositionCommand::Goal::RESULT_OVERLOAD);
163163 joint->action_server ->terminate_current (result);
@@ -193,7 +193,7 @@ namespace mep3_controllers
193193 });
194194 if (position_command_handle == command_interfaces_.end ())
195195 {
196- RCLCPP_ERROR (get_node ()->get_logger (), " Unable to obtain joint command handle for %s" , joint->name .c_str ());
196+ RCLCPP_ERROR (get_node ()->get_logger (), " Unable to obtain joint position command handle for %s" , joint->name .c_str ());
197197 return controller_interface::CallbackReturn::FAILURE;
198198 }
199199 joint->position_command_handle = std::ref (*position_command_handle);
@@ -208,7 +208,7 @@ namespace mep3_controllers
208208 });
209209 if (velocity_command_handle == command_interfaces_.end ())
210210 {
211- RCLCPP_ERROR (get_node ()->get_logger (), " Unable to obtain joint command handle for %s" , joint->name .c_str ());
211+ RCLCPP_ERROR (get_node ()->get_logger (), " Unable to obtain joint velocity command handle for %s" , joint->name .c_str ());
212212 return controller_interface::CallbackReturn::FAILURE;
213213 }
214214 joint->velocity_command_handle = std::ref (*velocity_command_handle);
@@ -223,7 +223,7 @@ namespace mep3_controllers
223223 });
224224 if (position_handle == state_interfaces_.end ())
225225 {
226- RCLCPP_ERROR (get_node ()->get_logger (), " Unable to obtain joint state handle for %s" , joint->name .c_str ());
226+ RCLCPP_ERROR (get_node ()->get_logger (), " Unable to obtain joint position state handle for %s" , joint->name .c_str ());
227227 return controller_interface::CallbackReturn::FAILURE;
228228 }
229229 joint->position_handle = std::ref (*position_handle);
@@ -238,10 +238,11 @@ namespace mep3_controllers
238238 });
239239 if (effort_handle == state_interfaces_.end ())
240240 {
241- RCLCPP_ERROR (get_node ()->get_logger (), " Unable to obtain joint state handle for %s" , joint->name .c_str ());
241+ RCLCPP_ERROR (get_node ()->get_logger (), " Unable to obtain joint effort state handle for %s" , joint->name .c_str ());
242242 return controller_interface::CallbackReturn::FAILURE;
243243 }
244244 joint->effort_handle = std::ref (*effort_handle);
245+
245246 }
246247 return controller_interface::CallbackReturn::SUCCESS;
247248 }
0 commit comments