Skip to content

Commit 19e6bf7

Browse files
committed
Fix velocity command obstacle params handling
1 parent a3536b5 commit 19e6bf7

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

spot_wrapper/wrapper.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,20 +1314,14 @@ def velocity_cmd(
13141314
"""
13151315
start_time = now_sec() if timestamp is None else timestamp
13161316
end_time = start_time + cmd_duration
1317+
mobility_params = spot_command_pb2.MobilityParams()
1318+
mobility_params.CopyFrom(self.get_mobility_params())
1319+
if not use_obstacle_params:
1320+
mobility_params.ClearField("obstacle_params")
13171321
if body_height:
1318-
current_mobility_params = self.get_mobility_params()
1319-
height_adjusted_params = RobotCommandBuilder.mobility_params(
1320-
body_height=body_height,
1321-
locomotion_hint=current_mobility_params.locomotion_hint,
1322-
stair_hint=current_mobility_params.stair_hint,
1323-
external_force_params=current_mobility_params.external_force_params,
1324-
stairs_mode=current_mobility_params.stairs_mode,
1325-
)
1326-
if use_obstacle_params:
1327-
height_adjusted_params.obstacle_params.CopyFrom(current_mobility_params.obstacle_params)
1328-
self.set_mobility_params(height_adjusted_params)
1322+
mobility_params.body_control.CopyFrom(RobotCommandBuilder.mobility_params(body_height=body_height).body_control)
13291323
response = self._robot_command(
1330-
RobotCommandBuilder.synchro_velocity_command(v_x=v_x, v_y=v_y, v_rot=v_rot, params=self._mobility_params),
1324+
RobotCommandBuilder.synchro_velocity_command(v_x=v_x, v_y=v_y, v_rot=v_rot, params=mobility_params),
13311325
end_time_secs=end_time,
13321326
timesync_endpoint=self._robot.time_sync.endpoint,
13331327
)

0 commit comments

Comments
 (0)