CINXE.COM

bosdyn.client.data_buffer — Spot 4.1.0 documentation

<!DOCTYPE html> <html class="writer-html5" lang="en" > <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>bosdyn.client.data_buffer &mdash; Spot 4.1.0 documentation</title> <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../../../_static/style.css" type="text/css" /> <link rel="shortcut icon" href="../../../_static/bd-favicon.png"/> <link rel="canonical" href="https://dev.bostondynamics.com/_modules/bosdyn/client/data_buffer.html" /> <!--[if lt IE 9]> <script src="../../../_static/js/html5shiv.min.js"></script> <![endif]--> <script src="../../../_static/jquery.js"></script> <script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script> <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script> <script src="../../../_static/doctools.js"></script> <script src="../../../_static/sphinx_highlight.js"></script> <script src="../../../_static/js/theme.js"></script> <link rel="index" title="Index" href="../../../genindex.html" /> <link rel="search" title="Search" href="../../../search.html" /> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-7602095-5"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-7602095-5'); </script>X-Content-Type-Options: nosniff<script type="text/javascript" src="//script.crazyegg.com/pages/scripts/0096/9626.js" async="async"></script></head> <body class="wy-body-for-nav"> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-scroll"> <div class="wy-side-nav-search" > <a href='/readme'> <img src="../../../_static/bd-official-white.png" class="logo" alt="Logo"/> </a> <div class="version"> 4.1.0 </div> <div role="search"> <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get"> <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> <ul> <li class="toctree-l1"><a class='reference internal' href='/docs/concepts/readme'>Concepts</a><ul> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/about_spot'>About Spot</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/orbit/about_orbit'>About Orbit (formerly Scout)</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/orbit/orbit_api'>Orbit API</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/networking'>Networking</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/base_services'>Base services</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/geometry_and_frames'>Geometry and Frames</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/robot_services'>Robot services</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/estop_service'>E-Stop</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/keepalive_service'>KeepAlive (BETA)</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/lease_service'>Lease</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/developing_api_services'>Developing API Services</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/service_customization'>Service Customization</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/faults'>Faults</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/autonomy/readme'>Autonomy services</a><ul> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/graphnav_tech_summary'>Autonomy Technical Summary</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/autonomous_navigation_code_examples'>Autonomous navigation code examples</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/components_of_autonomous_navigation'>Components of autonomous navigation</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/docking'>Docking</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/typical_autonomous_navigation_use_case'>Typical autonomous navigation use case</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/autonomous_navigation_services'>Autonomous navigation services</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/graphnav_service'>GraphNav service</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/graphnav_map_structure'>GraphNav map structure</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/graphnav_area_callbacks'>GraphNav area callbacks</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/initialization'>Initialization</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/localization'>Localization</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/graphnav_and_robot_locomotion'>GraphNav and robot locomotion</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/missions_service'>Missions service</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/autowalk_service'>Autowalk service</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/network_compute_bridge'>Network compute bridge</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/auto_return'>AutoReturn service</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/directed_exploration'>Directed Exploration</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/autonomy/gps'>GPS</a></li> </ul> </li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/choreography/readme'>Choreography</a><ul> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/choreography/choreography_service'>Choreography Service</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/choreography/move_reference'>Move Reference Guide</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/choreography/custom_gait'>CustomGait Reference</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/choreography/choreographer_setup'>Choreographer Setup</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/choreography/choreographer'>Choreographer Overview</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/choreography/robot_controls_in_choreographer'>Robot Connections in Choreographer</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/choreography/animations_in_choreographer'>Animations in Choreography</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/choreography/animation_file_specification'>Animation File Format</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/choreography/choreography_in_tablet'>Tablet Choreography Mode</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/choreography/choreography_in_autowalk'>Choreography Actions in Autowalk</a></li> </ul> </li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/joint_control/readme'>Joint Control API</a><ul> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/joint_control/supplemental_data'>Supplemental Robot Information</a><ul> <li class="toctree-l4"><a class='reference internal' href='/docs/concepts/joint_control/knee_torque_limits'>Knee Torque Limits</a></li> </ul> </li> </ul> </li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/arm/readme'>Spot Arm</a><ul> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/arm/arm_specification'>Arm and Gripper Specification</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/arm/arm_concepts'>Concepts</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/arm/arm_services'>Services</a></li> </ul> </li> <li class="toctree-l2"><a class='reference internal' href='/docs/concepts/data'>Spot Data</a><ul> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/data_acquisition_overview'>Data Acquisition Overview</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/data_acquisition_output'>Data Acquisition Output</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/writing_services_for_data_acquisition'>Integrate Payloads with the API</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/data_buffer_overview'>Data Buffer Overview</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/bddf'>BDDF File Format</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/concepts/data_acquisition_thermal_raw'>Thermal Raw Data Format</a></li> </ul> </li> </ul> </li> <li class="toctree-l1"><a class='reference internal' href='/docs/python/readme'>Python</a><ul> <li class="toctree-l2"><a class='reference internal' href='/docs/python/quickstart'>Quickstart</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/python/understanding_spot_programming'>Understanding Spot Programming</a></li> <li class="toctree-l2"><a class='reference internal' href='/python/examples/readme'>Examples</a><ul> <li class="toctree-l3"><a class='reference internal' href='/python/examples/docs/basic_service_examples'>Basic Service Examples</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/examples/hello_spot/readme'>Hello Spot</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/directory/readme'>Directory</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/get_robot_state/readme'>Get Robot State</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/get_robot_state_async/readme'>Get Robot State Async</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/get_image/readme'>Get Image</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/get_world_objects/readme'>Get World Objects</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/get_mission_state/readme'>Get Mission State</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/estop/readme'>E-Stop</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/time_sync/readme'>Time Sync</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/comms_test/readme'>Comms Test</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/disable_ir_emission/readme'>IR Enable/Disable</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/reset_safety_stop/readme'>Reset Safety Stop</a></li> </ul> </li> <li class="toctree-l3"><a class='reference internal' href='/python/examples/docs/robot_behavior_examples'>Robot Behavior and Commands Examples</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/examples/stance/readme'>Stance</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/frame_trajectory_command/readme'>Frame Trajectory</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/spot_light/readme'>Spot Light</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/upload_choreographed_sequence/readme'>Upload Choreographed Sequence</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/xbox_controller/readme'>Xbox Controller</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/wasd/readme'>WASD</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/docking/readme'>Docking</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/animation_recorder/readme'>Animation Recorder</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/auto_return/readme'>Auto Return</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/fan_command/readme'>Fan Commands</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_wasd/readme'>ARM WASD</a></li> </ul> </li> <li class="toctree-l3"><a class='reference internal' href='/python/examples/docs/arm_examples'>Arm Command Examples</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_simple/readme'>Simple Arm Motion</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_stow_unstow/readme'>Stow/unstow Arm</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_freeze/readme'>Arm Freeze</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_and_mobility_command/readme'>Arm and Mobility Command</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_with_body_follow/readme'>Arm Command with Body Following</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_constrained_manipulation/readme'>Arm Constrained Manipulation</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_trajectory/readme'>Arm Trajectory</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_trajectory/readme#long-trajectory'>Long Trajectory</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_joint_move/readme'>Arm Joint Move Command</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_force_control/readme'>Arm Force Control Command</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_grasp/readme'>Arm Grasp Command</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_grasp_carry_overrides/readme'>Arm Grasp and Carry Overrides</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_gaze/readme'>Arm Gaze Command</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_surface_contact/readme'>Arm Command with Surface Contact</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_door/readme'>Arm Door Opening Command</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_walk_to_object/readme'>Walk to And Pick Up Object</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_gcode/readme'>Writing Gcode</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/gripper_camera_params/readme'>Gripper Camera Parameters</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_impedance_control/readme'>Arm Impedance Control</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/inverse_kinematics/readme'>Inverse Kinematics</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/arm_wasd/readme'>Arm WASD</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/joint_control/readme'>Wiggle Arm</a></li> </ul> </li> <li class="toctree-l3"><a class='reference internal' href='/python/examples/docs/payloads_examples'>Payloads and Registration Examples</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/examples/payloads/readme'>Payloads</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/self_registration/readme'>Self Registration</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/service_faults/readme'>Faults</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/velodyne_client/readme'>Velodyne</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/core_io_gpio/readme'>CORE I/O GPIO</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/metrics_over_coreio/readme'>Overview</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/metrics_over_coreio/readme#usage'>Usage</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/metrics_over_coreio/readme#components'>Components</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/metrics_over_coreio/readme#recommended-debugging'>Recommended debugging</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/extensions/readme'>Extensions</a></li> </ul> </li> <li class="toctree-l3"><a class='reference internal' href='/python/examples/docs/perception_world_objects_examples'>Perception and World Objects Examples</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/examples/get_image/readme'>Get Image</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/get_world_objects/readme'>Get World Objects</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/world_object_with_image_coordinates/readme'>World Object With Image Coordinates</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/world_object_mutations/readme'>World Object Mutations</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/visualizer/readme'>Visualizer</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/ricoh_theta/readme'>Ricoh Theta</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/gripper_camera_params/readme'>Gripper Camera Parameters</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/spot_cam/readme'>Spot CAM Services</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/spot_cam/readme#spot-cam-video-core-io-extension-example'>Spot Cam Video Core IO Extension Example</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/stitch_front_images/readme'>Stitch Front Images</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/get_depth_plus_visual_image/readme'>Project Depth Data on Visual Images</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/service_customization/custom_parameter_image_server/readme'>Custom Parameter Image Server</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/fiducial_follow/readme'>Fiducial Follow</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/spot_tensorflow_detector/readme'>Tensorflow Detector</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/service_customization/custom_parameter_ncb_worker/readme'>Custom Parameter Tensorflow Detector</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/network_compute_bridge/readme'>Machine Learning with the Network Compute Bridge</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/network_compute_bridge/fire_extinguisher_server/readme'>Fire Extinguisher Detector with the Network Compute Bridge</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/ray_cast/readme'>Ray Cast</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/user_nogo_regions/readme'>No-Go Regions</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/gps_service/readme'>GPS</a></li> </ul> </li> <li class="toctree-l3"><a class='reference internal' href='/python/examples/docs/logging_examples'>Logging Examples</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/examples/bddf_download/readme'>BDDF Download</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/data_buffer/readme'>Data Buffer</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/data_service/readme'>Data Service</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/logging/readme'>Logging</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/log_status/readme'>Log Status</a></li> </ul> </li> <li class="toctree-l3"><a class='reference internal' href='/python/examples/docs/data_acquisition_examples'>Data Acquisition Examples</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/examples/data_acquisition_service/readme'>Data Acquisition Service</a><ul> <li class="toctree-l5"><a class='reference internal' href='/python/examples/data_acquisition_service/signals_coreio_modem_plugin/readme'>Modem Signals</a></li> </ul> </li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/service_faults/readme'>Faults</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/ricoh_theta/readme'>Ricoh Theta</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/service_customization/custom_parameter_image_server/readme'>Custom Parameter Image Service</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/service_customization/custom_parameters_data_acquisition/readme'>Custom Parameter Data Acquisition Plugin</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/get_image/readme'>Test Image Service Implementation with Get Image</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/post_docking_callbacks/readme'>Post Docking Callbacks</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/cloud_upload/readme'>Cloud Upload</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/comms_mapping/readme'>Comms image service</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/comms_mapping/readme#how-to-use'>How to use</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/data_acquisition_service/signals_coreio_modem_plugin/readme'>CoreIO Modem Signals Plugin</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/tester_programs/readme'>Tester Programs</a></li> </ul> </li> <li class="toctree-l3"><a class='reference internal' href='/python/examples/docs/autonomy_and_missions_examples'>Autonomy and Missions Examples</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/examples/graph_nav_anchoring_optimization/readme'>Graph Nav Anchoring Optimization</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/graph_nav_command_line/readme'>GraphNav and Recording Service Command Line Interfaces</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/graph_nav_command_line/readme#example-programs'>Example Programs</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/graph_nav_extract_point_cloud/readme'>Graph Nav Extract Point Cloud</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/graph_nav_view_map/readme'>Graph Nav View Map</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/graph_nav_view_gps/readme'>Graph Nav View GPS Data</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/get_mission_state/readme'>Get Mission State</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/remote_mission_service/readme'>Remote Mission Service</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/mission_question_answerer/readme'>Mission Question Answerer</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/mission_recorder/readme'>Mission Recorder</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/replay_mission/readme'>Replay Mission</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/post_docking_callbacks/readme'>Post Docking Callbacks</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/area_callback/readme'>Area Callbacks</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/edit_autowalk/readme'>Edit Autowalk</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/record_autowalk/readme'>Record Autowalk</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/extract_images_from_walk/readme'>Extract Images from Autowalk</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/network_request_callback/readme'>Network Request Callback</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/network_request_callback/readme#id1'>Network Request Callback</a></li> </ul> </li> <li class="toctree-l3"><a class='reference internal' href='/python/examples/docs/joint_control_examples'>Joint Control API Examples</a></li> <li class="toctree-l3"><a class='reference internal' href='/python/examples/docs/orbit'>Orbit</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/examples/orbit/hello_orbit/readme'>Hello Orbit</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/orbit/export_run_archives/readme'>Export Run Archives</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/orbit/export_site_walk_archives/readme'>Export Sitewalk Archives</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/orbit/anomalies/readme'>Anomalies</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/orbit/schedule_mission/readme'>Schedule Mission</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/orbit/runs_response/readme'>Runs Response</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/orbit/send_robot_back_to_dock/readme'>Return to Dock</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/orbit/toggle_mission_based_on_weather/readme'>Mission Toggle</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/orbit/webhook/readme'>Webhook</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/orbit/backups/readme'>Backups</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/orbit/webhook_integration/readme'>Webhook Integrations</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/examples/orbit/webhook_integration/readme#example-overview'>Example Overview</a></li> </ul> </li> </ul> </li> <li class="toctree-l2"><a class='reference internal' href='/python/readme'>Python Reference Guide</a><ul> <li class="toctree-l3"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/readme'>Client</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/area_callback'>Area Callback</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/area_callback_region_handler_base'>Area Callback Region Handler</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/area_callback_service_runner'>Area Callback Service Runner</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/area_callback_service_servicer'>Area Callback Servicer</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/area_callback_service_utils'>Area Callback Service Utils</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/arm_surface_contact'>Arm Surface Contact</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/async_tasks'>Async Tasks</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/auth'>Auth</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/auto_return'>Auto Return</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/autowalk'>Autowalk</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/bddf'>BDDF</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/bddf_download'>BDDF Download</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/channel'>Channel</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/command_line'>Command</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/common'>Common</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/data_acquisition'>Data Acquisition</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/data_acquisition_helpers'>Data Acquisition Helpers</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/data_acquisition_plugin'>Data Acquisition Plugin</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/data_acquisition_plugin_service'>Data Acquisition Plugin Service</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/data_acquisition_store'>Data Acquisition Store</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/data_buffer'>Data Buffer</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/data_chunk'>Data Chunk</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/data_service'>Data Service</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/directory_registration'>Directory Registration</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/directory'>Directory</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/docking'>Docking</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/door'>Door</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/estop'>E-Stop</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/exceptions'>Exceptions</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/fault'>Fault</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/frame_helpers'>Frame Helpers</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/graph_nav'>Graph Nav</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/gripper_camera_param'>Gripper Camera Params</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/gps/readme'>GPS</a><ul> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/gps/aggregator_client'>Aggregator Client</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/gps/gps_listener'>GPS Listener</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/gps/nmeaparser'>NMEA Parser</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/gps/registration_client'>Registration Client</a></li> </ul> </li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/image'>Image</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/image_service_helpers'>Image Service Helpers</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/inverse_kinematics'>Inverse Kinematics</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/ir_enable_disable'>IR Enable/Disable</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/keepalive'>Keep Alive</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/lease'>Lease</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/lease_resource_hierarchy'>Lease Resource Hierarchy</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/lease_validator'>Lease Validator</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/license'>License</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/local_grid'>Local Grid</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/log_status'>Log Status</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/math_helpers'>Math Helpers</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/manipulation_api_client'>Manipulation API</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/map_processing'>Map Processing</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/metrics_logging'>Metrics Logging</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/network_compute_bridge_client'>Network Compute Bridge</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/payload_registration'>Payload Registration</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/payload'>Payload</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/point_cloud'>Point Cloud</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/power'>Power</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/processors'>Processors</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/ray_cast'>Ray casting</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/recording'>Recording</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/robot_command'>Robot Command</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/robot_id'>Robot ID</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/robot'>Robot</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/robot_state'>Robot State</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/sdk'>SDK</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/server_util'>Server Util</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/service_customization_helpers'>Service Customization Helpers</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/signals_helpers'>Signals Helpers</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/spot_cam/readme'>Spot CAM</a><ul> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/spot_cam/audio'>Audio</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/spot_cam/compositor'>Compositor</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/spot_cam/health'>Health</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/spot_cam/lighting'>Lighting</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/spot_cam/lights_helper'>Lights Helper</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/spot_cam/media_log'>Media Log</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/spot_cam/network'>Network</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/spot_cam/power'>Power</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/spot_cam/ptz'>PTZ</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/spot_cam/streamquality'>Stream Quality</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/spot_cam/version'>Version</a></li> </ul> </li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/spot_check'>Spot Check</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/time_sync'>Time Sync</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/token_cache'>Token Cache</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/token_manager'>Token Manager</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/units_helpers'>Units Helpers</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/util'>Util</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-client/src/bosdyn/client/world_object'>World Object</a></li> </ul> </li> <li class="toctree-l3"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/readme'>Core</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/readme'>BDDF</a><ul> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/base_data_reader'>Base Data Reader</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/block_writer'>Block Writer</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/bosdyn'>BDDF Conventions</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/common'>Common</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/data_reader'>Data Reader</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/data_writer'>Data Writer</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/file_indexer'>File Indexer</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/grpc_proto_reader'>GRPC Proto Reader</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/grpc_reader'>GRPC Reader</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/grpc_service_reader'>GRPC Service Reader</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/grpc_service_writer'>GRPC Service Writer</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/message_reader'>Message Reader</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/pod_series_reader'>POD Series Reader</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/pod_series_writer'>POD Series Writer</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/protobuf_channel_reader'>Protobuf Channel Reader</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/protobuf_reader'>Protobuf Reader</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/protobuf_series_writer'>Protobuf Series Writer</a></li> <li class="toctree-l5"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/bddf/stream_data_reader'>Stream Data Reader</a></li> </ul> </li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/geometry'>Geometry</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/util'>Util</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-core/src/bosdyn/deprecated'>Deprecated</a></li> </ul> </li> <li class="toctree-l3"><a class='reference internal' href='/python/bosdyn-mission/src/bosdyn/mission/readme'>Mission</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-mission/src/bosdyn/mission/client'>Client</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-mission/src/bosdyn/mission/constants'>Constants</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-mission/src/bosdyn/mission/exceptions'>Exceptions</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-mission/src/bosdyn/mission/remote_client'>Remote Client</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-mission/src/bosdyn/mission/server_util'>Server Util</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-mission/src/bosdyn/mission/util'>Util</a></li> </ul> </li> <li class="toctree-l3"><a class='reference internal' href='/python/bosdyn-choreography-client/src/bosdyn/choreography/client/readme'>Choreography</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-choreography-client/src/bosdyn/choreography/client/choreography'>Choreography</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-choreography-client/src/bosdyn/choreography/client/animation_file_to_proto'>Animation File to Proto</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-choreography-client/src/bosdyn/choreography/client/animation_file_conversion_helpers'>Animation File to Proto Helpers</a></li> </ul> </li> <li class="toctree-l3"><a class='reference internal' href='/python/bosdyn-orbit/src/bosdyn/orbit/readme'>Orbit (formerly Scout)</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-orbit/src/bosdyn/orbit/client'>Client</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-orbit/src/bosdyn/orbit/utils'>Utils</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-orbit/src/bosdyn/orbit/exceptions'>Exceptions</a></li> </ul> </li> <li class="toctree-l3"><a class='reference internal' href='/python/bosdyn-scout/src/bosdyn/scout/readme'>Scout (deprecated)</a><ul> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-scout/src/bosdyn/scout/client'>Client</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-scout/src/bosdyn/scout/utils'>Utils</a></li> <li class="toctree-l4"><a class='reference internal' href='/python/bosdyn-scout/src/bosdyn/scout/exceptions'>Exceptions</a></li> </ul> </li> </ul> </li> <li class="toctree-l2"><a class='reference internal' href='/docs/python/fetch_tutorial/fetch1'>Fetch Tutorial</a><ul> <li class="toctree-l3"><a class='reference internal' href='/docs/python/fetch_tutorial/fetch2'>Part 2: Training the Model</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/python/fetch_tutorial/fetch3'>Part 3: Evaluating the Model</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/python/fetch_tutorial/fetch4'>Part 4: Autonomous Pick Up</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/python/fetch_tutorial/fetch5'>Part 5: Detecting People and Playing Fetch</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/python/fetch_tutorial/fetch6'>Part 6: Running the model on Core IO</a></li> </ul> </li> <li class="toctree-l2"><a class='reference internal' href='/docs/python/daq_tutorial/daq1'>Data Collection Tutorial</a><ul> <li class="toctree-l3"><a class='reference internal' href='/docs/python/daq_tutorial/daq2'>Part 2: Capturing images</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/python/daq_tutorial/daq3'>Part 3: Capturing other data</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/python/daq_tutorial/daq4'>Part 4: Deploying to the CORE I/O</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/python/daq_tutorial/daq5'>Part 5: Collecting data</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/python/daq_tutorial/daq6'>Part 6: Processing collected data</a></li> </ul> </li> </ul> </li> <li class="toctree-l1"><a class='reference internal' href='/docs/payload/readme'>Payloads</a><ul> <li class="toctree-l2"><a class='reference internal' href='/docs/payload/payload_configuration_requirements'>Payload configuration requirements</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/payload/mechanical_interfaces'>Mechanical interfaces</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/payload/robot_mounting_rails'>Robot mounting rails</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/payload/guidelines_for_robust_payload_design'>Guidelines for robust payload design</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/payload/robot_electrical_interface'>Robot electrical interface</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/payload/coreio_documentation'>CORE I/O Documentation</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/payload/coreio_openvpn_extension'>CORE I/O OpenVPN Extension</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/payload/configuring_payload_software'>Configuring payload software</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/payload/docker_containers'>Dockerize payload software</a></li> <li class="toctree-l2"><a class='reference internal' href='/docs/payload/spot_core_documentation'>Pre-3.2 Spot CORE Documentation</a><ul> <li class="toctree-l3"><a class='reference internal' href='/docs/payload/spot_core_portainer'>Configuring Docker containers in SpotCORE</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/payload/spot_core_cockpit'>Spot CORE system management tool: Cockpit</a></li> <li class="toctree-l3"><a class='reference internal' href='/docs/payload/spot_core_vnc'>Spot CORE VNC</a></li> </ul> </li> </ul> </li> <li class="toctree-l1"><a class='reference internal' href='/docs/protos/readme'>API Protocol</a><ul> <li class="toctree-l2"><a class='reference internal' href='/docs/protos/style_guide'>Style Guide</a></li> <li class="toctree-l2"><a class='reference internal' href='/protos/bosdyn/api/readme'>Proto Reference Guide</a><ul> <li class="toctree-l3"><a class='reference internal' href='/protos/bosdyn/api/proto_reference'>Protos</a></li> </ul> </li> </ul> </li> <li class="toctree-l1"><a class='reference internal' href='/docs/release_notes'>Release Notes</a></li> <li class="toctree-l1"><a class="reference external" href="https://github.com/boston-dynamics/spot-sdk">SDK Repository</a></li> </ul> </div> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href='/readme'>Spot</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="Page navigation"> <ul class="wy-breadcrumbs"> <li><a aria-label='Home' class='icon icon-home' href='/readme'></a></li> <li class="breadcrumb-item"><a href='/_modules/'>Module code</a></li> <li class="breadcrumb-item active">bosdyn.client.data_buffer</li> <li class="wy-breadcrumbs-aside"> </li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div itemprop="articleBody"> <h1>Source code for bosdyn.client.data_buffer</h1><div class="highlight"><pre> <span></span><span class="c1"># Copyright (c) 2023 Boston Dynamics, Inc. All rights reserved.</span> <span class="c1">#</span> <span class="c1"># Downloading, reproducing, distributing or otherwise using the SDK Software</span> <span class="c1"># is subject to the terms and conditions of the Boston Dynamics Software</span> <span class="c1"># Development Kit License (20191101-BDSDK-SL).</span> <span class="sd">&quot;&quot;&quot;Client for the data-buffer service.</span> <span class="sd">This allows client code to log the following to the robot&#39;s data buffer: text-messages,</span> <span class="sd">operator comments, blobs, signal ticks, and protobuf messages.</span> <span class="sd">&quot;&quot;&quot;</span> <span class="kn">import</span> <span class="nn">functools</span> <span class="kn">import</span> <span class="nn">logging</span> <span class="kn">import</span> <span class="nn">sys</span> <span class="kn">import</span> <span class="nn">threading</span> <span class="kn">import</span> <span class="nn">time</span> <span class="kn">import</span> <span class="nn">traceback</span> <span class="kn">import</span> <span class="nn">uuid</span> <span class="kn">from</span> <span class="nn">google.protobuf.duration_pb2</span> <span class="kn">import</span> <span class="n">Duration</span> <span class="kn">from</span> <span class="nn">google.protobuf.timestamp_pb2</span> <span class="kn">import</span> <span class="n">Timestamp</span> <span class="kn">import</span> <span class="nn">bosdyn.api.data_buffer_pb2</span> <span class="k">as</span> <span class="nn">data_buffer_protos</span> <span class="kn">import</span> <span class="nn">bosdyn.api.data_buffer_service_pb2_grpc</span> <span class="k">as</span> <span class="nn">data_buffer_service</span> <span class="kn">from</span> <span class="nn">bosdyn</span> <span class="kn">import</span> <span class="n">util</span> <span class="k">as</span> <span class="n">core_util</span> <span class="kn">from</span> <span class="nn">bosdyn.api</span> <span class="kn">import</span> <span class="n">parameter_pb2</span> <span class="kn">from</span> <span class="nn">bosdyn.client</span> <span class="kn">import</span> <span class="n">time_sync</span> <span class="kn">from</span> <span class="nn">bosdyn.client.common</span> <span class="kn">import</span> <span class="n">BaseClient</span><span class="p">,</span> <span class="n">common_header_errors</span> <span class="kn">from</span> <span class="nn">bosdyn.client.exceptions</span> <span class="kn">import</span> <span class="n">Error</span><span class="p">,</span> <span class="n">ResponseError</span><span class="p">,</span> <span class="n">RpcError</span> <div class="viewcode-block" id="InvalidArgument"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.InvalidArgument'>[docs]</a><span class="k">class</span> <span class="nc">InvalidArgument</span><span class="p">(</span><span class="n">Error</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;A given argument could not be used.&quot;&quot;&quot;</span></div> <div class="viewcode-block" id="log_event"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.log_event'>[docs]</a><span class="k">def</span> <span class="nf">log_event</span><span class="p">(</span> <span class="c1"># pylint: disable=too-many-arguments,no-member</span> <span class="n">robot</span><span class="p">,</span> <span class="n">event_type</span><span class="p">,</span> <span class="n">level</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">start_timestamp_secs</span><span class="p">,</span> <span class="n">end_timestamp_secs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">id_str</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">parameters</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">log_preserve_hint</span><span class="o">=</span><span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">Event</span><span class="o">.</span><span class="n">LOG_PRESERVE_HINT_NORMAL</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Add an Event to the Data Buffer.</span> <span class="sd"> Args:</span> <span class="sd"> robot: A Robot object.</span> <span class="sd"> event_type (string): The type of event.</span> <span class="sd"> level (bosdyn.api.Event.Level): The relative importance of the event.</span> <span class="sd"> description (string): A human-readable description of the event.</span> <span class="sd"> start_timestamp_secs (float): Start of the event, in local time.</span> <span class="sd"> end_timestamp_secs (float): End of the event. start_timestamp_secs is used if None.</span> <span class="sd"> id_str (string): Unique id for event. A uuid is generated if None.</span> <span class="sd"> parameters ([bosdyn.api.Parameter]): Parameters to attach to the event.</span> <span class="sd"> log_preserve_hint (bosdyn.api.LogPreserveHint): Whether event should try to preserve log data.</span> <span class="sd"> &quot;&quot;&quot;</span> <span class="n">data_buffer_client</span> <span class="o">=</span> <span class="n">robot</span><span class="o">.</span><span class="n">ensure_client</span><span class="p">(</span><span class="n">DataBufferClient</span><span class="o">.</span><span class="n">default_service_name</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">id_str</span><span class="p">:</span> <span class="n">id_str</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">uuid</span><span class="o">.</span><span class="n">uuid1</span><span class="p">())</span> <span class="n">robot</span><span class="o">.</span><span class="n">time_sync</span><span class="o">.</span><span class="n">wait_for_sync</span><span class="p">()</span> <span class="n">robot_start_timestamp</span> <span class="o">=</span> <span class="n">robot</span><span class="o">.</span><span class="n">time_sync</span><span class="o">.</span><span class="n">robot_timestamp_from_local_secs</span><span class="p">(</span><span class="n">start_timestamp_secs</span><span class="p">)</span> <span class="k">if</span> <span class="n">end_timestamp_secs</span><span class="p">:</span> <span class="n">robot_end_timestamp</span> <span class="o">=</span> <span class="n">robot</span><span class="o">.</span><span class="n">time_sync</span><span class="o">.</span><span class="n">robot_timestamp_from_local_secs</span><span class="p">(</span><span class="n">end_timestamp_secs</span><span class="p">)</span> <span class="k">else</span><span class="p">:</span> <span class="n">robot_end_timestamp</span> <span class="o">=</span> <span class="n">robot_start_timestamp</span> <span class="c1"># pylint: disable=no-member</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">log_preserve_hint</span><span class="p">,</span> <span class="nb">bool</span><span class="p">):</span> <span class="k">if</span> <span class="n">log_preserve_hint</span><span class="p">:</span> <span class="n">log_preserve_hint</span> <span class="o">=</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">Event</span><span class="o">.</span><span class="n">LOG_PRESERVE_HINT_PRESERVE</span> <span class="k">else</span><span class="p">:</span> <span class="n">log_preserve_hint</span> <span class="o">=</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">Event</span><span class="o">.</span><span class="n">LOG_PRESERVE_HINT_NORMAL</span> <span class="n">event</span> <span class="o">=</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="nb">type</span><span class="o">=</span><span class="n">event_type</span><span class="p">,</span> <span class="n">description</span><span class="o">=</span><span class="n">description</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="n">robot</span><span class="o">.</span><span class="n">client_name</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">id_str</span><span class="p">,</span> <span class="n">start_time</span><span class="o">=</span><span class="n">robot_start_timestamp</span><span class="p">,</span> <span class="n">end_time</span><span class="o">=</span><span class="n">robot_end_timestamp</span><span class="p">,</span> <span class="n">level</span><span class="o">=</span><span class="n">level</span><span class="p">,</span> <span class="n">log_preserve_hint</span><span class="o">=</span><span class="n">log_preserve_hint</span><span class="p">)</span> <span class="k">if</span> <span class="n">parameters</span><span class="p">:</span> <span class="k">for</span> <span class="n">parameter</span> <span class="ow">in</span> <span class="n">parameters</span><span class="p">:</span> <span class="n">proto</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">parameters</span><span class="o">.</span><span class="n">add</span><span class="p">()</span> <span class="n">proto</span><span class="o">.</span><span class="n">CopyFrom</span><span class="p">(</span><span class="n">parameter</span><span class="p">)</span> <span class="n">data_buffer_client</span><span class="o">.</span><span class="n">add_events</span><span class="p">([</span><span class="n">event</span><span class="p">])</span></div> <div class="viewcode-block" id="make_parameter"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.make_parameter'>[docs]</a><span class="k">def</span> <span class="nf">make_parameter</span><span class="p">(</span><span class="n">label</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">units</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="n">notes</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Create a parameter proto from a label and the parameter value.&quot;&quot;&quot;</span> <span class="n">parameter</span> <span class="o">=</span> <span class="n">parameter_pb2</span><span class="o">.</span><span class="n">Parameter</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span> <span class="n">units</span><span class="o">=</span><span class="n">units</span><span class="p">,</span> <span class="n">notes</span><span class="o">=</span><span class="n">notes</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">bool</span><span class="p">):</span> <span class="n">parameter</span><span class="o">.</span><span class="n">bool_value</span> <span class="o">=</span> <span class="n">value</span> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">int</span><span class="p">):</span> <span class="n">parameter</span><span class="o">.</span><span class="n">int_value</span> <span class="o">=</span> <span class="n">value</span> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">float</span><span class="p">):</span> <span class="n">parameter</span><span class="o">.</span><span class="n">float_value</span> <span class="o">=</span> <span class="n">value</span> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Timestamp</span><span class="p">):</span> <span class="n">parameter</span><span class="o">.</span><span class="n">timestamp</span><span class="o">.</span><span class="n">CopyFrom</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Duration</span><span class="p">):</span> <span class="n">parameter</span><span class="o">.</span><span class="n">duration</span><span class="o">.</span><span class="n">CopyFrom</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> <span class="n">parameter</span><span class="o">.</span><span class="n">string_value</span> <span class="o">=</span> <span class="n">value</span> <span class="k">else</span><span class="p">:</span> <span class="k">return</span> <span class="kc">None</span> <span class="k">return</span> <span class="n">parameter</span></div> <div class="viewcode-block" id="DataBufferClient"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient'>[docs]</a><span class="k">class</span> <span class="nc">DataBufferClient</span><span class="p">(</span><span class="n">BaseClient</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;A client for adding to robot data buffer.&quot;&quot;&quot;</span> <span class="n">default_service_name</span> <span class="o">=</span> <span class="s1">&#39;data-buffer&#39;</span> <span class="n">service_type</span> <span class="o">=</span> <span class="s1">&#39;bosdyn.api.DataBufferService&#39;</span> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="nb">super</span><span class="p">(</span><span class="n">DataBufferClient</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">data_buffer_service</span><span class="o">.</span><span class="n">DataBufferServiceStub</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">log_tick_schemas</span> <span class="o">=</span> <span class="p">{}</span> <span class="bp">self</span><span class="o">.</span><span class="n">_timesync_endpoint</span> <span class="o">=</span> <span class="kc">None</span> <div class="viewcode-block" id="DataBufferClient.update_from"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.update_from'>[docs]</a> <span class="k">def</span> <span class="nf">update_from</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span> <span class="nb">super</span><span class="p">(</span><span class="n">DataBufferClient</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">update_from</span><span class="p">(</span><span class="n">other</span><span class="p">)</span> <span class="c1"># Grab a timesync endpoint if it is available.</span> <span class="k">try</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_timesync_endpoint</span> <span class="o">=</span> <span class="n">other</span><span class="o">.</span><span class="n">time_sync</span><span class="o">.</span><span class="n">endpoint</span> <span class="k">except</span> <span class="ne">AttributeError</span><span class="p">:</span> <span class="k">pass</span> <span class="c1"># other doesn&#39;t have a time_sync accessor</span></div> <div class="viewcode-block" id="DataBufferClient.add_text_messages"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.add_text_messages'>[docs]</a> <span class="k">def</span> <span class="nf">add_text_messages</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text_messages</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Log text messages to the robot.</span> <span class="sd"> Args:</span> <span class="sd"> text_messages (List[TextMessage]): Sequence of TextMessage protos.</span> <span class="sd"> Raises:</span> <span class="sd"> RpcError: Problem communicating with the robot.</span> <span class="sd"> &quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_do_add_text_messages</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">,</span> <span class="n">text_messages</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div> <div class="viewcode-block" id="DataBufferClient.add_text_messages_async"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.add_text_messages_async'>[docs]</a> <span class="k">def</span> <span class="nf">add_text_messages_async</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text_messages</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Async version of add_text_messages.&quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_do_add_text_messages</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">call_async</span><span class="p">,</span> <span class="n">text_messages</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div> <span class="k">def</span> <span class="nf">_do_add_text_messages</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">func</span><span class="p">,</span> <span class="n">text_messages</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Internal text message RPC stub call.&quot;&quot;&quot;</span> <span class="n">request</span> <span class="o">=</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">RecordTextMessagesRequest</span><span class="p">()</span> <span class="n">request</span><span class="o">.</span><span class="n">text_messages</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">text_messages</span><span class="p">)</span> <span class="k">return</span> <span class="n">func</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_stub</span><span class="o">.</span><span class="n">RecordTextMessages</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">value_from_response</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">error_from_response</span><span class="o">=</span><span class="n">common_header_errors</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <div class="viewcode-block" id="DataBufferClient.add_operator_comment"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.add_operator_comment'>[docs]</a> <span class="k">def</span> <span class="nf">add_operator_comment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">msg</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Add an operator comment to the robot log.</span> <span class="sd"> Args:</span> <span class="sd"> msg (string): Text of user comment to log.</span> <span class="sd"> robot_timestamp(google.protobuf.Timestamp): Time of messages, in *robot time*.</span> <span class="sd"> If not set, timestamp will be when the robot receives the message.</span> <span class="sd"> Raises:</span> <span class="sd"> RpcError: Problem communicating with the robot.</span> <span class="sd"> &quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_do_add_operator_comment</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">,</span> <span class="n">msg</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div> <div class="viewcode-block" id="DataBufferClient.add_operator_comment_async"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.add_operator_comment_async'>[docs]</a> <span class="k">def</span> <span class="nf">add_operator_comment_async</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">msg</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Async version of add_operator_comment.&quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_do_add_operator_comment</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">call_async</span><span class="p">,</span> <span class="n">msg</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div> <span class="k">def</span> <span class="nf">_do_add_operator_comment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">func</span><span class="p">,</span> <span class="n">msg</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Internal operator comment RPC stub call.&quot;&quot;&quot;</span> <span class="n">request</span> <span class="o">=</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">RecordOperatorCommentsRequest</span><span class="p">()</span> <span class="n">robot_timestamp</span> <span class="o">=</span> <span class="n">robot_timestamp</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">now_in_robot_basis</span><span class="p">(</span><span class="n">msg_type</span><span class="o">=</span><span class="s2">&quot;Operator Comment&quot;</span><span class="p">)</span> <span class="c1"># pylint: disable=no-member</span> <span class="n">request</span><span class="o">.</span><span class="n">operator_comments</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">timestamp</span><span class="o">=</span><span class="n">robot_timestamp</span><span class="p">)</span> <span class="k">return</span> <span class="n">func</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_stub</span><span class="o">.</span><span class="n">RecordOperatorComments</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">value_from_response</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">error_from_response</span><span class="o">=</span><span class="n">common_header_errors</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <div class="viewcode-block" id="DataBufferClient.add_blob"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.add_blob'>[docs]</a> <span class="k">def</span> <span class="nf">add_blob</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">type_id</span><span class="p">,</span> <span class="n">channel</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">write_sync</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Log blob messages to the data buffer.</span> <span class="sd"> Args:</span> <span class="sd"> data (bytes): Binary data of one blob.</span> <span class="sd"> type_id (string): Type of binary data of blob. For example, this could</span> <span class="sd"> be the full name of a protobuf message type.</span> <span class="sd"> channel (string): The name by which messages are typically queried:</span> <span class="sd"> often the same as type_id, or of the form</span> <span class="sd"> &#39;{prefix}/{type_id}&#39;.</span> <span class="sd"> robot_timestamp (google.protobuf.Timestamp): Time of messages, in *robot time*.</span> <span class="sd"> Raises:</span> <span class="sd"> RpcError: Problem communicating with the robot.</span> <span class="sd"> &quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_do_add_blob</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">type_id</span><span class="p">,</span> <span class="n">channel</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="p">,</span> <span class="n">write_sync</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div> <div class="viewcode-block" id="DataBufferClient.add_blob_async"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.add_blob_async'>[docs]</a> <span class="k">def</span> <span class="nf">add_blob_async</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">type_id</span><span class="p">,</span> <span class="n">channel</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">write_sync</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Async version of add_blob.&quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_do_add_blob</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">call_async</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">type_id</span><span class="p">,</span> <span class="n">channel</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="p">,</span> <span class="n">write_sync</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div> <span class="k">def</span> <span class="nf">_do_add_blob</span><span class="p">(</span> <span class="c1"># pylint: disable=too-many-arguments</span> <span class="bp">self</span><span class="p">,</span> <span class="n">func</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">type_id</span><span class="p">,</span> <span class="n">channel</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="p">,</span> <span class="n">write_sync</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Internal blob RPC stub call.&quot;&quot;&quot;</span> <span class="n">request</span> <span class="o">=</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">RecordDataBlobsRequest</span><span class="p">()</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">channel</span><span class="p">:</span> <span class="n">channel</span> <span class="o">=</span> <span class="n">type_id</span> <span class="n">robot_timestamp</span> <span class="o">=</span> <span class="n">robot_timestamp</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">now_in_robot_basis</span><span class="p">(</span><span class="n">msg_type</span><span class="o">=</span><span class="n">type_id</span><span class="p">)</span> <span class="n">request</span><span class="o">.</span><span class="n">blob_data</span><span class="o">.</span><span class="n">add</span><span class="p">(</span> <span class="c1"># pylint: disable=no-member</span> <span class="n">timestamp</span><span class="o">=</span><span class="n">robot_timestamp</span><span class="p">,</span> <span class="n">channel</span><span class="o">=</span><span class="n">channel</span><span class="p">,</span> <span class="n">type_id</span><span class="o">=</span><span class="n">type_id</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span> <span class="n">request</span><span class="o">.</span><span class="n">sync</span> <span class="o">=</span> <span class="n">write_sync</span> <span class="k">return</span> <span class="n">func</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_stub</span><span class="o">.</span><span class="n">RecordDataBlobs</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">value_from_response</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">error_from_response</span><span class="o">=</span><span class="n">common_header_errors</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <div class="viewcode-block" id="DataBufferClient.add_protobuf"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.add_protobuf'>[docs]</a> <span class="k">def</span> <span class="nf">add_protobuf</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">proto</span><span class="p">,</span> <span class="n">channel</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">write_sync</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Log protobuf messages to the data buffer.</span> <span class="sd"> Args:</span> <span class="sd"> proto (Protobuf message): Serializable protobuf to log.</span> <span class="sd"> channel (string): Name of channel for data. If not set defaults to proto type name.</span> <span class="sd"> robot_timestamp (google.protobuf.Timestamp): Time of proto, in *robot time*.</span> <span class="sd"> Raises:</span> <span class="sd"> RpcError: Problem communicating with the robot.</span> <span class="sd"> &quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_do_add_protobuf</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">add_blob</span><span class="p">,</span> <span class="n">proto</span><span class="p">,</span> <span class="n">channel</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="p">,</span> <span class="n">write_sync</span><span class="p">)</span></div> <div class="viewcode-block" id="DataBufferClient.add_protobuf_async"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.add_protobuf_async'>[docs]</a> <span class="k">def</span> <span class="nf">add_protobuf_async</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">proto</span><span class="p">,</span> <span class="n">channel</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">write_sync</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Async version of add_protobuf.&quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_do_add_protobuf</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">add_blob_async</span><span class="p">,</span> <span class="n">proto</span><span class="p">,</span> <span class="n">channel</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="p">,</span> <span class="n">write_sync</span><span class="p">)</span></div> <span class="k">def</span> <span class="nf">_do_add_protobuf</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">func</span><span class="p">,</span> <span class="n">proto</span><span class="p">,</span> <span class="n">channel</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="p">,</span> <span class="n">write_sync</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Internal blob stub call, serializes proto and logs as blob.&quot;&quot;&quot;</span> <span class="n">binary_data</span> <span class="o">=</span> <span class="n">proto</span><span class="o">.</span><span class="n">SerializeToString</span><span class="p">()</span> <span class="n">robot_timestamp</span> <span class="o">=</span> <span class="n">robot_timestamp</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">now_in_robot_basis</span><span class="p">(</span><span class="n">proto</span><span class="o">=</span><span class="n">proto</span><span class="p">)</span> <span class="n">type_id</span> <span class="o">=</span> <span class="n">proto</span><span class="o">.</span><span class="n">DESCRIPTOR</span><span class="o">.</span><span class="n">full_name</span> <span class="n">channel</span> <span class="o">=</span> <span class="n">channel</span> <span class="ow">or</span> <span class="n">type_id</span> <span class="k">return</span> <span class="n">func</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">binary_data</span><span class="p">,</span> <span class="n">type_id</span><span class="o">=</span><span class="n">type_id</span><span class="p">,</span> <span class="n">channel</span><span class="o">=</span><span class="n">channel</span><span class="p">,</span> <span class="n">robot_timestamp</span><span class="o">=</span><span class="n">robot_timestamp</span><span class="p">,</span> <span class="n">write_sync</span><span class="o">=</span><span class="n">write_sync</span><span class="p">)</span> <div class="viewcode-block" id="DataBufferClient.add_events"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.add_events'>[docs]</a> <span class="k">def</span> <span class="nf">add_events</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">events</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Log event messages to the robot.</span> <span class="sd"> Args:</span> <span class="sd"> events (List[Event]): Sequence of Event protos.</span> <span class="sd"> Raises:</span> <span class="sd"> RpcError: Problem communicating with the robot.</span> <span class="sd"> &quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_do_add_events</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">,</span> <span class="n">events</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div> <div class="viewcode-block" id="DataBufferClient.add_events_async"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.add_events_async'>[docs]</a> <span class="k">def</span> <span class="nf">add_events_async</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">events</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Async version of add_events.&quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_do_add_events</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">call_async</span><span class="p">,</span> <span class="n">events</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div> <span class="k">def</span> <span class="nf">_do_add_events</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">func</span><span class="p">,</span> <span class="n">events</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Internal event stub call.&quot;&quot;&quot;</span> <span class="n">request</span> <span class="o">=</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">RecordEventsRequest</span><span class="p">()</span> <span class="k">for</span> <span class="n">event</span> <span class="ow">in</span> <span class="n">events</span><span class="p">:</span> <span class="n">request</span><span class="o">.</span><span class="n">events</span><span class="o">.</span><span class="n">add</span><span class="p">()</span><span class="o">.</span><span class="n">CopyFrom</span><span class="p">(</span><span class="n">event</span><span class="p">)</span> <span class="c1"># pylint: disable=no-member</span> <span class="k">return</span> <span class="n">func</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_stub</span><span class="o">.</span><span class="n">RecordEvents</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">value_from_response</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">error_from_response</span><span class="o">=</span><span class="n">common_header_errors</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <div class="viewcode-block" id="DataBufferClient.register_signal_schema"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.register_signal_schema'>[docs]</a> <span class="k">def</span> <span class="nf">register_signal_schema</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">variables</span><span class="p">,</span> <span class="n">schema_name</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Log signal schema to the robot.</span> <span class="sd"> Args:</span> <span class="sd"> variables (List[SignalSchema.Variable]): List of SignalSchema variables</span> <span class="sd"> defining what is in tick.</span> <span class="sd"> schema_name (string): Name of schema (defined previously by client).</span> <span class="sd"> Raises:</span> <span class="sd"> RpcError: Problem communicating with the robot.</span> <span class="sd"> &quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_do_register_signal_schema</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">,</span> <span class="n">variables</span><span class="p">,</span> <span class="n">schema_name</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div> <div class="viewcode-block" id="DataBufferClient.register_signal_schema_async"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.register_signal_schema_async'>[docs]</a> <span class="k">def</span> <span class="nf">register_signal_schema_async</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">variables</span><span class="p">,</span> <span class="n">schema_name</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Async version of register_signal_schema&quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_do_register_signal_schema</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">call_async</span><span class="p">,</span> <span class="n">variables</span><span class="p">,</span> <span class="n">schema_name</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div> <span class="k">def</span> <span class="nf">_do_register_signal_schema</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">func</span><span class="p">,</span> <span class="n">variables</span><span class="p">,</span> <span class="n">schema_name</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Internal register stub call.&quot;&quot;&quot;</span> <span class="n">tick_schema</span> <span class="o">=</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">SignalSchema</span><span class="p">(</span><span class="nb">vars</span><span class="o">=</span><span class="n">variables</span><span class="p">,</span> <span class="n">schema_name</span><span class="o">=</span><span class="n">schema_name</span><span class="p">)</span> <span class="n">request</span> <span class="o">=</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">RegisterSignalSchemaRequest</span><span class="p">()</span> <span class="n">request</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">CopyFrom</span><span class="p">(</span><span class="n">tick_schema</span><span class="p">)</span> <span class="c1"># pylint: disable=no-member</span> <span class="c1"># Schemas are saved internally, according to their schema ID. We need to wait for the</span> <span class="c1"># response from the server to get the schema id. The response does not include the schema</span> <span class="c1"># itself so use a partial to process the response appropriately.</span> <span class="n">value_from_response</span> <span class="o">=</span> <span class="n">functools</span><span class="o">.</span><span class="n">partial</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_save_schema_id</span><span class="p">,</span> <span class="n">tick_schema</span><span class="p">)</span> <span class="k">return</span> <span class="n">func</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_stub</span><span class="o">.</span><span class="n">RegisterSignalSchema</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">value_from_response</span><span class="o">=</span><span class="n">value_from_response</span><span class="p">,</span> <span class="n">error_from_response</span><span class="o">=</span><span class="n">common_header_errors</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <div class="viewcode-block" id="DataBufferClient.add_signal_tick"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.add_signal_tick'>[docs]</a> <span class="k">def</span> <span class="nf">add_signal_tick</span><span class="p">(</span> <span class="c1"># pylint: disable=too-many-arguments,no-member</span> <span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">schema_id</span><span class="p">,</span> <span class="n">encoding</span><span class="o">=</span><span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">SignalTick</span><span class="o">.</span><span class="n">ENCODING_RAW</span><span class="p">,</span> <span class="n">sequence_id</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="s2">&quot;client&quot;</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Log signal data to the robot data buffer.</span> <span class="sd"> Schema should be sent before any ticks.</span> <span class="sd"> Args:</span> <span class="sd"> data (bytes): Single hunk of binary data.</span> <span class="sd"> schema_id (int): ID name of schema (obtained from a previous schema registration)</span> <span class="sd"> encoding (SignalTick.Encoding): Encoding of the data</span> <span class="sd"> sequence_id (int): Index of which sequence tick this is</span> <span class="sd"> source (string): String name representing client</span> <span class="sd"> Raises:</span> <span class="sd"> RpcError: Problem communicating with the robot.</span> <span class="sd"> LookupError: The schema_id is unknown (not previously registered by this client)</span> <span class="sd"> &quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_do_add_signal_tick</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">schema_id</span><span class="p">,</span> <span class="n">encoding</span><span class="p">,</span> <span class="n">sequence_id</span><span class="p">,</span> <span class="n">source</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div> <div class="viewcode-block" id="DataBufferClient.add_signal_tick_async"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.add_signal_tick_async'>[docs]</a> <span class="k">def</span> <span class="nf">add_signal_tick_async</span><span class="p">(</span> <span class="c1"># pylint: disable=too-many-arguments,no-member</span> <span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">schema_id</span><span class="p">,</span> <span class="n">encoding</span><span class="o">=</span><span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">SignalTick</span><span class="o">.</span><span class="n">ENCODING_RAW</span><span class="p">,</span> <span class="n">sequence_id</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="s2">&quot;client&quot;</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Async version of add_signal_tick.&quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_do_add_signal_tick</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">call_async</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">schema_id</span><span class="p">,</span> <span class="n">encoding</span><span class="p">,</span> <span class="n">sequence_id</span><span class="p">,</span> <span class="n">source</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div> <span class="k">def</span> <span class="nf">_do_add_signal_tick</span><span class="p">(</span> <span class="c1"># pylint: disable=too-many-arguments</span> <span class="bp">self</span><span class="p">,</span> <span class="n">func</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">schema_id</span><span class="p">,</span> <span class="n">encoding</span><span class="p">,</span> <span class="n">sequence_id</span><span class="p">,</span> <span class="n">source</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Internal add signal tick stub call.&quot;&quot;&quot;</span> <span class="k">if</span> <span class="n">schema_id</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">log_tick_schemas</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">LookupError</span><span class="p">(</span><span class="s1">&#39;The log tick schema id &quot;</span><span class="si">{}</span><span class="s1">&quot; is unknown&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">schema_id</span><span class="p">))</span> <span class="n">request</span> <span class="o">=</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">RecordSignalTicksRequest</span><span class="p">()</span> <span class="n">request</span><span class="o">.</span><span class="n">tick_data</span><span class="o">.</span><span class="n">add</span><span class="p">(</span> <span class="c1"># pylint: disable=no-member</span> <span class="n">sequence_id</span><span class="o">=</span><span class="n">sequence_id</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> <span class="n">schema_id</span><span class="o">=</span><span class="n">schema_id</span><span class="p">,</span> <span class="n">encoding</span><span class="o">=</span><span class="n">encoding</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span> <span class="k">return</span> <span class="n">func</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_stub</span><span class="o">.</span><span class="n">RecordSignalTicks</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">value_from_response</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">error_from_response</span><span class="o">=</span><span class="n">common_header_errors</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="k">def</span> <span class="nf">_save_schema_id</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">,</span> <span class="n">response</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Return schema id from response, after saving the schema in a dict indexed by id.&quot;&quot;&quot;</span> <span class="bp">self</span><span class="o">.</span><span class="n">log_tick_schemas</span><span class="p">[</span><span class="n">response</span><span class="o">.</span><span class="n">schema_id</span><span class="p">]</span> <span class="o">=</span> <span class="n">schema</span> <span class="k">return</span> <span class="n">response</span><span class="o">.</span><span class="n">schema_id</span> <div class="viewcode-block" id="DataBufferClient.now_in_robot_basis"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.DataBufferClient.now_in_robot_basis'>[docs]</a> <span class="k">def</span> <span class="nf">now_in_robot_basis</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">msg_type</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">proto</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Get current time in robot clock basis if possible, None otherwise.&quot;&quot;&quot;</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_timesync_endpoint</span><span class="p">:</span> <span class="k">try</span><span class="p">:</span> <span class="n">converter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_timesync_endpoint</span><span class="o">.</span><span class="n">get_robot_time_converter</span><span class="p">()</span> <span class="k">except</span> <span class="n">time_sync</span><span class="o">.</span><span class="n">NotEstablishedError</span><span class="p">:</span> <span class="c1"># No timesync. That&#39;s OK -- the receiving host will provide the timestamp.</span> <span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span> <span class="s1">&#39;Could not timestamp message of type </span><span class="si">%s</span><span class="s1">&#39;</span><span class="p">,</span> <span class="p">(</span><span class="n">msg_type</span> <span class="k">if</span> <span class="n">msg_type</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="p">(</span><span class="n">proto</span><span class="o">.</span><span class="n">DESCRIPTOR</span><span class="o">.</span><span class="n">full_name</span> <span class="k">if</span> <span class="n">proto</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="s1">&#39;Unknown&#39;</span><span class="p">)))</span> <span class="k">else</span><span class="p">:</span> <span class="k">return</span> <span class="n">converter</span><span class="o">.</span><span class="n">robot_timestamp_from_local_secs</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">())</span> <span class="k">return</span> <span class="kc">None</span></div></div> <div class="viewcode-block" id="LoggingHandler"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.LoggingHandler'>[docs]</a><span class="k">class</span> <span class="nc">LoggingHandler</span><span class="p">(</span><span class="n">logging</span><span class="o">.</span><span class="n">Handler</span><span class="p">):</span> <span class="c1"># pylint: disable=too-many-instance-attributes</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;A logging system Handler that will publish text to the data-buffer service.</span> <span class="sd"> Args:</span> <span class="sd"> service: Name of the service. See LogAnnotationTextMessage.</span> <span class="sd"> data_buffer_client: API client that will send log messages.</span> <span class="sd"> level: Python logging level. Defaults to NOTSET.</span> <span class="sd"> time_sync_endpoint: A TimeSyncEndpoint, already synchronized to the remote clock.</span> <span class="sd"> rpc_timeout: Timeout on RPCs made by data_buffer_client.</span> <span class="sd"> msg_num_limit: If number of messages reaches this number, send data with data_buffer_client.</span> <span class="sd"> msg_age_limit: If messages have been sitting locally for this many seconds, send data with</span> <span class="sd"> data_buffer_client.</span> <span class="sd"> skip_rpcs: Do not log any messages for RPC sending.</span> <span class="sd"> Raises:</span> <span class="sd"> log_annotation.InvalidArgument: The TimeSyncEndpoint is not valid.</span> <span class="sd"> &quot;&quot;&quot;</span> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> <span class="c1"># pylint: disable=too-many-arguments</span> <span class="bp">self</span><span class="p">,</span> <span class="n">service</span><span class="p">,</span> <span class="n">data_buffer_client</span><span class="p">,</span> <span class="n">level</span><span class="o">=</span><span class="n">logging</span><span class="o">.</span><span class="n">NOTSET</span><span class="p">,</span> <span class="n">time_sync_endpoint</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">rpc_timeout</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">msg_num_limit</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">msg_age_limit</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">skip_rpcs</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> <span class="n">logging</span><span class="o">.</span><span class="n">Handler</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">level</span><span class="o">=</span><span class="n">level</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">addFilter</span><span class="p">(</span><span class="n">is_not_text_log</span><span class="p">)</span> <span class="k">if</span> <span class="n">skip_rpcs</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">addFilter</span><span class="p">(</span><span class="n">is_not_rpc</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">msg_age_limit</span> <span class="o">=</span> <span class="n">msg_age_limit</span> <span class="bp">self</span><span class="o">.</span><span class="n">msg_num_limit</span> <span class="o">=</span> <span class="n">msg_num_limit</span> <span class="bp">self</span><span class="o">.</span><span class="n">rpc_timeout</span> <span class="o">=</span> <span class="n">rpc_timeout</span> <span class="bp">self</span><span class="o">.</span><span class="n">service</span> <span class="o">=</span> <span class="n">service</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_sync_endpoint</span> <span class="o">=</span> <span class="n">time_sync_endpoint</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_sync_endpoint</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_sync_endpoint</span><span class="o">.</span><span class="n">has_established_time_sync</span><span class="p">:</span> <span class="k">raise</span> <span class="n">InvalidArgument</span><span class="p">(</span><span class="s1">&#39;time_sync_endpoint must have already established timesync!&#39;</span><span class="p">)</span> <span class="c1"># If we have this many unsent messages in the queue after a failure to send,</span> <span class="c1"># &quot;dump&quot; the messages to stdout.</span> <span class="bp">self</span><span class="o">.</span><span class="n">_dump_msg_count</span> <span class="o">=</span> <span class="mi">20</span> <span class="c1"># Internal tracking of errors.</span> <span class="bp">self</span><span class="o">.</span><span class="n">_num_failed_sends</span> <span class="o">=</span> <span class="mi">0</span> <span class="bp">self</span><span class="o">.</span><span class="n">_num_failed_sends_sequential</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># If we have this many failed sends in a row, stop the send thread.</span> <span class="bp">self</span><span class="o">.</span><span class="n">_limit_failed_sends_sequential</span> <span class="o">=</span> <span class="mi">5</span> <span class="c1"># Event to trigger immediate flush of messages to the log client.</span> <span class="bp">self</span><span class="o">.</span><span class="n">_flush_event</span> <span class="o">=</span> <span class="n">threading</span><span class="o">.</span><span class="n">Event</span><span class="p">()</span> <span class="c1"># How long to wait for flush events. Dictates non-flush update rate.</span> <span class="bp">self</span><span class="o">.</span><span class="n">_flush_event_wait_time</span> <span class="o">=</span> <span class="mf">0.1</span> <span class="c1"># Last time &quot;emit&quot; was called.</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_emit_time</span> <span class="o">=</span> <span class="mi">0</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data_buffer_client</span> <span class="o">=</span> <span class="n">data_buffer_client</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lock</span> <span class="o">=</span> <span class="n">threading</span><span class="o">.</span><span class="n">Lock</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">_msg_queue</span> <span class="o">=</span> <span class="p">[]</span> <span class="bp">self</span><span class="o">.</span><span class="n">_send_thread</span> <span class="o">=</span> <span class="n">threading</span><span class="o">.</span><span class="n">Thread</span><span class="p">(</span><span class="n">target</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_run_send_thread</span><span class="p">)</span> <span class="c1"># Set to stop the message send thread.</span> <span class="bp">self</span><span class="o">.</span><span class="n">_shutdown_event</span> <span class="o">=</span> <span class="n">threading</span><span class="o">.</span><span class="n">Event</span><span class="p">()</span> <span class="c1"># This apparently needs to be a daemon thread to play nicely with python&#39;s Handler shutdown</span> <span class="c1"># procedure.</span> <span class="bp">self</span><span class="o">.</span><span class="n">_send_thread</span><span class="o">.</span><span class="n">daemon</span> <span class="o">=</span> <span class="kc">True</span> <span class="bp">self</span><span class="o">.</span><span class="n">_send_thread</span><span class="o">.</span><span class="n">start</span><span class="p">()</span> <span class="k">def</span> <span class="fm">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Optionally use this as a ContextManager to be more cautious about sending messages.&quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span> <span class="k">def</span> <span class="fm">__exit__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exc_type</span><span class="p">,</span> <span class="n">exc_val</span><span class="p">,</span> <span class="n">exc_tb</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;To ensure all messages have been sent to the best of our ability, call close().&quot;&quot;&quot;</span> <span class="bp">self</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> <div class="viewcode-block" id="LoggingHandler.emit"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.LoggingHandler.emit'>[docs]</a> <span class="k">def</span> <span class="nf">emit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">record</span><span class="p">):</span> <span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">record_to_msg</span><span class="p">(</span><span class="n">record</span><span class="p">)</span> <span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lock</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_msg_queue</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_emit_time</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span></div> <div class="viewcode-block" id="LoggingHandler.flush"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.LoggingHandler.flush'>[docs]</a> <span class="k">def</span> <span class="nf">flush</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="bp">self</span><span class="o">.</span><span class="n">_flush_event</span><span class="o">.</span><span class="n">set</span><span class="p">()</span></div> <div class="viewcode-block" id="LoggingHandler.close"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.LoggingHandler.close'>[docs]</a> <span class="k">def</span> <span class="nf">close</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="bp">self</span><span class="o">.</span><span class="n">_shutdown_event</span><span class="o">.</span><span class="n">set</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">_send_thread</span><span class="o">.</span><span class="n">join</span><span class="p">()</span> <span class="c1"># One last attempt to send any messages.</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_msg_queue</span><span class="p">:</span> <span class="k">try</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data_buffer_client</span><span class="o">.</span><span class="n">add_text_messages</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_msg_queue</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">rpc_timeout</span><span class="p">)</span> <span class="c1"># Catch all client library errors.</span> <span class="k">except</span> <span class="n">Error</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_num_failed_sends</span> <span class="o">+=</span> <span class="mi">1</span> <span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lock</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_dump_msg_queue</span><span class="p">()</span> <span class="n">logging</span><span class="o">.</span><span class="n">Handler</span><span class="o">.</span><span class="n">close</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span></div> <div class="viewcode-block" id="LoggingHandler.is_thread_alive"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.LoggingHandler.is_thread_alive'>[docs]</a> <span class="k">def</span> <span class="nf">is_thread_alive</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Return true if send-thread is running.&quot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_send_thread</span><span class="o">.</span><span class="n">is_alive</span><span class="p">()</span></div> <div class="viewcode-block" id="LoggingHandler.restart"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.LoggingHandler.restart'>[docs]</a> <span class="k">def</span> <span class="nf">restart</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_buffer_client</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Restart the send thread.</span> <span class="sd"> Raises:</span> <span class="sd"> AssertionError if send thread is still alive.</span> <span class="sd"> &quot;&quot;&quot;</span> <span class="k">assert</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_thread_alive</span><span class="p">()</span> <span class="bp">self</span><span class="o">.</span><span class="n">_num_failed_sends_sequential</span> <span class="o">=</span> <span class="mi">0</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data_buffer_client</span> <span class="o">=</span> <span class="n">data_buffer_client</span> <span class="bp">self</span><span class="o">.</span><span class="n">_send_thread</span> <span class="o">=</span> <span class="n">threading</span><span class="o">.</span><span class="n">Thread</span><span class="p">(</span><span class="n">target</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_run_send_thread</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">_send_thread</span><span class="o">.</span><span class="n">daemon</span> <span class="o">=</span> <span class="kc">True</span> <span class="bp">self</span><span class="o">.</span><span class="n">_send_thread</span><span class="o">.</span><span class="n">start</span><span class="p">()</span></div> <span class="k">def</span> <span class="nf">_dump_msg_queue</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Pop all of the message queue, using fallback_log to try and capture them.</span> <span class="sd"> Should be called with the lock held.</span> <span class="sd"> &quot;&quot;&quot;</span> <span class="bp">self</span><span class="o">.</span><span class="n">fallback_log</span><span class="p">(</span><span class="s1">&#39;Dumping </span><span class="si">{}</span><span class="s1"> messages!&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_msg_queue</span><span class="p">)))</span> <span class="k">for</span> <span class="n">msg</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_msg_queue</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">fallback_log</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">_msg_queue</span><span class="p">[:]</span> <div class="viewcode-block" id="LoggingHandler.fallback_log"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.LoggingHandler.fallback_log'>[docs]</a> <span class="nd">@staticmethod</span> <span class="k">def</span> <span class="nf">fallback_log</span><span class="p">(</span><span class="n">msg</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Handle log messages that were failed to be sent by printing to the console.&quot;&quot;&quot;</span> <span class="nb">print</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">file</span><span class="o">=</span><span class="n">sys</span><span class="o">.</span><span class="n">stderr</span><span class="p">)</span></div> <span class="k">def</span> <span class="nf">_run_send_thread</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="k">while</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_num_failed_sends_sequential</span> <span class="o">&lt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">_limit_failed_sends_sequential</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_shutdown_event</span><span class="o">.</span><span class="n">is_set</span><span class="p">()):</span> <span class="n">flush</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_flush_event</span><span class="o">.</span><span class="n">wait</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_flush_event_wait_time</span><span class="p">)</span> <span class="n">msg_age</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_emit_time</span> <span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lock</span><span class="p">:</span> <span class="n">num_msgs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_msg_queue</span><span class="p">)</span> <span class="n">to_send</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_msg_queue</span><span class="p">[:</span><span class="n">num_msgs</span><span class="p">]</span> <span class="n">send_now</span> <span class="o">=</span> <span class="n">num_msgs</span> <span class="o">&gt;=</span> <span class="mi">1</span> <span class="ow">and</span> <span class="p">(</span><span class="n">flush</span> <span class="ow">or</span> <span class="n">msg_age</span> <span class="o">&gt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">msg_age_limit</span> <span class="ow">or</span> <span class="n">num_msgs</span> <span class="o">&gt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">msg_num_limit</span><span class="p">)</span> <span class="k">if</span> <span class="n">send_now</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_flush_event</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span> <span class="n">send_errors</span> <span class="o">=</span> <span class="mi">0</span> <span class="n">error_limit</span> <span class="o">=</span> <span class="mi">2</span> <span class="n">sent</span> <span class="o">=</span> <span class="kc">False</span> <span class="k">while</span> <span class="n">send_errors</span> <span class="o">&lt;</span> <span class="n">error_limit</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_shutdown_event</span><span class="o">.</span><span class="n">is_set</span><span class="p">():</span> <span class="k">try</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data_buffer_client</span><span class="o">.</span><span class="n">add_text_messages</span><span class="p">(</span><span class="n">to_send</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">rpc_timeout</span><span class="p">)</span> <span class="k">except</span> <span class="p">(</span><span class="n">ResponseError</span><span class="p">,</span> <span class="n">RpcError</span><span class="p">):</span> <span class="bp">self</span><span class="o">.</span><span class="n">fallback_log</span><span class="p">(</span><span class="s1">&#39;Error:</span><span class="se">\n</span><span class="si">{}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">traceback</span><span class="o">.</span><span class="n">format_exc</span><span class="p">()))</span> <span class="n">send_errors</span> <span class="o">+=</span> <span class="mi">1</span> <span class="k">except</span><span class="p">:</span> <span class="c1"># pylint: disable=bare-except</span> <span class="c1"># Catch all other exceptions and log them.</span> <span class="bp">self</span><span class="o">.</span><span class="n">fallback_log</span><span class="p">(</span><span class="s1">&#39;Unexpected exception!</span><span class="se">\n</span><span class="si">{}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span> <span class="n">traceback</span><span class="o">.</span><span class="n">format_exc</span><span class="p">()))</span> <span class="k">break</span> <span class="k">else</span><span class="p">:</span> <span class="n">sent</span> <span class="o">=</span> <span class="kc">True</span> <span class="k">break</span> <span class="c1"># Default to possibly dumping messages.</span> <span class="n">maybe_dump</span> <span class="o">=</span> <span class="kc">True</span> <span class="k">if</span> <span class="n">sent</span><span class="p">:</span> <span class="c1"># We successfully sent logs to the log service! Delete relevant local cache.</span> <span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lock</span><span class="p">:</span> <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">_msg_queue</span><span class="p">[:</span><span class="n">num_msgs</span><span class="p">]</span> <span class="n">maybe_dump</span> <span class="o">=</span> <span class="kc">False</span> <span class="bp">self</span><span class="o">.</span><span class="n">_num_failed_sends_sequential</span> <span class="o">=</span> <span class="mi">0</span> <span class="k">elif</span> <span class="n">send_errors</span> <span class="o">&gt;=</span> <span class="n">error_limit</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_num_failed_sends</span> <span class="o">+=</span> <span class="mi">1</span> <span class="bp">self</span><span class="o">.</span><span class="n">_num_failed_sends_sequential</span> <span class="o">+=</span> <span class="mi">1</span> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_shutdown_event</span><span class="o">.</span><span class="n">is_set</span><span class="p">():</span> <span class="c1"># Don&#39;t dump if we&#39;re shutting down; we&#39;ll clear the messages in close().</span> <span class="n">maybe_dump</span> <span class="o">=</span> <span class="kc">False</span> <span class="k">else</span><span class="p">:</span> <span class="c1"># We can hit this state if</span> <span class="c1"># 1) We break out of the above loop without setting sent = True</span> <span class="c1"># 2) There is a logic bug in the above handling code / while loop.</span> <span class="n">function_name</span> <span class="o">=</span> <span class="n">traceback</span><span class="o">.</span><span class="n">extract_stack</span><span class="p">()[</span><span class="o">-</span><span class="mi">1</span><span class="p">][</span><span class="mi">2</span><span class="p">]</span> <span class="bp">self</span><span class="o">.</span><span class="n">fallback_log</span><span class="p">(</span><span class="s1">&#39;Unexpected condition in </span><span class="si">{}</span><span class="s1">.</span><span class="si">{}</span><span class="s1">!&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span> <span class="n">function_name</span><span class="p">))</span> <span class="c1"># If we decided we may need to dump the message queue...</span> <span class="k">if</span> <span class="n">maybe_dump</span><span class="p">:</span> <span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lock</span><span class="p">:</span> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_msg_queue</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_dump_msg_count</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_dump_msg_queue</span><span class="p">()</span> <div class="viewcode-block" id="LoggingHandler.record_to_msg"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.LoggingHandler.record_to_msg'>[docs]</a> <span class="k">def</span> <span class="nf">record_to_msg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">record</span><span class="p">:</span> <span class="n">logging</span><span class="o">.</span><span class="n">LogRecord</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Convert logging record to TextMessage proto.&quot;&quot;&quot;</span> <span class="n">level</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">record_level_to_proto_level</span><span class="p">(</span><span class="n">record</span><span class="o">.</span><span class="n">levelno</span><span class="p">)</span> <span class="n">msg</span> <span class="o">=</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">TextMessage</span><span class="p">(</span><span class="n">source</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">service</span><span class="p">,</span> <span class="n">level</span><span class="o">=</span><span class="n">level</span><span class="p">,</span> <span class="n">message</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">record</span><span class="p">),</span> <span class="n">filename</span><span class="o">=</span><span class="n">record</span><span class="o">.</span><span class="n">filename</span><span class="p">,</span> <span class="n">line_number</span><span class="o">=</span><span class="n">record</span><span class="o">.</span><span class="n">lineno</span><span class="p">)</span> <span class="c1"># pylint: disable=no-member</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_sync_endpoint</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> <span class="k">try</span><span class="p">:</span> <span class="n">msg</span><span class="o">.</span><span class="n">timestamp</span><span class="o">.</span><span class="n">CopyFrom</span><span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_sync_endpoint</span><span class="o">.</span><span class="n">robot_timestamp_from_local_secs</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()))</span> <span class="k">except</span> <span class="n">time_sync</span><span class="o">.</span><span class="n">NotEstablishedError</span><span class="p">:</span> <span class="c1"># If timestamp is not set in the proto, data-buffer will timestamp it on receipt.</span> <span class="n">msg</span><span class="o">.</span><span class="n">message</span> <span class="o">=</span> <span class="s1">&#39;(No time sync!): &#39;</span> <span class="o">+</span> <span class="n">msg</span><span class="o">.</span><span class="n">message</span> <span class="k">else</span><span class="p">:</span> <span class="n">msg</span><span class="o">.</span><span class="n">timestamp</span><span class="o">.</span><span class="n">CopyFrom</span><span class="p">(</span><span class="n">core_util</span><span class="o">.</span><span class="n">now_timestamp</span><span class="p">())</span> <span class="k">return</span> <span class="n">msg</span></div> <div class="viewcode-block" id="LoggingHandler.record_level_to_proto_level"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.LoggingHandler.record_level_to_proto_level'>[docs]</a> <span class="nd">@staticmethod</span> <span class="k">def</span> <span class="nf">record_level_to_proto_level</span><span class="p">(</span><span class="n">record_level</span><span class="p">):</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Convert logging record level to TextMessage proto level.&quot;&quot;&quot;</span> <span class="c1"># pylint: disable=no-member</span> <span class="k">if</span> <span class="n">record_level</span> <span class="o">&gt;=</span> <span class="n">logging</span><span class="o">.</span><span class="n">ERROR</span><span class="p">:</span> <span class="k">return</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">TextMessage</span><span class="o">.</span><span class="n">LEVEL_ERROR</span> <span class="k">if</span> <span class="n">record_level</span> <span class="o">&gt;=</span> <span class="n">logging</span><span class="o">.</span><span class="n">WARNING</span><span class="p">:</span> <span class="k">return</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">TextMessage</span><span class="o">.</span><span class="n">LEVEL_WARN</span> <span class="k">if</span> <span class="n">record_level</span> <span class="o">&gt;=</span> <span class="n">logging</span><span class="o">.</span><span class="n">INFO</span><span class="p">:</span> <span class="k">return</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">TextMessage</span><span class="o">.</span><span class="n">LEVEL_INFO</span> <span class="k">return</span> <span class="n">data_buffer_protos</span><span class="o">.</span><span class="n">TextMessage</span><span class="o">.</span><span class="n">LEVEL_DEBUG</span></div></div> <div class="viewcode-block" id="is_not_text_log"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.is_not_text_log'>[docs]</a><span class="k">def</span> <span class="nf">is_not_text_log</span><span class="p">(</span><span class="n">record</span><span class="p">:</span> <span class="n">logging</span><span class="o">.</span><span class="n">LogRecord</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Filter out the RecordMessages calls that the handler sends so that we do not go into an infinite loop.&quot;&quot;&quot;</span> <span class="k">return</span> <span class="ow">not</span> <span class="n">record</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s1">&#39;.DataBufferService.RecordTextMessages&#39;</span><span class="p">)</span></div> <div class="viewcode-block" id="is_not_rpc"><a class='viewcode-back' href='/python/bosdyn-client/src/bosdyn/client/data_buffer#bosdyn.client.data_buffer.is_not_rpc'>[docs]</a><span class="k">def</span> <span class="nf">is_not_rpc</span><span class="p">(</span><span class="n">record</span><span class="p">:</span> <span class="n">logging</span><span class="o">.</span><span class="n">LogRecord</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span> <span class="w"> </span><span class="sd">&quot;&quot;&quot;Because our loggers use the form sdk_name.robot_name.service_name.rpc_method, we can&#39;t easily just turn</span> <span class="sd"> off all logging for rpcs. This function identifies the rpc logging calls to be able to strip them out.&quot;&quot;&quot;</span> <span class="k">return</span> <span class="ow">not</span> <span class="p">(</span><span class="n">record</span><span class="o">.</span><span class="n">module</span> <span class="o">==</span> <span class="s1">&#39;common&#39;</span> <span class="ow">and</span> <span class="p">(</span><span class="n">record</span><span class="o">.</span><span class="n">funcName</span> <span class="o">==</span> <span class="s1">&#39;call&#39;</span> <span class="ow">or</span> <span class="n">record</span><span class="o">.</span><span class="n">funcName</span> <span class="o">==</span> <span class="s1">&#39;call_async&#39;</span><span class="p">))</span></div> </pre></div> </div> </div> <footer> <hr/> <div role="contentinfo"> <p> &copy; Copyright 2024 Boston Dynamics. All rights reserved. <a href="https://www.bostondynamics.com/privacy-policy">Privacy Policy</a> | <a href="https://www.bostondynamics.com/terms">Terms of Use</a> </p> </div> </footer> </div> </div> </section> </div> <script> jQuery(function () { SphinxRtdTheme.Navigation.enable(false); }); </script> <!-- Theme Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-XXXXXXX-1', { 'anonymize_ip': false, }); </script> <!-- Start of HubSpot Embed Code --> <script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/4845432.js"></script> <!-- End of HubSpot Embed Code --></body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10