@@ -23,7 +23,7 @@ class FourWheelRobot(LocomotionRobot):
2323
2424 def _validate_configuration (self ):
2525 # Make sure base only has two indices (i.e.: two wheels for differential drive)
26- assert len (self .base_control_idx ) == 4 , "Differential drive can only be used with robot with two base joints!"
26+ assert len (self .base_control_idx ) == 4 , "Differential drive can only be used with robot with four base joints!"
2727
2828 # run super
2929 super ()._validate_configuration ()
@@ -34,27 +34,27 @@ def _create_discrete_action_space(self):
3434 # We set straight velocity to be 50% of max velocity for the wheels
3535 max_wheel_joint_vels = self .control_limits ["velocity" ][1 ][self .base_control_idx ]
3636 assert len (max_wheel_joint_vels ) == 4 , "FourWheelRobot must only have two base (wheel) joints!"
37- assert max_wheel_joint_vels [0 ] == max_wheel_joint_vels [1 ], "All wheels must have the same max speed!"
37+ assert max_wheel_joint_vels [0 ] == max_wheel_joint_vels [1 ] == max_wheel_joint_vels [ 2 ] == max_wheel_joint_vels [ 3 ] , "All wheels must have the same max speed!"
3838 wheel_straight_vel = 0.5 * max_wheel_joint_vels [0 ]
3939 wheel_rotate_vel = 0.5
4040 if self .controller_config ["base" ]["name" ] == "JointController" :
4141 action_list = [
42- [wheel_straight_vel , wheel_straight_vel ],
43- [- wheel_straight_vel , - wheel_straight_vel ],
44- [wheel_rotate_vel , - wheel_rotate_vel ],
45- [- wheel_rotate_vel , wheel_rotate_vel ],
46- [0 , 0 ],
42+ [wheel_straight_vel , wheel_straight_vel , wheel_straight_vel , wheel_straight_vel ],
43+ [- wheel_straight_vel , - wheel_straight_vel , - wheel_straight_vel , - wheel_straight_vel ],
44+ [wheel_rotate_vel , - wheel_rotate_vel , wheel_rotate_vel , - wheel_rotate_vel ],
45+ [- wheel_rotate_vel , wheel_rotate_vel , - wheel_rotate_vel , wheel_rotate_vel ],
46+ [0 , 0 , 0 , 0 ],
4747 ]
4848 else :
4949 # DifferentialDriveController
5050 lin_vel = wheel_straight_vel * self .wheel_radius
5151 ang_vel = wheel_rotate_vel * self .wheel_radius * 2.0 / self .wheel_axle_length
5252 action_list = [
53- [lin_vel , 0 ],
54- [- lin_vel , 0 ],
55- [0 , ang_vel ],
56- [0 , - ang_vel ],
57- [0 , 0 ],
53+ [lin_vel , 0 , lin_vel , 0 ],
54+ [- lin_vel , 0 , - lin_vel , 0 ],
55+ [0 , ang_vel , 0 , ang_vel ],
56+ [0 , - ang_vel , 0 , - ang_vel ],
57+ [0 , 0 , 0 , 0 ],
5858 ]
5959
6060 self .action_list = action_list
0 commit comments