Changing a variable inside a running node
I'm trying to change a variable that sets the speed of a robot after it has been initialized with a specific value, say 0.5. After some time passes, I require to change the value to, say 1. How can I accomplish this?
Asked by inani47 on 2018-05-24 18:23:01 UTC
Answers
do you means rqt_reconfigure
Asked by pengjiawei on 2018-05-24 20:51:04 UTC
Comments
The variable is not a parameter, but can I make it one and then use this tool?
Asked by inani47 on 2018-05-24 21:25:46 UTC
yes,try this dynamic_reconfigure tutorial and you can figure it out
Asked by pengjiawei on 2018-05-24 21:33:06 UTC
Most robots use topics for sending periodic or continuous commands to motors and actuators.
The tutorial gives a good overview of topics: http://wiki.ros.org/ROS/Tutorials/UnderstandingTopics
And this turtlesim tutorial gives a more in-depth look at how to use topics to control a robot (or simulator): http://wiki.ros.org/turtlesim/Tutorials/Go%20to%20Goal
Asked by ahendrix on 2018-05-24 21:16:24 UTC
Comments
I considered this.. But I have the same node running with two different names.. And i need to change the variable for each node differently
Asked by inani47 on 2018-05-24 21:26:53 UTC
If you have two copies of the same node running, I suggest you remap the service or topic names used by each copy of that node so that each copy of the node has it's own service and topic names.
Asked by ahendrix on 2018-05-24 21:43:29 UTC
@ahendrix will launching nodes with different namespaces also achieve this?
Asked by inani47 on 2018-05-30 17:57:45 UTC
Yes; namespaces will typically do this too (unless the node uses absolute topic names, but that's unusual).
Asked by ahendrix on 2018-05-30 18:05:58 UTC
By the way, I was able to implement this using a service, I just felt it was a cleaner way to do things. Just personal preference. So I guess what I was really asking is will there be two sets of services created if I launch with different namespaces?
Asked by inani47 on 2018-05-30 18:13:45 UTC
Yes; namespacing applies to services in the same way.
Asked by ahendrix on 2018-05-30 18:20:44 UTC
Comments
This sounds a bit like an XY Problem. Can you rephrase what you want to do without describing how you want to do it (ie, without describing it in terms of a service)
Asked by ahendrix on 2018-05-24 20:33:06 UTC
@ahendrix done
Asked by inani47 on 2018-05-24 20:39:32 UTC