### Create SDK, Robot, Authenticate, and Get Image Client Source: https://github.com/boston-dynamics/spot-sdk/blob/master/python/bosdyn-client/README.md This example demonstrates the basic setup for interacting with a Spot robot using the bosdyn-client library. It shows how to create an SDK object, establish a connection to the robot, authenticate, and obtain an ImageClient instance to list image sources. ```python import bosdyn.client sdk = bosdyn.client.create_standard_sdk('image_capture') robot = sdk.create_robot(hostname) robot.authenticate(username, password) image_client = robot.ensure_client(ImageClient.default_service_name) image_sources = image_client.list_image_sources() ``` -------------------------------- ### Hello Spot Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/README.html A basic example to verify SDK installation and robot connectivity. It prints a 'Hello Spot!' message. ```python import bosdyn.client from bosdyn.client.lease import LeaseKeepAlive from bosdyn.client.util import setup_logging def main(): setup_logging(verbose=True) # Create robot object with an IP address sdk = bosdyn.client.create_standard_sdk('hello_spot_client') robot = sdk.create_robot('192.168.80.3') # Authenticate robot.authenticate('user', 'password') # Establish a lease keep-alive lease_keep_alive = LeaseKeepAlive(robot.time_sync.get_time().source) # Print a message to confirm connection print('Hello Spot!') # Clean up the lease keep-alive lease_keep_alive.shutdown() if __name__ == '__main__': main() ``` -------------------------------- ### Install Dependencies Source: https://github.com/boston-dynamics/spot-sdk/blob/master/python/examples/orbit/work_orders/README.md Install the required Python dependencies for the example. Ensure you have a `requirements.txt` file. ```bash pip install -r requirements.txt ``` -------------------------------- ### Dock My Robot Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/docking/README.html This example demonstrates how to dock the robot. Ensure the Spot SDK is installed and dependencies are met. -------------------------------- ### Install Object Detection API Setup File Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/python/fetch_tutorial/fetch2.md Copy and install the setup file for the Object Detection API. This command installs the API into your Python environment. ```bash cp object_detection/packages/tf2/setup.py . python3 -m pip install . ``` -------------------------------- ### Install Client Requirements Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/network_compute_bridge/README.html Installs the necessary Python packages for the client example. Ensure you have Python 3 and pip installed. ```bash python3 -m pip install -r requirements_client.txt ``` -------------------------------- ### Run Hello Spot Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/python/quickstart.md Execute the 'hello_spot' example to make the robot move. Ensure you have installed dependencies using 'requirements.txt' and set the correct username and password environment variables. ```shell cd ~/spot-sdk/python/examples/hello_spot # or wherever you installed Spot SDK python3 -m pip install -r requirements.txt # will install dependent packages export BOSDYN_CLIENT_USERNAME=user export BOSDYN_CLIENT_PASSWORD=password python3 hello_spot.py 192.168.80.3 ``` -------------------------------- ### Start Python Interpreter and Import SDK Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/python/understanding_spot_programming.md Begin by starting a Python interpreter and importing the necessary bosdyn.client package. This assumes the Spot Python SDK Quickstart has been successfully completed. ```sh $ python Python 3.6.8 (default, Jan 14 2019, 11:02:34) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import bosdyn.client ``` -------------------------------- ### Run Recording Command Line Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/graph_nav_command_line/README.html Execute the recording command line example to start mapping. The download-filepath argument specifies where the map data will be saved. ```bash python3 -m recording_command_line --download-filepath ROBOT_IP ``` -------------------------------- ### Install Spot SDK Dependencies Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/docs/python/quickstart.html Use this command to install all third-party packages required by a Spot SDK example. Always use the associated requirements.txt file. ```bash python3 -m pip install -r requirements.txt ``` -------------------------------- ### Example: Build AWS Post Docking Callback Extension Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/extensions/README.html This example demonstrates how to build the Spot Extension for the AWS Post Docking Callback example to run on ARM64. Follow the setup steps in the README before running this command. ```bash python3 build_extension.py \ --dockerfile-paths ../post_docking_callbacks/Dockerfile.arm64 \ --build-image-tags docking_callback:arm64 \ --image-archive aws_docking_callback_arm64.tar.gz \ --package-dir ../post_docking_callbacks \ --spx ~/Downloads/aws_docking_callback.spx ``` -------------------------------- ### Install Dependencies Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/bddf_download/README.html Install the required Python dependencies for the examples using pip. ```bash $ python3 -m pip install -r requirements.txt ``` -------------------------------- ### Run User No-Go Regions Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/user_nogo_regions/README.html Execute the user no-go regions example script. Ensure the Spot SDK is installed and requirements are met. ```bash python3 user_nogo_regions.py ROBOT_IP ``` -------------------------------- ### Activate Virtual Environment and Run Hello Spot Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/docs/python/fetch_tutorial/fetch1.html Enter your virtual environment and run the hello_spot example to confirm your Spot SDK setup. Replace 'my_spot_env' with your actual virtual environment name. ```bash source my_spot_env/bin/activate cd ~/spot-sdk/python/examples/hello_spot python3 hello_spot.py 192.168.80.3 ``` -------------------------------- ### Install Dependencies Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/graph_nav_anchoring_optimization/README.html Install the necessary Python dependencies for the example using pip. This includes the bosdyn API and client, and potentially matplotlib backends like pyqt5. ```bash python3 -m pip install -r requirements.txt ``` ```bash python3 -m pip install pyqt5 ``` -------------------------------- ### Access Controlled Doors Example Setup Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/release_notes.md This example demonstrates setting up access-controlled door functionality. It involves configuring API calls for authentication, door operations, and secure communication using SSL/TLS certificates. ```python from bosdyn.client.access_control import AccessControlClient # Assuming access_control_client is an initialized AccessControlClient instance # and door_id is the identifier for the door # Authenticate with the access control system access_control_client.authenticate(username='user', password='password') # Open the door access_control_client.open_door(door_id=door_id) # Close the door after a delay # time.sleep(5) # access_control_client.close_door(door_id=door_id) ``` -------------------------------- ### Install Spot SDK Requirements Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/spot_cam/README.html Install the necessary Python dependencies for the Spot SDK examples. Upgrade pip if you encounter issues. ```bash python3 -m pip install -r requirements.txt ``` ```bash python3 -m pip install --upgrade pip ``` -------------------------------- ### Setup for Cross-Architecture Docker Builds Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/payload/docker_containers.md Install QEMU and set up Docker Buildx for building Docker images for different architectures on your development machine. This is necessary for cross-compiling. ```bash sudo apt-get install -y qemu qemu-user-static docker buildx create --use --name multiarchbuilder mkdir -p prebuilt # this is needed due to limitations in docker buildx sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes ``` -------------------------------- ### Server Startup Output Source: https://github.com/boston-dynamics/spot-sdk/blob/master/python/examples/remote_mission_service/README.md This is an example of the expected output when the remote mission server starts successfully. ```text 2020-10-30 14:21:41,577 - INFO - Started the HelloWorldServicer server. 2020-10-30 14:21:41,585 - INFO - hello-world-callback service registered/updated. 2020-10-30 14:21:41,585 - INFO - Starting directory registration loop for hello-world-callback ``` -------------------------------- ### Import Spot Client Library Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/python/quickstart.md Start the Python interpreter and attempt to import the 'bosdyn.client' module to confirm that the Spot SDK packages have been installed and are accessible. ```python >>> import bosdyn.client >>> help(bosdyn.client) Help on package bosdyn.client in bosdyn: NAME bosdyn.client DESCRIPTION The client library package. Sets up some convenience imports for commonly used classes. PACKAGE CONTENTS __main__ ... ``` -------------------------------- ### Get Payload Credentials Source: https://github.com/boston-dynamics/spot-sdk/blob/master/python/examples/gps_service/README.md Retrieves the GUID and secret for authenticating the payload running the example. ```python # Get the credentials for this payload. creds = bosdyn.client.util.get_guid_and_secret(options) ``` -------------------------------- ### Run Hello Spot Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/docs/python/quickstart.html Execute the 'hello_spot' example to make the robot move. Ensure you have set your username and password environment variables and are providing the correct robot IP address. ```bash export BOSDYN_CLIENT_USERNAME=user export BOSDYN_CLIENT_PASSWORD=password python3 hello_spot.py 192.168.80.3 ``` -------------------------------- ### Run Image Viewer Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/get_image/README.html This example creates popup windows to display a live preview of specified image sources. Use the `--image-sources` argument to select cameras. ```bash python3 image_viewer.py ROBOT_IP --image-sources frontleft_fisheye_image ``` -------------------------------- ### Install Dependencies Source: https://github.com/boston-dynamics/spot-sdk/blob/master/python/examples/orbit/webhook_integration/README.md Install Python dependencies for the webhook integration example using pip. ```bash python3 -m pip install -r docker-requirements.txt ``` -------------------------------- ### Start Source: https://github.com/boston-dynamics/spot-sdk/blob/master/protos/bosdyn/api/proto_reference.md Initiates the AutoReturn behavior immediately with the current or specified parameters. This method triggers the robot to start its AutoReturn sequence. ```APIDOC ## Start bosdyn/api/auto_return/auto_return_service.proto ### Description Start AutoReturn now. ### Method POST ### Endpoint /auto_return/start ### Request Body - **header** (bosdyn.api.RequestHeader) - Required - Common request header. - **params** (bosdyn.api.auto_return.Params) - Optional - Parameters to use. If left empty, use the params specified in ConfigureRequest. If empty and no params have been specified, the response will have a CODE_INVALID_REQUEST. - **leases** (bosdyn.api.Lease) - Repeated - Optional - Leases that AutoReturn may use to accomplish its goals. If left empty, use the leases specified in ConfigureRequest. If empty and no leases have been specified, the response will have a CODE_INVALID_REQUEST. ### Response #### Success Response (200) - **header** (bosdyn.api.ResponseHeader) - Common response header. - **status** (bosdyn.api.auto_return.StartResponse.Status) - The status of the start request. - **invalid_params** (bosdyn.api.auto_return.Params) - If status is STATUS_INVALID_PARAMS, this contains the settings that were invalid. #### Response Example { "header": {}, "status": "STATUS_OK", "invalid_params": {} } ### Status Codes - STATUS_UNKNOWN - STATUS_OK - STATUS_INVALID_PARAMS ``` -------------------------------- ### StartRequest Source: https://github.com/boston-dynamics/spot-sdk/blob/master/protos/bosdyn/api/proto_reference.md Request message for starting the auto-return process. ```APIDOC ## StartRequest ### Description This message is used to initiate the auto-return process. It may contain parameters specifying the return destination or other relevant information. ### Fields This message does not expose specific fields in this reference. Refer to the proto definition for details. ``` -------------------------------- ### Run the Record Autowalk Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/record_autowalk/README.html Launch the example by providing the robot's IP address. Ensure a software e-stop is running separately. ```bash python3 record_autowalk.py ROBOT_IP ``` -------------------------------- ### StartResponse Source: https://github.com/boston-dynamics/spot-sdk/blob/master/protos/bosdyn/api/proto_reference.md Response message for starting the auto-return process. ```APIDOC ## StartResponse ### Description This message is the response to a StartRequest, indicating the status of the auto-return initiation. ### Fields This message does not expose specific fields in this reference. Refer to the proto definition for details. ``` -------------------------------- ### List Installed Spot Packages (Linux/macOS) Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/python/quickstart.md Verify that the Spot SDK packages are installed correctly by listing all installed packages and filtering for those starting with 'bosdyn'. ```shell python3 -m pip list --format=columns | grep bosdyn ``` -------------------------------- ### Run Spot Light Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/spot_light/README.html Execute the main script for the light interaction example. Adjust the brightness threshold if Spot does not respond as expected. ```bash python3 spot_light.py ROBOT_IP ``` ```bash python3 spot_light.py ROBOT_IP --brightness_threshold 200 ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/velodyne_client/README.html Install the required Python dependencies for the Velodyne client examples. Ensure you have Python 3 and the Spot SDK installed. PyQt5 is also required. ```bash python -m pip install -r requirements.txt ``` ```bash py.exe -3 -m pip install -r requirements.txt ``` -------------------------------- ### StartRecording Source: https://github.com/boston-dynamics/spot-sdk/blob/master/protos/bosdyn/api/proto_reference.md Initiates recording, creating waypoints with the specified recording environment. It can optionally verify fiducial visibility and set a session start time. ```APIDOC ## StartRecordingRequest The StartRecording request tells the recording service to begin creating waypoints with the specified recording_environment. ### Parameters #### Request Body - **header** (bosdyn.api.RequestHeader) - Common request header. - **lease** (bosdyn.api.Lease) - The recording service is protected by a lease. The client must have a lease to the recording service to modify its internal state. - **recording_environment** (RecordingEnvironment) - This will be merged into a copy of the existing persistent recording environment and used as the environment for the created waypoint and the edge from the previous waypoint to the new one. It will not affect the persistent environment. - **require_fiducials** (repeated int32) - If filled out, asks that the record service verify that the given fiducial IDs are presently visible before starting to record. This is useful for verifying that the robot is where the user thinks it is in an area with known fiducials. - **session_start_time** (google.protobuf.Timestamp) - If provided, this timestamp will be used in every waypoint snapshot as the "started_recording_on" timestamp. Otherwise, a new timestamp will be generated after "StartRecording" is called. This is to allow association between waypoint snapshots based on recording session time. ## StartRecordingResponse The StartRecording response message returns the first created waypoint, which is made at the location the robot was standing when the request was made, in addition to any status information. ### Parameters #### Response Body - **header** (bosdyn.api.ResponseHeader) - Common response header. - **created_waypoint** (Waypoint) - The waypoint that was just created. - **lease_use_result** (bosdyn.api.LeaseUseResult) - The results/status of the lease provided. - **status** (StartRecordingResponse.Status) - Return status for the request. - **missing_fiducials** (repeated int32) - If the status is STATUS_MISSING_FIDUCIALS, these are the fiducials that are not currently visible. - **bad_pose_fiducials** (repeated int32) - If the status is STATUS_FIDUCIAL_POSE_NOT_OK, these are the fiducials that could not be localized confidently. - **license_status** (bosdyn.api.LicenseInfo.Status) - Large graphs can only be uploaded if the license permits them. Recording will stop automatically when the graph gets too large. If StartRecording is requested again after the graph gets too large, it will fail, and license status will be filled out. - **impaired_state** (bosdyn.api.RobotImpairedState) - If the status is ROBOT_IMPAIRED, this is why the robot is impaired. - **session_start_time** (google.protobuf.Timestamp) - This is the robot local timestamp that graph_nav began recording on. If the Start Recording Request's session start time is provided, this should be the same as the request's session start time. - **map_stats** (MapStats) - General statistics of the map loaded in GraphNav. ``` -------------------------------- ### StartRecordingState Source: https://github.com/boston-dynamics/spot-sdk/blob/master/protos/bosdyn/api/proto_reference.md Initiates or continues a recording session for the robot's state. It can start a new session or extend an existing one. ```APIDOC ## StartRecordingStateRequest ### Description Used to start or continue recording the robot's state. Allows specifying a duration for continuous recording or extending an existing session. ### Request Body - **header** (bosdyn.api.RequestHeader) - Required - Common request header. - **continue_recording_duration** (google.protobuf.Duration) - Optional - How long the robot should record if no stop RPC is sent. This can be extended. - **recording_session_id** (uint64) - Optional - The unique identifier of the recording session to extend. If 0, a new session is created. ## StartRecordingStateResponse ### Description Response to the StartRecordingStateRequest, indicating the status of the recording session and its unique identifier. ### Response #### Success Response (200) - **header** (bosdyn.api.ResponseHeader) - Common response header. - **status** (StartRecordingStateResponse.Status) - The status of the recording operation. - **recording_session_id** (uint64) - Unique identifier for the current recording session. ``` -------------------------------- ### StartExperimentLog Source: https://github.com/boston-dynamics/spot-sdk/blob/master/protos/bosdyn/api/proto_reference.md Starts an experiment log. This log is intended for capturing data during specific experiments. It allows configuration of the log's duration and the extent of past text logs to include. ```APIDOC ## StartExperimentLogRequest ### Description Request to start an experiment log. ### Fields - **header** (bosdyn.api.RequestHeader) - Common request header. - **keep_alive** (google.protobuf.Duration) - How long into the future should this log end? - **past_textlog_duration** (google.protobuf.Duration) - How long into the past should text logs extend? (default 0) ## StartExperimentLogResponse ### Description Response from starting an experiment log. ### Fields - **header** (bosdyn.api.ResponseHeader) - Common response header. - **status** (StartExperimentLogResponse.Status) - Response status. - **log_status** (LogStatus) - Status of the created log. - **end_time** (google.protobuf.Timestamp) - Timestamp of the end of the log, in robot time. ``` -------------------------------- ### Run Hello Spot Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/python/quickstart.md Execute the 'hello_spot.py' script to power up, stand, pose, and sit the Spot robot. Ensure the 'Motor power enable' button is on. This command requires the robot's IP address as an argument. ```shell $ cd ~/spot-sdk/python/examples/hello_spot $ python3 hello_spot.py 192.168.80.3 ``` -------------------------------- ### Setup and Start Processing Thread Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/python/fetch_tutorial/fetch3.md Initializes thread-safe queues for inter-thread communication and starts the machine learning processing thread. ```python # Thread-safe queues for communication between the GRPC endpoint and the ML thread. request_queue = queue.Queue() response_queue = queue.Queue() # Start server thread thread = threading.Thread(target=process_thread, args=([options, request_queue, response_queue])) thread.start() ``` -------------------------------- ### StartRecording Source: https://github.com/boston-dynamics/spot-sdk/blob/master/protos/bosdyn/api/proto_reference.md Starts recording the map from the current localization. Creates a new waypoint if it's the beginning of a recording, otherwise waits until a sufficient distance from the previous waypoint. ```APIDOC ## StartRecording ### Description Start recording the map from the current localization. Creates a waypoint if you are starting to record. Otherwise, waits until you are sufficiently far away from the previous waypoint. ### Method POST ### Endpoint /graph-nav/record/start ### Request Body - **request** (StartRecordingRequest) - Required - The request payload for starting recording. ### Response #### Success Response (200) - **response** (StartRecordingResponse) - The response payload after starting recording. ### Request Example ```json { "request": { "header": { "timestamp": "2023-10-27T10:00:00Z", "sequence": 1 } } } ``` ### Response Example ```json { "response": { "header": { "timestamp": "2023-10-27T10:00:01Z", "sequence": 1 }, "recording": true } } ``` ``` -------------------------------- ### get_license_info Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/bosdyn-client/src/bosdyn/client/license.html Get the robot’s installed license. ```APIDOC def get_license_info(**kwargs): """Get the robot’s installed license.""" pass ``` -------------------------------- ### Run the Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/python/examples/get_robot_state_async/README.md Execute the example script by providing the robot's IP address. ```bash python3 get_robot_state_async.py ROBOT_IP ``` -------------------------------- ### LicenseClient.get_license_info Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/_modules/bosdyn/client/license.html Get the robot's installed license. ```APIDOC ## get_license_info ### Description Get the robot's installed license. ### Method Call ### Endpoint Not applicable (SDK method) ### Parameters None ### Request Example None ### Response #### Success Response - **license** (object) - The license information. #### Response Example None ``` -------------------------------- ### Activate Virtual Environment and Run hello_spot Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/docs/python/daq_tutorial/daq1.html Activate your Python virtual environment and navigate to the hello_spot example directory. Then, run the example script with your robot's IP address. ```bash source my_spot_env/bin/activate # enter your virtualenv cd ~/spot-sdk/python/examples/hello_spot # or wherever you installed Spot SDK python3 hello_spot.py $ROBOT_IP ``` -------------------------------- ### Install TensorFlow Object Detection API Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/docs/python/fetch_tutorial/fetch2.html Install the TensorFlow Object Detection API package after compiling protobufs and copying the setup file. This command installs the API into your Python environment. ```bash cd models-with-protos/research python3 -m pip install . ``` -------------------------------- ### StartRetroLog Source: https://github.com/boston-dynamics/spot-sdk/blob/master/protos/bosdyn/api/proto_reference.md Starts a retrospective log. This log captures data from a specified duration in the past. It is useful for analyzing events that have already occurred. ```APIDOC ## StartRetroLogRequest ### Description Request to start a retrospective log. ### Fields - **header** (bosdyn.api.RequestHeader) - Common request header. - **past_duration** (google.protobuf.Duration) - How long into the past should this log start? ## StartRetroLogResponse ### Description Response from starting a retrospective log. ### Fields - **header** (bosdyn.api.ResponseHeader) - Common response header. - **status** (StartRetroLogResponse.Status) - Response status. - **log_status** (LogStatus) - Status of the created log. - **end_time** (google.protobuf.Timestamp) - Timestamp of the end of the log, in robot time. ``` -------------------------------- ### GRPC Server Setup and Start Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/python/fetch_tutorial/fetch3.md Configures and starts the GRPC server, adding the NetworkComputeBridgeWorkerServicer to handle incoming requests on the specified port. ```python # Set up GRPC endpoint server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) network_compute_bridge_service_pb2_grpc.add_NetworkComputeBridgeWorkerServicer_to_server( NetworkComputeBridgeWorkerServicer(request_queue, response_queue), server) server.add_insecure_port('[::]:' + options.port) server.start() ``` -------------------------------- ### Run Service Faults Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/service_faults/README.html Execute the service faults example program. Use --guid and --secret for payload-specific operations. ```bash python3 service_faults.py --guid GUID --secret SECRET ROBOT_IP ``` ```bash python3 service_faults.py ROBOT_IP ``` -------------------------------- ### Run the Example Script Source: https://github.com/boston-dynamics/spot-sdk/blob/master/python/examples/orbit/send_robot_back_to_dock/README.md Execute the example script with necessary parameters. Set 'verify' to False for local development to skip TLS certificate verification, but use True or a CA bundle path for production. ```bash python3 send_robot_back_to_dock.py --hostname ORBIT_IP --robot_nickname ROBOT_NICKNAME --site_dock_uuid SITE_DOCK_UUID --verify False --retries 0 ``` -------------------------------- ### PlayMission Source: https://github.com/boston-dynamics/spot-sdk/blob/master/protos/bosdyn/api/proto_reference.md Starts or resumes playing a mission. Allows specifying a time until which the mission should run and various settings. ```APIDOC ## PlayMissionRequest A request to play the currently loaded mission for a fixed amount of time. ### Parameters #### Request Body - **header** ([bosdyn.api.RequestHeader](#bosdyn-api-RequestHeader)) - Required - Common request header. - **pause_time** ([google.protobuf.Timestamp](#google-protobuf-Timestamp)) - Required - Run the mission until this time. Pause the mission at that time if we have not received a new PlayMissionRequest. This ensures the mission stops relatively quickly if there is an unexpected client drop-out. Clients should regularly send PlayMissionRequests with a pause_time that reflects how often they expect to check in with the mission service. - **leases** ([bosdyn.api.Lease](#bosdyn-api-Lease)) - Required - Leases that the mission will need, plus the lease on the mission service. - **settings** ([PlaySettings](#bosdyn-api-mission-PlaySettings)) - Required - Settings active until the next PlayMission or RestartMission request. ## PlayMissionResponse The PlayMission response message will return the status of the play mission request. ### Parameters #### Response Body - **header** ([bosdyn.api.ResponseHeader](#bosdyn-api-ResponseHeader)) - Required - Common response header. - **status** ([PlayMissionResponse.Status](#bosdyn-api-mission-PlayMissionResponse-Status)) - Required - The result of the play request. - **lease_use_results** ([bosdyn.api.LeaseUseResult](#bosdyn-api-LeaseUseResult)) - Required - Results from any leases that may have been provided with the play request. ## PlaySettings "Global" settings to use while a mission is running. Some of these settings are not globally applicable. For example, the velocity_limit does not change the speed at which the robot poses the body. ### Parameters #### Request Body - **velocity_limit** ([bosdyn.api.SE2VelocityLimit](#bosdyn-api-SE2VelocityLimit)) - Optional - Velocity limits on the robot motion. Example use: limit velocity in "navigate to" nodes. - **disable_directed_exploration** ([bool](#bool)) - Optional - Disable directed exploration to bypass blocked path sections - **disable_alternate_route_finding** ([bool](#bool)) - Optional - Disable alternate-route-finding; overrides the per-edge setting in the map. - **path_following_mode** ([bosdyn.api.graph_nav.Edge.Annotations.PathFollowingMode](#bosdyn-api-graph_nav-Edge-Annotations-PathFollowingMode)) - Optional - Specifies whether to use default or strict path following mode. - **ground_clutter_mode** ([bosdyn.api.graph_nav.Edge.Annotations.GroundClutterAvoidanceMode](#bosdyn-api-graph_nav-Edge-Annotations-GroundClutterAvoidanceMode)) - Optional - Specify whether or not to enable ground clutter avoidance, and which type. - **planner_mode** ([bosdyn.api.graph_nav.TravelParams.PathPlannerMode](#bosdyn-api-graph_nav-TravelParams-PathPlannerMode)) - Optional - Specify the path planner mode. ``` -------------------------------- ### FanPowerCommandFeedbackRequest Source: https://github.com/boston-dynamics/spot-sdk/blob/master/protos/bosdyn/api/proto_reference.md Request to get feedback for a specific fan power command. ```APIDOC ## FanPowerCommandFeedbackRequest ### Description Request to get feedback for a specific fan power command. ### Fields - **header** ([RequestHeader](#bosdyn-api-RequestHeader)) - Common request header. - **command_id** ([uint32](#uint32)) - Unique identifier for the command of which feedback is desired. ``` -------------------------------- ### PowerCommandFeedbackRequest Source: https://github.com/boston-dynamics/spot-sdk/blob/master/protos/bosdyn/api/proto_reference.md Request to get feedback for a specific power command. ```APIDOC ## PowerCommandFeedbackRequest ### Description Request to get feedback for a specific power command. ### Fields - **header** ([RequestHeader](#bosdyn-api-RequestHeader)) - Common request header. - **power_command_id** ([uint32](#uint32)) - Unique identifier for the command of which feedback is desired. ``` -------------------------------- ### Run Hello Spot Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/python/examples/hello_spot/README.md Execute the 'hello_spot.py' script, providing the robot's IP address as an argument. ```bash python3 hello_spot.py ROBOT_IP ``` -------------------------------- ### Run Get World Objects Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/get_world_objects/README.html Execute the Python script to get world objects, providing the robot's IP address as an argument. ```bash python3 get_world_objects.py ROBOT_IP ``` -------------------------------- ### Start Local Hello World Client Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/remote_mission_service/README.html Connect to the local hello world service using the client. Ensure the port matches the server's port. ```python python3 remote_mission_client.py --hello-world local --host-ip localhost --port {PORT} ``` -------------------------------- ### StartConcurrentLog Source: https://github.com/boston-dynamics/spot-sdk/blob/master/protos/bosdyn/api/proto_reference.md Starts a concurrent log. This log will capture data based on the specified event or a general log if no event is provided. It allows for specifying how long the log should be kept alive and how far back text logs should extend. ```APIDOC ## StartConcurrentLogRequest ### Description Request to start a concurrent log. ### Fields - **header** (bosdyn.api.RequestHeader) - Common request header. - **keep_alive** (google.protobuf.Duration) - How long into the future should this log end? - **past_textlog_duration** (google.protobuf.Duration) - How long into the past should text logs extend? (default 0) - **event** (bosdyn.api.Event) - Specify an event for the request. The data included in the log will be defined by this event, if the robot has data associated with the event. ## StartConcurrentLogResponse ### Description Response from starting a concurrent log. ### Fields - **header** (bosdyn.api.ResponseHeader) - Common response header. - **status** (StartConcurrentLogResponse.Status) - Response status. - **log_status** (LogStatus) - Status of the created log. - **end_time** (google.protobuf.Timestamp) - Timestamp of the end of the log, in robot time. ``` -------------------------------- ### Run the Example Script Source: https://github.com/boston-dynamics/spot-sdk/blob/master/python/examples/cloud_upload/README.md Executes the main Python script for cloud uploads from the command line. ```bash python3 cloud_upload.py ``` -------------------------------- ### Get GUID and Secret from Parsed Options Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/_modules/bosdyn/client/util.html Retrieves the GUID and secret from parsed command-line options. It prioritizes direct --guid and --secret arguments, then falls back to a credentials file specified by --payload-credentials-file. ```python def get_guid_and_secret(parsed_options): """Get the guid and secret for a payload, based on the options that were added via add_payload_credentials_arguments(). Args: parsed_options: Namespace result of parser.parse_args() Returns: Tuple of (guid, secret) Raises: OSError if the credential file cannot be read. Exception if no applicable arguments are given. """ if (hasattr(parsed_options, "guid") and parsed_options.guid) or (hasattr(parsed_options, "secret") and parsed_options.secret): return parsed_options.guid, parsed_options.secret if parsed_options.payload_credentials_file: return read_payload_credentials(parsed_options.payload_credentials_file) raise Exception('No payload credentials provided. Use --guid and --secret' ' or --payload-credentials-file. The latter in conjunction with' ' read_or_create_payload_credentials is recommended for easy' ' management of unique per-robot credentials') ``` -------------------------------- ### Run Hello Orbit Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/python/examples/orbit/hello_orbit/README.md Executes the Hello Orbit example. Set verify to False for local development to skip TLS certificate verification, but use True or a CA bundle path for production. ```bash python3 hello_orbit.py --hostname ORBIT_IP --verify False ``` -------------------------------- ### Robot Client Setup and Initialization Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/docs/python/fetch_tutorial/fetch4.html Establishes a connection to the Spot robot, synchronizes time, and ensures necessary clients (NetworkCompute, RobotState, RobotCommand, Lease, Manipulation) are available. This setup is standard for interacting with the robot's API. ```python sdk = bosdyn.client.create_standard_sdk('SpotFetchClient') sdk.register_service_client(NetworkComputeBridgeClient) robot = sdk.create_robot(options.hostname) bosdyn.client.util.authenticate(robot) # Time sync is necessary so that time-based filter requests can be converted robot.time_sync.wait_for_sync() network_compute_client = robot.ensure_client( NetworkComputeBridgeClient.default_service_name) robot_state_client = robot.ensure_client( RobotStateClient.default_service_name) command_client = robot.ensure_client( RobotCommandClient.default_service_name) lease_client = robot.ensure_client(LeaseClient.default_service_name) manipulation_api_client = robot.ensure_client( ManipulationApiClient.default_service_name) ``` -------------------------------- ### Run Payload Registration Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/payloads/README.html Executes the payload registration example. Requires robot IP and a filename for storing payload credentials. Unique GUIDs and secrets are persisted for each robot. ```bash python3 payloads.py ROBOT_IP --payload-credentials-file-1 --payload-credentials-file-2 ``` -------------------------------- ### Activate Virtual Environment and Run Hello Spot Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/python/fetch_tutorial/fetch1.md Activate your Python virtual environment and run the 'hello_spot.py' script to ensure your Spot SDK is set up correctly. This is a prerequisite for the tutorial. ```bash source my_spot_env/bin/activate # enter your virtualenv cd ~/spot-sdk/python/examples/hello_spot # or wherever you installed Spot SDK python3 hello_spot.py 192.168.80.3 ``` -------------------------------- ### Create SDK and Robot Objects Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/python/daq_tutorial/daq2.md Initializes the Spot SDK and creates a robot object for communication. Ensure logging is set up beforehand. ```python setup_logging(options.verbose, include_dedup_filter=True) sdk = bosdyn.client.create_standard_sdk("ImageServiceSDK") robot = sdk.create_robot(options.hostname) ``` -------------------------------- ### Get Current File Position Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/_modules/bosdyn/bddf/block_writer.html Returns the current position in the output file from the start. ```python def tell(self): """Return location from start of file.""" return self._outfile.tell() ``` -------------------------------- ### LeaseService Source: https://github.com/boston-dynamics/spot-sdk/blob/master/protos/bosdyn/api/proto_reference.md LeaseService provides Leases of shared resources to clients. An example of a shared resource is the set of leg motors on Spot, which has the resource name of "body". Clients can delegate out the Leases they receive from the LeaseService to additional clients or services by generating sub-leases. Leases obtained from the LeaseService may be revoked if the Lease holder does not check in frequently to the LeaseService, or if another client force-acquires a Lease. ```APIDOC ## AcquireLease ### Description Acquire a lease to a specific resource if the resource is available. ### Method AcquireLease ### Request Type [AcquireLeaseRequest](#bosdyn-api-AcquireLeaseRequest) ### Response Type [AcquireLeaseResponse](#bosdyn-api-AcquireLeaseResponse) ``` ```APIDOC ## TakeLease ### Description Take a lease for a specific resource even if another client has a lease. ### Method TakeLease ### Request Type [TakeLeaseRequest](#bosdyn-api-TakeLeaseRequest) ### Response Type [TakeLeaseResponse](#bosdyn-api-TakeLeaseResponse) ``` ```APIDOC ## ReturnLease ### Description Return a lease to the LeaseService. ### Method ReturnLease ### Request Type [ReturnLeaseRequest](#bosdyn-api-ReturnLeaseRequest) ### Response Type [ReturnLeaseResponse](#bosdyn-api-ReturnLeaseResponse) ``` ```APIDOC ## ListLeases ### Description List state of all leases managed by the LeaseService. ### Method ListLeases ### Request Type [ListLeasesRequest](#bosdyn-api-ListLeasesRequest) ### Response Type [ListLeasesResponse](#bosdyn-api-ListLeasesResponse) ``` ```APIDOC ## RetainLease ### Description Retain possession of a lease. ### Method RetainLease ### Request Type [RetainLeaseRequest](#bosdyn-api-RetainLeaseRequest) ### Response Type [RetainLeaseResponse](#bosdyn-api-RetainLeaseResponse) ``` -------------------------------- ### Initialize Audio Client Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/_modules/bosdyn/client/spot_cam/audio.html Instantiate the AudioClient to interact with the Spot CAM Audio service. ```python from bosdyn.client.spot_cam import audio # Assuming 'sdk' is an initialized SDK object client = audio.AudioClient() ``` -------------------------------- ### Initialize Spot SDK and Image Client Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/docs/python/fetch_tutorial/fetch1.html Initializes the Spot SDK, creates a robot object, authenticates, synchronizes time, and ensures the ImageClient is available. ```python # Create robot object with an image client. sdk = bosdyn.client.create_standard_sdk('image_capture') robot = sdk.create_robot(options.hostname) bosdyn.client.util.authenticate(robot) robot.sync_with_directory() robot.time_sync.wait_for_sync() image_client = robot.ensure_client(ImageClient.default_service_name) ``` -------------------------------- ### Run GPIO Example with 5V Rail Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/python/examples/core_io_gpio/README.html This command runs the GPIO example script to trigger the 5V voltage rail for a specified duration. Ensure the script is executable and dependencies are installed. ```bash python3.10 gpio_example.py --voltage 5 --duration 10 ``` -------------------------------- ### Get Mission State Example Source: https://github.com/boston-dynamics/spot-sdk/blob/master/docs/html/README.html Fetches the current status of any active mission the robot is executing. ```python import bosdyn.client from bosdyn.client.lease import LeaseKeepAlive from bosdyn.client.mission import MissionClient from bosdyn.client.util import setup_logging def main(): setup_logging(verbose=True) # Create robot object with an IP address sdk = bosdyn.client.create_standard_sdk('get_mission_state_client') robot = sdk.create_robot('192.168.80.3') # Authenticate robot.authenticate('user', 'password') # Establish a lease keep-alive lease_keep_alive = LeaseKeepAlive(robot.time_sync.get_time().source) # Get mission client mission_client = robot.ensure_client(MissionClient.default_service_name) # Get mission state mission_state = mission_client.get_mission_state() # Print mission status print(f'Mission state: {mission_state.state}') # Clean up the lease keep-alive lease_keep_alive.shutdown() if __name__ == '__main__': main() ```