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

rosmake my own teleop package and launch keyboard teleoperation -- no response

asked 2013-08-16 01:14:13 -0500

kevinma gravatar image

updated 2013-11-18 19:12:47 -0500

tfoote gravatar image

Hi,

It's my first time to use rosmake to build a new package. I met a problem and hope someone could help me:

Basically I followed the tutorial: h t t p://www.youtube.com/playlist?list=PLDC89965A56E6A8D6 (for turtlebot 1, making a package is in part 3). I just want to use the original turtlebot_key.cpp (no modified) to build my own package and compile and run a keyboard teleoperation

Here are the steps I followed (on workstation, using turtlebot 2):

  1. Create my own package "mytele":

    roscreate-pkg mytele geometry_msgs rospy roscpp
  2. Add this line to the end of ~/.bashrc to let ROS know my new package:

    export ROS_PACKAGE_PATH=~/mytele:${ROS_PACKAGE_PATH}
  3. Check if mytele can be recognized:

    rospack find mytele
  4. Compile the package (no source file yet):

    rosmake mytele mytele
  5. Copy turtlebot_key.cpp to the src folder
  6. At the end of CMakeLists.txt, add:

    rosbuild_add_executable(mytele_keyboard src/turtlebot_key.cpp)
  7. Compile the package again (the binary file "mytele_keyboard" is generated):

    rosmake mytele mytele
  8. Create a launch file "mytele_keyboard.launch" and add the following lines to execute the node:

    < launch>
    <node pkg=“mytele” type=“mytele_keyboard” name=“mytele_keyboard” output=“screen”>
    </node>
    </launch>
  9. Launch the launch file:

    roslaunch mytele mytele_keyboard.launch

With the turtlebot bringup having been initialized, I launched mytele and got no error message:

... logging to /home/kevinma/.ros/log/918f92d0-0555-11e3-8d5f-2cd05a67dbef/roslaunch-kevinma-TAICHI31-3963.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server h t t p://192.168.15.48:51907/

SUMMARY
========

PARAMETERS
* /rosdistro
* /rosversion

NODES
/
mytele_keyboard (mytele/mytele_keyboard)

ROS_MASTER_URI=h t t p://192.168.15.68:11311

core service [/rosout] found
process[mytele_keyboard-1]: started with pid [3972]
Reading from keyboard
---------------------------
Use arrow keys to move the turtlebot.

However, there was no response no matter what key I pressed (arrow or "i" or "j"). I tried to use

rostopic echo /mobile_base/commands/velocity

to look at the command and it seemed that no commands were send out.

Nevertheless, I tried to use the original teleop

roslaunch turtlebot_teleop keyboard_teleop.launch

and the turtlebot moved as expected and I could also see the velocity command changing.

I noticed that the original turtlebot_teleop is written in Python and mytele is built from the .cpp file, because the keys for operating the turtlebot are different, but I expect the c++ version should work too. In the tutorial video the turtlebot 1 in gazebo works well.

Are the steps I followed for turtlebot 1 only? Did I miss something when building the package? I am a beginner in compiling a ROS package. Please help and I would appreciate it.

Kevin Ma

edit retag flag offensive close merge delete

Comments

1

Run `rqt_graph` (groovy) or `rxgraph` (fuerte) and `roswtf` and check if everything is connected correct.

felix k gravatar image felix k  ( 2013-08-16 03:25:21 -0500 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2013-08-18 14:46:37 -0500

jorge gravatar image

You must remap the mytele_keyboard/cmd_vel topic to the cmd_vel_mux/input/teleop, same way keyboard_teleop.launch does. Change your launch file to something like:

<launch>
  <node pkg=“mytele” type=“mytele_keyboard” name=“mytele_keyboard” output=“screen”>
    <remap from="mytele_keyboard/cmd_vel" to="cmd_vel_mux/input/teleop"/>
  </node>
</launch>

If it doesn't work, your teleop cmd_vel topic name must be something different, so type

rostopic list -v | grep Twist

to list all velocity command topics and change the remap accordingly.

edit flag offensive delete link more

Comments

Although the question was asked a couple of months ago, I had a chance to look at it again recently. With better understanding of ROS this time, I redo the procedure using catkin. With the help of 'rosrun rqt_graph rqt_graph', I found the problem mainly exists in remapping. Now I can successfully catkin_make my c++ file and teleop my turtlebot, with remap from = "cmd_vel". Nevertheless, if I use remap from = "mytele_node/cmd_vel", it does not successfully remap to "cmd_vel_mux/input/teleop" and the teleop node does not actually publish on the correct topic. I don't really know the cause of the difference since the official turtlebot teleop works fine with the keyboard_teleop.launch in which "remap from = turtlebot_teleop_keyboard/cmd_vel" is used. Maybe it is because Python is employed instead of C++ in this case.

kevinma gravatar image kevinma  ( 2013-10-21 21:31:19 -0500 )edit

well... you must be careful with namespaces; thanks to rqt_graph you can easily check to what your are remapping your mytele_keyboard/cmd_vel topic and why it doesn't plug to cmd_vel_mux/input/teleop

jorge gravatar image jorge  ( 2013-10-22 14:46:42 -0500 )edit
0

answered 2013-08-18 16:45:09 -0500

lifelonglearner gravatar image

updated 2013-08-18 16:53:17 -0500

I hope you followed the steps to create the rosbuild work-space as your package can be find by the following command properly.

rospack find mytele

what I found missing in the steps you explained is the following command which is needed after using rosmake command

source devel/setup.bash

this can be performed alternatively by adding a line to .bashrc file.

The critical point is that every time we use the rosmake command and make some changes or opening new terminal we need to run this command

source devel/setup.bash

or the best way is to add the line to .bashrc

As i am getting problem explains that one portion of the program is running well which is printing

core service [/rosout] found process[mytele_keyboard-1]: started with pid [3972] Reading from keyboard

--------------------------- Use arrow keys to move the turtlebot.

but the code after that is not performing well to get the input of keyboard and performing the task accordingly. I suggest you to go through it again.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-08-16 01:14:13 -0500

Seen: 4,572 times

Last updated: Aug 18 '13