File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -539,13 +539,17 @@ def handle_arm_velocity(
539539 self ._logger .info (msg )
540540 return False , msg
541541 else :
542- end_time = self ._robot .time_sync .robot_timestamp_from_local_secs (now_sec () + cmd_duration )
543- arm_velocity_command .end_time .CopyFrom (end_time )
542+ end_time = now_sec () + cmd_duration
543+ end_time_proto = self ._robot .time_sync .robot_timestamp_from_local_secs (end_time )
544+ arm_velocity_command .end_time .CopyFrom (end_time_proto )
544545
545546 robot_command = robot_command_pb2 .RobotCommand ()
546547 robot_command .synchronized_command .arm_command .arm_velocity_command .CopyFrom (arm_velocity_command )
547-
548- self ._robot_command_client .robot_command (command = robot_command , end_time_secs = now_sec () + cmd_duration )
548+ self ._robot_command_client .robot_command (
549+ command = robot_command ,
550+ end_time_secs = end_time ,
551+ timesync_endpoint = self ._robot .time_sync .endpoint ,
552+ )
549553
550554 except Exception as e :
551555 return (
Original file line number Diff line number Diff line change @@ -1290,6 +1290,7 @@ def velocity_cmd(
12901290 v_x : float ,
12911291 v_y : float ,
12921292 v_rot : float ,
1293+ timestamp : float | None = None ,
12931294 cmd_duration : float = 0.125 ,
12941295 body_height : float = 0.0 ,
12951296 use_obstacle_params : bool = False ,
@@ -1302,6 +1303,7 @@ def velocity_cmd(
13021303 v_x: Velocity in the X direction in meters
13031304 v_y: Velocity in the Y direction in meters
13041305 v_rot: Angular velocity around the Z axis in radians
1306+ timestamp: (optional) Time at which the command is sent, in seconds since the epoch. Default is now.
13051307 cmd_duration: (optional) Time-to-live for the command in seconds. Default is 125ms (assuming 10Hz command
13061308 rate).
13071309 body_height: Offset of the body relative to nominal stand height, in metres
@@ -1310,7 +1312,8 @@ def velocity_cmd(
13101312 Returns:
13111313 Tuple of bool success and a string message
13121314 """
1313- end_time = now_sec () + cmd_duration
1315+ start_time = now_sec () if timestamp is None else timestamp
1316+ end_time = start_time + cmd_duration
13141317 if body_height :
13151318 current_mobility_params = self .get_mobility_params ()
13161319 height_adjusted_params = RobotCommandBuilder .mobility_params (
You can’t perform that action at this time.
0 commit comments