Control your robot with a joystick in ROS

In other tutorials, I showed how to get access to the joystick and how to code with that. In this tutorial, I’m going to show you how to do that without writing any line of code.

First, install the required packages:

Now call the following

 

This will publish the topic “/joy_node” which is a type of “sensor_msgs/Joy

Now you need to create your favorite message from that, for instance, if you want to move your robot you need to create “Twist” and publish that over /cmd_vel. To do that, create a yaml file and call it “joystick_param.yaml”, then put the following in the file and save it:

 

 

 

 

Now load it to ROS param:

Then you can call joy_teleop.py, so it will check the values that you set into teleop and publish 

/chatter and /cmd_vel

Alternatively, you can just call the following which will do lines above at once:

 

read more:

joy, joy_teleop, teleop_twist_joy, teleop_example

0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Wone
Wone
6 years ago

I copied the joystick_param.yaml file, now where do I put it? When I type in
rosparam load joystick_param.yaml, I get this error:ERROR: file [joystick_param.yaml] does not exist

sergio bravo
sergio bravo
5 years ago

it works!

3
0
Would love your thoughts, please comment.x
()
x