Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why cannot robot move diagonally?

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. https://www.theconstructsim.com/ros-projects-exploring-ros-using-2-wheeled-robot-part-1/#part1

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:

twist=Twist()
while not rospy.is_shutdown():
  twist.linear.x = 0.5
  twist.angular.z = 0.0
  pub.publish(twist)
  rospy.sleep(0.1)

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?