Ask Your Question
0

The robot doesn't move when I use turtle_teleop_key

asked 2018-09-05 10:52:59 -0500

Elric gravatar image

updated 2018-09-06 14:33:09 -0500

I want to connect ROS with Gazebo, to do it I'm following this tutorial: Robotic simulation scenarios with Gazebo and ROS.

And running ROS Lunar version 1.13.6 on an Ubuntu Xenial 16.04.4 LTS.

I did everything in the tutorial until the section Adding a camera. But when I do:

rosrun turtlesim turtle_teleop_key /turtle1/cmd_vel:=/mybot/cmd_vel

The robot doesn't move. It only moves a little when a press down arrow key.

Maybe the problem is here, inside the mybot.gazebo file:

<gazebo>
  <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
    <legacyMode>true</legacyMode>
    <alwaysOn>true</alwaysOn>
    <updateRate>100</updateRate>
    <leftJoint>left_wheel_hinge</leftJoint>
    <rightJoint>right_wheel_hinge</rightJoint>
    <wheelSeparation>${chassisWidth+wheelWidth}</wheelSeparation>
    <wheelDiameter>${2*wheelRadius}</wheelDiameter>
    <torque>20</torque>
    <commandTopic>mybot/cmd_vel</commandTopic>
    <odometryTopic>mybot/odom_diffdrive</odometryTopic>
    <odometryFrame>odom</odometryFrame>
    <robotBaseFrame>footprint</robotBaseFrame>
  </plugin>
</gazebo>

But I'm newbie and I don't know if there is something wrong here.

I have also tried:

rostopic pub -1 /mybot/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'

But the robot doesn't move.

Do you know why the robot doesn't move? Well, it moves. When I press the down arrow key, the robot base move to the ground.

All the source code is in Github.

UPDATE

I get this warnings when I launch Gazebo:

DiffDrive(ns = //): missing <rosDebugLevel> default is na
DiffDrive(ns = //): missing <publishWheelTF> default is false
DiffDrive(ns = //): missing <publishWheelJointState> default is false
DiffDrive(ns = //): missing <wheelAcceleration> default is 0
DiffDrive(ns = //): missing <wheelTorque> default is 5
DiffDrive(ns = //): missing <odometrySource> default is 1
GazeboRosDiffDrive Plugin (ns = ) missing <publishTf>, defaults to 1

This is the rosrun rqt_graph rqt_graph output:

image description

edit retag flag offensive close merge delete

Comments

Try publishing more than once, ie remove --1 and add -r 10 (rate at 10 hz)

These things don't latch unless you tell them to, do just hitting it once probably won't result in motion. It's been a while since I did the turtle demo, but I think you have to hold key or press a few times to get moving

stevemacenski gravatar imagestevemacenski ( 2018-09-05 12:53:17 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2018-09-07 09:21:56 -0500

Elric gravatar image

The problem was the Gazebo version. All ROS packages were up to date but Gazebo version was 7.0.0.

I added the Gazebo repository following this instructions and then, I updated it to version 7.14.

And now it moves!!!

edit flag offensive delete link more

Comments

You should mark an answer as correct then so it removes from the queue of unanswered questions :)

stevemacenski gravatar imagestevemacenski ( 2018-09-07 18:27:24 -0500 )edit
0

answered 2018-09-05 12:53:26 -0500

Try publishing more than once, ie remove --1 and add -r 10 (rate at 10 hz)

These things don't latch unless you tell them to, do just hitting it once probably won't result in motion. It's been a while since I did the turtle demo, but I think you have to hold key or press a few times to get moving

edit flag offensive delete link more

Comments

I have tested with the turtelsim and I see that I have to keep the key pressed to move the turtle, so I've done the same with my example. I have tried your suggestion and bot still doesn't move.

Elric gravatar imageElric ( 2018-09-05 12:56:40 -0500 )edit

Check that the topic you're publishing in the robot example matches what your base expects to be receiving commands on. The gazebo plugins dont always work the way you think they should. If the example works for you, then I suspect it could be a plugin / gazebo spawning issue.

stevemacenski gravatar imagestevemacenski ( 2018-09-05 13:51:56 -0500 )edit

What is the base? What is a spawning issue? Do you know if there is a working example of this? Everything is new for me a it is very difficult to find where is the error. Thanks.

Elric gravatar imageElric ( 2018-09-06 01:10:41 -0500 )edit

Have you checked the graph of your nodes to make sure they are communicating on the same topics ?

Delb gravatar imageDelb ( 2018-09-06 01:34:41 -0500 )edit

@Delb There is this connection: /teleop_turtle -> /gabezo. And on top of the arrow this text: /mybot/cmd_vel.

Elric gravatar imageElric ( 2018-09-06 03:55:09 -0500 )edit

Well i used your code to test and with :

rostopic pub -r 100 /mybot/cmd_vel geometry_msgs/Twist "linear:
  x: 1.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.0"

The robot was moving (weirdly but that's not the subject here)

Delb gravatar imageDelb ( 2018-09-06 04:33:32 -0500 )edit

I have tried in another linux machine and it moves. Is there something wrong with my installation?

Elric gravatar imageElric ( 2018-09-06 06:52:02 -0500 )edit

Did it move correctly ? Maybe you are missing some packages on your previous machine. Are they any warnings wwhen you launch your nodes ?

Delb gravatar imageDelb ( 2018-09-06 07:07:37 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-09-05 10:52:59 -0500

Seen: 222 times

Last updated: Sep 07 '18