Move arm and base at the same time

Hello,

I’m able to move the arm to specific arm joints using the tutorial here in the following way:

import stretch_body.robot

robot=stretch_body.robot.Robot()
robot.startup()

robot.lift.move_to(args.lift_height)
robot.arm.move_to(args.arm_length)
robot.end_of_arm.move_to('wrist_yaw', args.wrist_yaw)

robot.push_command()
robot.stop()

I am also able to control the base rotation as described here:

import stretch_body.base

b = stretch_body.base.Base()
b.left_wheel.disable_sync_mode()
b.right_wheel.disable_sync_mode()
if not b.startup():
    exit() # failed to start base!

b.rotate_by(args.rotate_by)
b.push_command()

While these scripts work well separately, I am not able to run them concurrently in the same script as this results in an error. I tried splitting up the overall motion into smaller steps and alternated between the arm motion and the base motion but this leads to a very un-smooth trajectory. I would like to move the arm joints and the rotate the base at the same time – is this possible?

Any help will be much appreciated, thanks in advance!

Hi @arjung, yes, it is possible to move the arm joints and rotate the base simultaneously. In the first snippet, a instance of stretch_body.robot.Robot() is created. Through that robot variable, you can send commands to the arm and base simultaneously:

import stretch_body.robot

robot = stretch_body.robot.Robot()
robot.startup()

robot.lift.move_to(args.lift_height)
robot.arm.move_to(args.arm_length)
robot.end_of_arm.move_to('wrist_yaw', args.wrist_yaw)
robot.base.rotate_by(args.rotate_by)

robot.push_command()
robot.stop()

Notice here that if you were to print out the type of robot.base, it would actually be the same stretch_body.base.Base class that you manually instantiated in the second snippet. It’s just easier to interact with the base through robot.base.

3 Likes

This was exactly what I was looking for. Thanks so much for all your help!

1 Like