ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Dynamically reconfigure the inflation radius

asked 2019-03-17 19:32:59 -0500

cheesyboi gravatar image

Hi y'all, I've been dealing with this issue for a while now and I just can't quite seem to get anywhere with it. I'd like to dynamically reconfigure the robot's inflation radius without using the rqt_reconfigure gui. I'd like to be able to send the robot a message if it's velocity drops below a certain limit, and lower the inflation radius. I understand that this will also make the robot more likely to bump into objects, so this is just in case the robot gets trapped. I'm using ROS Indigo, Thanks for reading!!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-03-17 21:26:23 -0500

billy gravatar image

Node to help: http://wiki.ros.org/dynamic_reconfigure

There is a tutorial for how to do this as well: http://wiki.ros.org/dynamic_reconfigu...

This question and answer will help you a lot if you want to do it in C++. NOTE: the push_back use in the answer code creates issue but the rest of it is good. I used this as a start for my code below : https://answers.ros.org/question/1227...

You'll see move base has a service called "/move_base/set_parameters". That is the service call you'll substitute into code below.

And finally how I do it in C++ for raspicam node. I am using integers. You'll need to use floats or doubles for inflation radius.

#include <dynamic_reconfigure/DoubleParameter.h>
#include <dynamic_reconfigure/Reconfigure.h>
#include <dynamic_reconfigure/Config.h>

    dynamic_reconfigure::ReconfigureRequest srv_req;
    dynamic_reconfigure::ReconfigureResponse srv_resp; 
    dynamic_reconfigure::IntParameter integer_param;
    dynamic_reconfigure::Config conf;

    int cameraControl(int ss, int iso)
    {
      conf.ints.resize(2);
      ROS_INFO_STREAM("ROBOT-STATE: cameraControl: shutter_speed: " << ss << "\tISO : " << iso);
      integer_param.name = "shutter_speed";
      integer_param.value = ss;
      conf.ints.at(0) = integer_param;

      integer_param.name = "ISO";
      integer_param.value = iso;
      conf.ints.at(1) = integer_param;
      srv_req.config = conf;

      ros::service::call("/raspicam_node/set_parameters", srv_req, srv_resp);

      return 1;
    }
edit flag offensive delete link more

Question Tools

Stats

Asked: 2019-03-17 19:32:59 -0500

Seen: 442 times

Last updated: Mar 17 '19