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

Turtlesim Go To Goal With Specified Orientation

asked 2018-05-30 01:12:41 -0500

rizvan183 gravatar image

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-05-30 10:11:18 -0500

nathan gravatar image

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.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-05-30 01:12:41 -0500

Seen: 1,007 times

Last updated: May 30 '18