Skip to content

Commit dcc97a6

Browse files
committed
tested body velocity commands
1 parent 23c7287 commit dcc97a6

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from rbd_spot_perception import image, graphnav, robot_state, fiducial
22
from rbd_spot_robot import SpotSDKConn, state
3-
from rbd_spot_action import arm
3+
from rbd_spot_action import arm, body

spot/ros_ws/src/rbd_spot_action/src/rbd_spot_action/body.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def create_client(conn):
1111
return conn.ensure_client(RobotCommandClient.default_service_name)
1212

1313
def velocityCommand(conn, command_client, v_x, v_y, v_rot,
14-
cmd_duration=0.125, mobility_params=None):
14+
duration=0.125, mobility_params=None):
1515
"""
1616
Send a velocity motion command to the robot.
1717
@@ -25,7 +25,7 @@ def velocityCommand(conn, command_client, v_x, v_y, v_rot,
2525
"""
2626
if mobility_params is None:
2727
mobility_params = RobotCommandBuilder.mobility_params()
28-
end_time = time.time() + cmd_duration
28+
end_time = time.time() + duration
2929
synchro_velocity_command = RobotCommandBuilder.synchro_velocity_command(
3030
v_x=v_x, v_y=v_y, v_rot=v_rot, params=mobility_params)
3131

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env python
2+
# unstow the arm
3+
import time
4+
import rbd_spot
5+
from bosdyn.client.robot_command import blocking_stand
6+
7+
TRANS_VEL = 0.5 # m/s
8+
ROT_VEL = 0.5 # rad/s
9+
10+
def main():
11+
conn = rbd_spot.SpotSDKConn(sdk_name="VelocityCmdClient",
12+
take_lease=True)
13+
command_client = rbd_spot.body.create_client(conn)
14+
blocking_stand(command_client, timeout_sec=10)
15+
16+
rbd_spot.body.velocityCommand(conn, command_client, TRANS_VEL, 0.0, 0.0, duration=1.0)
17+
time.sleep(2)
18+
rbd_spot.body.velocityCommand(conn, command_client, 0.0, -TRANS_VEL, 0.0, duration=1.0)
19+
time.sleep(2)
20+
rbd_spot.body.velocityCommand(conn, command_client, 0.0, 0.0, ROT_VEL, duration=1.0)
21+
time.sleep(2)
22+
23+
if __name__ == "__main__":
24+
main()

0 commit comments

Comments
 (0)