Gazebo | Ignition | Community
Ask Your Question

Why cannot robot move diagonally?

asked 2022-04-01 21:52:32 -0500

shiraz_baig gravatar image

I am using ROS melodic and ubuntu 18.04 and python 2.7. I am referring to this lecture of a two wheeled robot moving in a world.

I placed the robot at position 8,8 with an orientation to face position 0,0, in a gazebo world. I wanted to move the robot, diagonally, to position 0,0. I used following code:

while not rospy.is_shutdown():
  twist.linear.x = 0.5
  twist.angular.z = 0.0

The robot starts towards origin(0,0) but immediately turns and starts moving parallel to y axis. I cannot understand, why it turns parallel to an axis, when I have not given it any angular command. Why it cannot keep going diagonally? On the other hand if I initially keep its orientation parallel to an axis, it keeps moving along a line parallel to axis. and does not make any kind of turn. Could any one guide how to move it diagonally?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2022-04-07 05:13:29 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

In my opinion, your robot is in position control mode and you are giving him velocities commands. When you make twist.linear.x = 0.5. Your drone start moving towards global x = 0.5. First possible solution: update the value of both linear.x and linear.y to move it diagonally.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2022-04-01 21:52:32 -0500

Seen: 92 times

Last updated: Apr 01 '22