2

I have simulated a robot in Webots. The robot has one active castor wheel. The castor wheel has two motors one for steering and one for linear velocity. I am using Webots ROS control which gives everything in the form of ROS services.

For linear(wheel rotation), I am using it in the velocity control, whereas steering control is done in position control. The velocity control works as expected but for steering position control is not working fine. Whenever steering commands are given to the robot, the wheel turns 360 degrees. But not stops at the value specified and exceeds. The commands are in form of rostopics, where in its callbacks webots rosservices are called.

As a debug I called the services in terminal and goes to the value specified and does not overshoots for multiple service calls to the same motor. But in the below script calling the same services(via velocity and steering topics) creates the problem.

Code


def velocityBridgeCallback(msg, args):
    base_name = '/AGV01'
    if args == 'velocity':
        device = base_name + '/wheel_main_rotation_motor'
        rospy.wait_for_service(device + '/set_position')
        set_position = rospy.ServiceProxy(device+'/set_position',set_float)
        set_position(float('inf'))
        rospy.wait_for_service(device + '/set_velocity')
        set_velocity = rospy.ServiceProxy(device+'/set_velocity',set_float)
        set_velocity(msg.data)
    elif args == 'steer':
        device_steer = base_name+'/wheel_main_steer_motor'
        rospy.wait_for_service(device_steer+'/set_position')
        set_position = rospy.ServiceProxy(device_steer+'/set_position',set_float)
        set_position(msg.data)
if __name__ == '__main__':
    rospy.init_node('AGV_velocity_bridge', anonymous = False, log_level = rospy.INFO)
    rospy.Subscriber('/velocity_filter/command', Float64, velocityBridgeCallback, ('velocity'))
    rospy.Subscriber('/steer_filter/command', Float64, velocityBridgeCallback, ('steer'))
    rospy.spin()

This is the initial position of the wheel and the desired position of the wheel can be seen here. But the the motor does not stop at the desired position and goes till the hard limit of the joint

Tahir Mahmood
  • 305
  • 1
  • 11
  • Have you tried playing with the 'controlPID' and 'maxTorque' fields of the motor in Webots? Can you check in the robot-window (simply doule click on the robot in the 3D view, more information here: https://www.cyberbotics.com/doc/guide/controller-plugin#robot-window) what is the actual command sent to the motors? – David Mansolino Jun 01 '19 at 15:20

0 Answers0