auviitkgp / kraken_3.0

Source code of Team AUV, IIT Kharagpur
http://auviitkgp.github.io
BSD 3-Clause Clear License
39 stars 58 forks source link

Change all the parameters hard-coded across the repository to the ROS parameter server #84

Open icyflame opened 9 years ago

icyflame commented 9 years ago

The issue was first raised in this comment

References:

  1. Parameter Server
  2. rosparam

cc @auviitkgp/developers @auviitkgp/embedded-team @auviitkgp/maintainers

icyflame commented 8 years ago

Okay, I am moving this up in priority because this is way better than a lot of other approaches to do this. For example, we can remove a lot of the pub-sub stuff that we have created by simply creating a rosparam for it and then, getting that rosparam. One use-case may be for thrusters, where sending the data through nodes can be easily done instead as setting a rosparam, and this has the advantage that we can check if the parameter is null. For constants, and other things that are generally tuned, this is certainly the way to go. Further, it is a live server, so, you don't need to restart the node, setting the parameter anywhere will immediately affect all nodes using this. Also, implementing this (in both C++ and Python) is a breeze because of the easy API provided by ROS.

C++ example: thruster_converter module

Python example: PID Control module

Attn: @prudhvid @kalyan-kumar @ghostwriternr @nevinvalsaraj

cc @auviitkgp/developers

prudhvid commented 8 years ago

Fantastic this is THE WAY to go :)

On Sun, Dec 13, 2015 at 3:40 PM, Siddharth Kannan notifications@github.com wrote:

Okay, I am moving this up in priority because this is way better than a lot of other approaches to do this. For example, we can remove a lot of the pub-sub stuff that we have created by simply creating a rosparam for it and then, getting that rosparam. One use-case may be for thrusters, where sending the data through nodes can be easily done instead as setting a rosparam, and this has the advantage that we can check if the parameter is null. For constants, and other things that are generally tuned, this is certainly the way to go. Further, it is a live server, so, you don't need to restart the node, setting the parameter anywhere will immediately affect all nodes using this. Also, implementing this (in both C++ and Python) is a breeze because of the easy API provided by ROS.

C++ example: thruster_converter module https://github.com/auviitkgp/kraken_3.0/blob/indigo-devel/control_system_stack/thruster_converter/src/thruster.cpp#L120-L131

Python example: PID Control module https://github.com/auviitkgp/kraken_3.0/blob/indigo-devel/sensor_stack/seabotix/src/pidControl.py#L119-L122

Attn: @prudhvid https://github.com/prudhvid @kalyan-kumar https://github.com/kalyan-kumar @ghostwriternr https://github.com/ghostwriternr @nevinvalsaraj https://github.com/nevinvalsaraj

cc @auviitkgp/developers https://github.com/orgs/auviitkgp/teams/developers

— Reply to this email directly or view it on GitHub https://github.com/auviitkgp/kraken_3.0/issues/84#issuecomment-164244124 .

Prudhvi Dharmana

B.Tech 4th year Dept. of Computer Science & Engineering IIT Kharagpur.

pranaypratyush commented 8 years ago

Why is "/ros_rate" parameter 'string' instead of 'int' ? I mean do we really need float for this ? Even then we can declare a parameter with type 'double'. And where are we creating this parameter (in some '.launch' file) ?

icyflame commented 8 years ago

@pranaypratyush Where is the option to declare this as float? I used the default commands, and it turned out to be string. Wasn't that big a deal, so I left it. Both Python and C++ can easily convert.

Of course, if there is a data type field, then we should use integer for ROS_RATE

pranaypratyush commented 8 years ago

Yes we can declare the parameters as integers (32 bit actually). But this still doesn't answer my question as to where is the parameter declared ?

icyflame commented 8 years ago

Check the first two links. The values are stored and fetched from the parameter server. I just missed the parameter type section in the first doc

I will assign a new issue to you. You must change all the present occurrences of ROS Rate to the integer and also create the required YAML file.

pranaypratyush commented 8 years ago

Peace. Do it.

icyflame commented 8 years ago

Done. Check #98. I think one week is enough to get this done?