Ask Your Question
0

Changing a variable inside a running node

asked 2018-05-24 18:23:01 -0500

inani47 gravatar image

updated 2018-05-24 20:40:10 -0500

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?

edit retag flag offensive close merge delete

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)

ahendrix gravatar imageahendrix ( 2018-05-24 20:33:06 -0500 )edit
inani47 gravatar imageinani47 ( 2018-05-24 20:39:32 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2018-05-24 21:16:24 -0500

ahendrix gravatar image

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/Und...

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/Tutoria...

edit flag offensive delete link more

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

inani47 gravatar imageinani47 ( 2018-05-24 21:26:53 -0500 )edit
1

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.

ahendrix gravatar imageahendrix ( 2018-05-24 21:43:29 -0500 )edit

@ahendrix will launching nodes with different namespaces also achieve this?

inani47 gravatar imageinani47 ( 2018-05-30 17:57:45 -0500 )edit

Yes; namespaces will typically do this too (unless the node uses absolute topic names, but that's unusual).

ahendrix gravatar imageahendrix ( 2018-05-30 18:05:58 -0500 )edit

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?

inani47 gravatar imageinani47 ( 2018-05-30 18:13:45 -0500 )edit
1

Yes; namespacing applies to services in the same way.

ahendrix gravatar imageahendrix ( 2018-05-30 18:20:44 -0500 )edit
0

answered 2018-05-24 20:51:04 -0500

do you means rqt_reconfigure

edit flag offensive delete link more

Comments

The variable is not a parameter, but can I make it one and then use this tool?

inani47 gravatar imageinani47 ( 2018-05-24 21:25:46 -0500 )edit

yes,try this dynamic_reconfigure tutorial and you can figure it out

pengjiawei gravatar imagepengjiawei ( 2018-05-24 21:33:06 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-05-24 18:23:01 -0500

Seen: 98 times

Last updated: May 24 '18