Evaluating ROS param in Launch file
Hello All,
I am writing a program for controlling a robot. The robot has to make different motions based on the information of where it is. For accomplishing this, I have written different number of nodes inside the same launch file. For example, let us say that there are two locations the robot moves, for this I have two nodes in the same launch file. The robot has to achieve the goal in sequential order. That is once it reaches first goal, the information is required to be given to second node and the same sort of motion will happen with different node name and different goal point.
For transferring the information between nodes, I tried to set a boolean as rosparam and wanted to evaluate the param in launch file before running the second node. The problem is evaluating the parameter in the launch file, I tried to evaluate the param similar to args, it didnt work. And I am not sure if we can use args similar to params to set them inside function (similar to rospy.get_param()/ rospy.set_param()). I know that the args can be passed to the node, but not sure how to return them to launch file for further evaluation.
I hope I have not made my statements complicated, if so my apologies.
Thank you, Venkatachalam
Welcome! What exactly is your question? It's a little hard to pick it out of all the text. Also, please post any relevant code (such as the launch files that you're referring to).
Wouldn't simple publisher/subscriber work for this?
If you want for some reason to evaluate ros parameters (e.g. if some certain parameter is set, run different node etc.) you can do that in
bash
script. I can provide you with some code, but right now I'm little confused what your real question is.<launch> <arg name="forwardComplete" default="false"/> <node pkg="robo type=" motion.py"="" name="forward_exec"> </node> <group if="$(eval forward_complete == 'true')"> <node pkg="robo" type="motion.py" name="reverse_exec"> </group> </launch>
@jayess I have pasted the sample launch file. The idea is there are two nodes calling the same function, one to move the robot in forward direction and another to move in reverse direction. Goal (param) is changing. Once forward is complete, it has to be detected in other node and reverse starts.
@l4ncelot Yes, I need to evaluate parameters in launch file as I dont want two nodes to start at same time. One node moves robot forward and another reverse. Both calls the same function with different goals. They have to be sequential, so I am looking for a communication mechanism between nodes.
@l4ncelot Publisher subscriber may work, but I am looking to control starting the node from launch file based on some evaluation. I am not sure, if I can use publisher/subscriber in launch file.