Beispiel #1
0
 def stop(self):
     """Stop the robot's motion."""
     response = self._robot_command(RobotCommandBuilder.stop_command())
     return response[0], response[1]
Beispiel #2
0
 def _stop(self):
     self._start_robot_command('stop', RobotCommandBuilder.stop_command())
Beispiel #3
0
def test_stop_command():
    command = RobotCommandBuilder.stop_command()
    _test_has_full_body(command)
    assert command.full_body_command.HasField("stop_request")
Beispiel #4
0
def main():
    import argparse
    parser = argparse.ArgumentParser()
    bosdyn.client.util.add_common_arguments(parser)
    parser.add_argument('--dx',
                        default=0,
                        type=float,
                        help='Position offset in body frame (meters forward).')
    parser.add_argument('--dy',
                        default=0,
                        type=float,
                        help='Position offset in body frame (meters left).')
    parser.add_argument('--dyaw',
                        default=0,
                        type=float,
                        help='Position offset in body frame (degrees ccw).')
    parser.add_argument('--frame',
                        choices=[VISION_FRAME_NAME, ODOM_FRAME_NAME],
                        default=ODOM_FRAME_NAME,
                        help='Send the command in this frame.')
    parser.add_argument('--stairs',
                        action='store_true',
                        help='Move the robot in stairs mode.')
    options = parser.parse_args()

    # Create robot object.
    sdk = bosdyn.client.create_standard_sdk('RobotCommandMaster')
    robot = sdk.create_robot(options.hostname)
    robot.authenticate(options.username, options.password)

    # Check that an estop is connected with the robot so that the robot commands can be executed.
    assert not robot.is_estopped(), "Robot is estopped. Please use an external E-Stop client, " \
                                    "such as the estop SDK example, to configure E-Stop."

    # Create the lease client.
    lease_client = robot.ensure_client(LeaseClient.default_service_name)

    # Setup clients for the robot state and robot command services.
    robot_state_client = robot.ensure_client(
        RobotStateClient.default_service_name)
    robot_command_client = robot.ensure_client(
        RobotCommandClient.default_service_name)

    lease_client.acquire()
    with LeaseKeepAlive(lease_client, return_at_exit=True):
        # Power on the robot and stand it up.
        robot.time_sync.wait_for_sync()
        robot.power_on()
        blocking_stand(robot_command_client)

        try:
            return relative_move(options.dx,
                                 options.dy,
                                 math.radians(options.dyaw),
                                 options.frame,
                                 robot_command_client,
                                 robot_state_client,
                                 stairs=options.stairs)
        finally:
            # Send a Stop at the end, regardless of what happened.
            robot_command_client.robot_command(
                RobotCommandBuilder.stop_command())