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

# Turtlesim Go To Goal With Specified Orientation

In the Go To Goal tutorial, the robot moves from initial position to the goal position. However, it doesn't have a specific orientation after reaching the goal. What if I wanted the robot to be facing a certain direction after reaching its goal (i.e - in the direction of the negative x-axis). How would I do that?

edit retag close merge delete

Sort by ยป oldest newest most voted

This is more of a control question. In the code you provided, the linear velocity is calculated by

def linear_vel(self, goal_pose, constant=1.5):
return constant * self.euclidean_distance(goal_pose)


Which defines the forward velocity as a constant gain of 1.5 multiplied by the distance between the target and the robot. This means that the forward velocity is higher the further you are away from the target, and goes to zero as you approach the target.

The angular velocity is calculated similarly by

def angular_vel(self, goal_pose, constant=6):
return constant * (self.steering_angle(goal_pose) - self.pose.theta)


Which is also a gain (in this case of 6) multiplied by a "distance". In this case however, this "distance" is equal to the difference in angle between the line that is directly connecting the robot and the goal position, and the angular pose of the robot itself (check the meaning of the atan in the steering_angle method). This causes the robot to adjust its own theta to eventually move in a straight line to the target.

To change this behaviour, you need to change the angular_vel to also 'include' the difference between the goal theta and the current theta of the robot.

more

## Stats

Seen: 1,029 times

Last updated: May 30 '18