Area Callback Region Handler Base

exception bosdyn.client.area_callback_region_handler_base.PathBlocked[source]

Bases: Exception

The callback reports the that path/area it’s trying to traverse is blocked and the robot should take another route or action.

exception bosdyn.client.area_callback_region_handler_base.IncorrectUsage[source]

Bases: Exception

Error raised by calling a helper function incorrectly.

Raised when a call would block forever or has otherwise been used in an incorrect manner. This exception is not intended to be caught, but indicates a programming error.

exception bosdyn.client.area_callback_region_handler_base.HandlerError[source]

Bases: Exception

Error base class for errors raised from the internals of the AreaCallbackRegionHandlerBase.

This error will be raised when the shutdown_event signal is set, or can be raised by the user to signal an error. A wrapper around the run implementation will catch this exception and report back to a client a UpdateCallbackResponse error.

exception bosdyn.client.area_callback_region_handler_base.CallbackEnded[source]

Bases: HandlerError

The callback has already been stopped, via an EndCallback call.

exception bosdyn.client.area_callback_region_handler_base.CallbackTimedOutError[source]

Bases: HandlerError

The callback has already been stopped, via passing the end time. If caught, it should be re-raised to make sure the response is set correctly.

class bosdyn.client.area_callback_region_handler_base.RouteChangedResult[source]

Bases: object

Options for how the helper class should respond to a route change.

class bosdyn.client.area_callback_region_handler_base.AreaCallbackRegionHandlerBase(config: AreaCallbackServiceConfig, robot: Robot)[source]

Bases: object

Base class for implementing a AreaCallbackRegionHandler.

A AreaCallbackRegionHandler is an object responsible for running a single instance of an AreaCallback. The AreaCallbackServiceServicer will construct an AreaCallbackRegionHandler object each time GraphNav starts an Area Callback region. The servicer will execute the run() function in a thread and read update_response to send status back to the client. After EndCallback, this object will be discarded and a new AreaCallbackRegionHandlerBase will be constructed to handle the next region.

  • config – The AreaCallbackServiceConfig defining the data for the AreaCallbackInformation response.

  • robot – The Robot object used to create service clients.

begin(request: BeginCallbackRequest) <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7faeb715eb30>[source]

Validates that configuration passed to BeginCallback is valid.


request (area_callback_pb2.BeginCallbackRequest) – The BeginCallback request.


OK when configuration_data is valid.

Return type:



This function is run on a worker thread after BeginCallback is called.


This function is called after run thread has finished and client calls EndCallback.

route_changed(request: RouteChangeRequest) RouteChangedResult[source]

This function is called when Graph Nav re-routes inside the callback region. In most cases, the callback does not need to do anything for this case and can leave the default implementation

property area_callback_information: AreaCallbackInformation

Get area_callback_pb2.AreaCallbackInformation.

property config: AreaCallbackServiceConfig

Get AreaCallbackServiceConfig


Tell graph nav that it should wait at the start of the region.


Tell graph nav that it should continue on past the start of the region.


Tell graph nav that it transfer control at the start of the region.


Tell graph nav that it should wait at the end of the region.


Tell graph nav that it should continue on past the ends of the region.


Tell graph nav that it should transfer control at the end of the region.


Set the localization hint to the end of the callback region, indicating that graph nav that navigation should continue from this point. Robot control is required to set this. It should be called after walking to the end of the region, but before ceding control.


IncorrectUsage – When called without robot control.


Block waiting for the robot to pass the sublease to this callback.


HandlerError – When a shutdown is requested before a lease is received.


Check in a non-blocking way if the callback has been given a sublease.


True if the callback is now in control of the robot.

block_until_arrived_at_start() bool[source]

Block until the robot arrives at the start of the area callback. If the robot is already past the start, this will return immediately.


True if the robot is at the start, False if the robot is already beyond the start.

  • HandlerError – When a shutdown is requested before the robot reaches the start of the

  • region.


Block until the robot arrives at the end of the area callback.

  • HandlerError – When a shutdown is requested before the robot reaches the end of the

  • region.

property stage

Check the current stage of traversal in a non-blocking way.


bosdyn.api.UpdateCallbackRequest.Stage enum of the current stage of crossing the region.

safe_sleep(sleep_time_secs: float)[source]

Run impl should use this sleep function to make sure thread does not hang.


sleep_time_secs (float) – Time to sleep, in seconds.


HandlerError – When a shutdown is requested during the sleep time.


Check if callback shutdown has been requested via client call to EndCallback or passing the end time.

The run thread is responsible for checking and cleanly exiting.


HandlerError – If the thread should shut down.

property update_response

Get current UpdateCallbackResponse.


Determine if the current policy and stage mean that the callback will eventually be given control without any further action on its part


The handler finished BeginCallback and is ready to start run(). Blocking calls may now be used.

internal_set_stage(stage: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7faeb715ea70>)[source]

Update the stage via an incoming UpdateCallbackRequest.

internal_set_end_time(end_time: float)[source]

Update the end time from an incoming request.


Set Event indicating region handler has been given control. Lease is available in wallet.


Wrapper around the run function which catches exceptions and set update response.


shutdown_event (Event) – Event that signals the run thread to shut down.