Multi-switch switch for topic_tools mux topic
Http://wiki.ros.org/topic_tools/mux
Catalogue
1.mux
1.mux Usage
2.Associated MUX Tools (Mux_select, Mux_add, Mux_delete)
2.ROS API
1.mux
The MUX node subscribes to a series of input topics and forwards one of the topics to another topic, for example, it is a multi-switch, switching between 1 and N inputs. Provide services such as switching between topics, adding or deleting input topics. At startup, select the first input topic in the command line.
Parameters
~lazy (bool, default:false)
If true, the input topic is not subscribed unless there is at least one subscriber to the output topic.
How to use Mux
MUX < output topics > < input topic 1> [Enter Topic 2 ...] [Standard Ros parameters]
Subscribe < Enter topic 1> ..... N and publish the currently selected topic to the output topic. The MUX will start with the selected < input topic 1>.
outtopic: Published output topic
INTOPICN: Enter topic N, subscribe to the input topic. Multiplexing two command streams (Auto_cmdvel and Joystick_cmdvel) for one (Sel_cmdvel):
Rosrun topic_tools mux sel_cmdvel auto_cmdvel joystick_cmdvel mux:=mux_cmdvel
Important: To avoid conflicts with other MUX instances, use Mux:=foo at the command line to map the MUX nodes to some descriptive names. * * The associated MUX tool (Mux_select, Mux_add, mux_delete) * * For ease of use, Topic_tools provides a command-line tool to interact with the MUX.
Assuming that the MUX name is Mux_name (re-mapping Mux:=mux_name at startup), you can use: Mux_select mux_name ' <topic> ' to select output from ' <topic> '. Mux_add mux_name ' <topic> ' Add a new input ' <topic>. ' Mux_delete mux_name ' <topic> ': delete input ' &L
T;topic>. ' Switch_mux ' <outtopic> <intopic> ' DEPRECATED since ROS 0.11: use Mux_select instead. Set Topic Sel_cmdvel Switch between Auto_cmdvel and joystick_cmdvel topics, then use Mux_select to select Joystick_cmdvel:rosrun topic_tools mux sel_ Cmdvel auto_cmdvel joystick_cmdvel mux:=mux_cmdvel & rosrun topic_tools mux_select mux_cmdvel joystick_cmdvel Note: You can make Replace with Rosservice: Rosservice call Mux_cmdvel/select joystick_cmdvel **ros API Subscription node * * <intopicN> (Any/any) mux The input message (specified by the command line) of the nth input topic of the subscription (specified at the command line, or via Mux/add Add service) <outtopic> (Any/any) selected (designated by the Shell) mux/selected (new in ROS 0.11) (std_msgs/string) which topic is currently selected, or __none.
Services
Mux/select (New in ROS 0.11) (topic_tools/muxselect)
Select an input topic output, or __none to turn off output
mux/add (New in 0.11) (topic_ Tools/muxadd)
Add a new input topic
mux/delete (New in ROS 0.11) (topic_tools/muxdelete)
Delete an input topic
< Outtopic>_select (DEPRECATED since ROS 0.11) (topic_tools/muxselect)
Select an input topic to output, or __none to turn off the output.
Author:wsh
Email:tongzhuodenilove@163.com