def build_route(waypoint_id_list, edge_id_list): """ Generate the API RouteGenParams for navigation requests. Args: waypoint_id_list: List of waypoint id strings in which a route should pass through. The ids should be ordered from [start waypoint --> destination waypoint]. edge_id_list: List of the edge_id's which should be in the same ordering as the waypoint list. Returns: The API Route protobuf message. """ route = nav_pb2.Route() route.waypoint_id.extend(waypoint_id_list) route.edge_id.extend(edge_id_list) return route
def test_navigate_route_exceptions(client, service, server): make_call = lambda: client.navigate_route(nav_pb2.Route(), 2.0) cmd_id = make_call() assert cmd_id == 0 service.lease_use_result = lease_pb2.LeaseUseResult( status=lease_pb2.LeaseUseResult.STATUS_OLDER) with pytest.raises(bosdyn.client.LeaseUseError): make_call() service.lease_use_result = lease_pb2.LeaseUseResult( status=lease_pb2.LeaseUseResult.STATUS_OK) cmd_id = make_call() assert type(cmd_id) is int service.nav_route_resp.status = service.nav_route_resp.STATUS_NO_TIMESYNC with pytest.raises(bosdyn.client.graph_nav.NoTimeSyncError): make_call() service.nav_route_resp.status = service.nav_route_resp.STATUS_EXPIRED with pytest.raises(bosdyn.client.graph_nav.CommandExpiredError): make_call() service.nav_route_resp.status = service.nav_route_resp.STATUS_TOO_DISTANT with pytest.raises(bosdyn.client.graph_nav.TooDistantError): make_call() service.nav_route_resp.status = service.nav_route_resp.STATUS_ROBOT_IMPAIRED with pytest.raises(bosdyn.client.graph_nav.RobotImpairedError): make_call() service.nav_route_resp.status = service.nav_route_resp.STATUS_RECORDING with pytest.raises(bosdyn.client.graph_nav.IsRecordingError): make_call() service.nav_route_resp.status = service.nav_route_resp.STATUS_UNKNOWN_ROUTE_ELEMENTS with pytest.raises(bosdyn.client.graph_nav.UnknownRouteElementsError): make_call() #make sure the misspelled error works for backwards compatibility. with pytest.raises(bosdyn.client.graph_nav.UnkownRouteElementsError): make_call() service.nav_route_resp.status = service.nav_route_resp.STATUS_INVALID_EDGE with pytest.raises(bosdyn.client.graph_nav.InvalidEdgeError): make_call() service.nav_route_resp.status = service.nav_route_resp.STATUS_CONSTRAINT_FAULT with pytest.raises(bosdyn.client.graph_nav.ConstraintFaultError): make_call() service.nav_route_resp.status = service.nav_route_resp.STATUS_FEATURE_DESERT with pytest.raises(bosdyn.client.graph_nav.FeatureDesertError): make_call() service.nav_route_resp.status = service.nav_route_resp.STATUS_LOST with pytest.raises(bosdyn.client.graph_nav.RobotLostError): make_call() service.nav_route_resp.status = service.nav_route_resp.STATUS_NOT_LOCALIZED_TO_ROUTE with pytest.raises(bosdyn.client.graph_nav.RobotNotLocalizedToRouteError): make_call() service.nav_route_resp.status = service.nav_route_resp.STATUS_COULD_NOT_UPDATE_ROUTE with pytest.raises(bosdyn.client.graph_nav.RouteNotUpdatingError): make_call()