ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Publish on /My_robot/cmd_vel using teleop

asked 2016-10-20 09:57:30 -0500

FAIZ gravatar image

Hello everyone, I am using the teleop package from the below link to publish on cmd_vel. Where do I have to make changes in the teleop cpp file in src if I want to publish on /My_robot/cmd_vel.

https://github.com/ros-teleop/teleop_...

Thanks.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-10-21 08:46:51 -0500

etappan gravatar image

In response to your comment here, running multiple robots off of multiple joysticks is a different issue entirely, but luckily something you can do without source changes. (Note that the group namespace is the same as apply the same namespace to each node in the group, or remapping each topic and parameter to "ns/<topic>". If you have a launchfile that works for one joy instance, you can also <include> that file in each group instead.

  <group ns="js0">
      <node name="joy" pkg="joy" type="joy_node" output="screen">
        <param name="dev" value="/dev/input/js0"/>
      </node>

      <node name="$(anon teleop_twist_joy)" pkg="teleop_twist_joy" type="teleop_node">
        <rosparam command="load" file="$(find locus_joy)/config/joy.yaml"/>
      </node>
  </group>

  <group ns="js1">
      <node name="joy" pkg="joy" type="joy_node" output="screen">
        <param name="dev" value="/dev/input/js1"/>
      </node>

      <node name="$(anon teleop_twist_joy)" pkg="teleop_twist_joy" type="teleop_node">
        <rosparam command="load" file="$(find locus_joy)/config/joy.yaml"/>
      </node>
  </group>

If you wanted to run multiple robots off of a single joystick, you could stickto one joy node, but launch multiple teleop_twist_joy nodes with complimentary configurations and different cmd_vel remaps.

edit flag offensive delete link more

Comments

Thank you for the reply, I am new to ROS. Can you please tell me where do I add this code ?

FAIZ gravatar image FAIZ  ( 2016-10-23 09:31:57 -0500 )edit

Both slorentz and I have posted snippets of launch files (notably missing an enclosing <launch> tag). You should look at the ROS tutorials if you haven't already. Roslaunch shows up in tutorial 8.

etappan gravatar image etappan  ( 2016-10-24 10:19:21 -0500 )edit
0

answered 2016-10-20 10:26:43 -0500

sloretz gravatar image

Strictly answering your question, you could edit this line here

However, ROS topics can be renamed without making code changes

<node pkg="teleop_twist_joy" name="teleop_twist_joy" type="teleop_node">
    <rosparam command="load" file="$(find teleop_twist_joy)/config/$(arg joy_config).config.yaml" />
    <remap from="cmd_vel" to="My_robot/cmd_vel"/>        
</node>
edit flag offensive delete link more

Comments

1

Or on the command line: rosrun teleop_twist_joy teleop_twist_joy cmd_vel:=/MyRobot/cmd_vel. ROS wiki/Remapping Arguments

etappan gravatar image etappan  ( 2016-10-20 15:21:05 -0500 )edit

Thanks for the reply, but I have more than two robots such that I want to publish on My_Robot1/cmd_vel with js0, on My_Robot1/cmd_vel with js1 and so on...

FAIZ gravatar image FAIZ  ( 2016-10-20 22:49:26 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-10-20 09:57:30 -0500

Seen: 2,318 times

Last updated: Oct 21 '16