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

Revision history [back]

click to hide/show revision 1
initial version

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.