Move robot with keyboard

I’m excited to be here as a subscriber. I am in the ROS Basics in 5 days(C++) course and can’t seem to get the robot to move using the keyboard in example 2.1. That’s not much progress and I hope not to waste your time. Please help with hints. I can’t continue comfortably with failures in the past. I’m also not learned enough to debug this myself.

Hi @jcocovich, can you please provide more information, like which robot do you want to move using Keyboard? Do you have a local simulation setup or an actual Robot?

I’m following along the course. The introduction gives me the launch command to move the built-in gazebo model for that unit. I didn’t do or create anything. I’m using the Construct built in development environment. ROS Basics in 5 days(C++), Unit 2 ROS Basics, example 2.1 entering the following command in the terminal window
roslaunch turtlebot_teleop keyboard_teleop.launch
I get the instructions and the current speed and angular rotation are updated in the terminal output when I use the keyboard but the model in simulation window does not move. I tried other courses where a default is shown to move around with the keyboard but in none of them does the actual model in the simulation move.

Thanks @jcocovich. Can you please provide the terminal output where you run
roslaunch turtlebot_teleop keyboard_teleop.launch.
And also run “rostopic list” command in another terminal to list all the topics after running the above command. And attach this output also. That would be very helpful to debug the issue.

Terrific. I tried to save the window in some files. Don’t know how to do that. No matter. Don’t know how to attach pictures. Sorry to disturb everyone. I’ll have to figure it out on my own with no clues.

user:~$ rostopic list/camera/depth/camera_info
/camera/depth/image_raw
/camera/depth/points
/camera/parameter_descriptions
/camera/parameter_updates
/camera/rgb/camera_info
/camera/rgb/image_raw
/camera/rgb/image_raw/compressed
/camera/rgb/image_raw/compressed/parameter_descriptions
/camera/rgb/image_raw/compressed/parameter_updates
/camera/rgb/image_raw/compressedDepth
/camera/rgb/image_raw/compressedDepth/parameter_descriptions
/camera/rgb/image_raw/compressedDepth/parameter_updates
/camera/rgb/image_raw/theora
/camera/rgb/image_raw/theora/parameter_descriptions
/camera/rgb/image_raw/theora/parameter_updates
/clock
/cmd_vel
/gazebo/link_states
/gazebo/model_states
/gazebo/parameter_descriptions
/gazebo/parameter_updates
/gazebo/set_link_state
/gazebo/set_model_state
/joint_states
/kobuki/laser/scan
/odom
/rosout
/rosout_agg
/tf
/tf_static

user:~$ roslaunch turtlebot_teleop keyboard_teleop.launch
… logging to /home/user/.ros/log/256bf41c-457b-11ec-8a29-0242c0a89007/roslaunch-4_xterm-1196.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://4_xterm:41967/

SUMMARY

PARAMETERS

  • /rosdistro: noetic
  • /rosversion: 1.15.9
  • /turtlebot_teleop_keyboard/scale_angular: 1.5
  • /turtlebot_teleop_keyboard/scale_linear: 0.5

NODES
/
turtlebot_teleop_keyboard (turtlebot_teleop/turtlebot_teleop_key.py)

ROS_MASTER_URI=http://4_simulation:11311

process[turtlebot_teleop_keyboard-1]: started with pid [1204]

Control Your Turtlebot!

Moving around:
u i o
j k l
m , .

q/z : increase/decrease max speeds by 10%
w/x : increase/decrease only linear speed by 10%
e/c : increase/decrease only angular speed by 10%
space key, k : force stop
anything else : stop smoothly

CTRL-C to quit

currently: speed 0.2 turn 1

Basic Kinematics for Mobile Robots has an example that at least proves my piece of your environment works. It would appear there is a problem with the teleop package. I will move on and avoid any keyboard interactions which I hope is possible.

Now in other terminal run “rostopic echo /cmd_vel” (it will print the cmd_vel topic when published), and try to move robot forward (press i) using teleop keyboard. Keyboard teleop only works when you are on that terminal so first you have to go to the terminal where you launched the keyboard_teleop node.
After pressing i multiple times go back to second terminal see if anything comes there.

Actually, the topic is /part2_cmr/cmd_vel and defined to be a twist message. My total confusion came from reading the output of the teleop command at the bottom. w or q or e instead of i. I wasn’t paying attention. ROS stuff is easy to understand, the human written instructions take practice to discover the meaning. All seems to work fine now. Thanks.