@@ -1299,7 +1299,7 @@ def get_mobility_params(self) -> spot_command_pb2.MobilityParams:
1299
1299
return self ._mobility_params
1300
1300
1301
1301
def velocity_cmd (
1302
- self , v_x : float , v_y : float , v_rot : float , cmd_duration : float = 0.125
1302
+ self , v_x : float , v_y : float , v_rot : float , cmd_duration : float = 0.125 , body_height : float = 0.0
1303
1303
) -> typing .Tuple [bool , str ]:
1304
1304
"""
1305
1305
@@ -1311,11 +1311,22 @@ def velocity_cmd(
1311
1311
v_rot: Angular velocity around the Z axis in radians
1312
1312
cmd_duration: (optional) Time-to-live for the command in seconds. Default is 125ms (assuming 10Hz command
1313
1313
rate).
1314
+ body_height: Offset of the body relative to nominal stand height, in metres
1314
1315
1315
1316
Returns:
1316
1317
Tuple of bool success and a string message
1317
1318
"""
1318
1319
end_time = time .time () + cmd_duration
1320
+ if body_height :
1321
+ current_mobility_params = self .get_mobility_params ()
1322
+ height_adjusted_params = RobotCommandBuilder .mobility_params (
1323
+ body_height = body_height ,
1324
+ locomotion_hint = current_mobility_params .locomotion_hint ,
1325
+ stair_hint = current_mobility_params .stair_hint ,
1326
+ external_force_params = current_mobility_params .external_force_params ,
1327
+ stairs_mode = current_mobility_params .stairs_mode ,
1328
+ )
1329
+ self .set_mobility_params (height_adjusted_params )
1319
1330
response = self ._robot_command (
1320
1331
RobotCommandBuilder .synchro_velocity_command (v_x = v_x , v_y = v_y , v_rot = v_rot , params = self ._mobility_params ),
1321
1332
end_time_secs = end_time ,
0 commit comments