Robotics StackExchange | Archived questions

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?

Asked by shiraz_baig on 2022-04-01 21:52:32 UTC

Comments

Answers

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.

Asked by MuneebAhmad on 2022-04-07 05:13:29 UTC

Comments