Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change node execution order in bringup launch file
To fix issues in #30 launch the encoder scrip on the microcontroller before launching the hardware interface control loop. This will make sure to send actual tick values from the encoders to the hardware interface before the control loop is running.
- Loading branch information
cb5ce1c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I think I read of launch files, that the order doesn't matter so much, they are all basically started at once?
roslaunch launches local processes using popen and kills them using POSIX signals. roslaunch does not guarantee any particular order to the startup of nodes -- although this is a frequently requested feature, it is not one that has any particular meaning in the ROS architecture as there is no way to tell when a node is initialized.
http://wiki.ros.org/roslaunch/Architecture#Local_processes
cb5ce1c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's a good point. At first I thought it would help to place the launch of the encoder and motor nodes before the hw interface node but as you noted this doesn't seem to matter. Although I noticed that the rosserial node started slightly earlier, it's not enough to fix the issue.
To take care of the launch order, I will try to use
ros::Subscriber::getNumPublishers( )
inside the hardware interface. So before starting to loop (read()
,update()
,write()
) inside the hardware interface, we can use its subscriber to wait for the encoder tick messages being published. So far I couldn't find a better approach for the launch order.cb5ce1c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, you can't control the order that the nodes start in the launch file.