|
selfdriving
|
#include <mpp/interfaces/VehicleMotionInterface.h>
Public Member Functions | |
| VehicleMotionInterface () | |
| virtual | ~VehicleMotionInterface () |
| virtual VehicleLocalizationState | get_localization ()=0 |
| virtual VehicleOdometryState | get_odometry ()=0 |
| virtual bool | motion_execute (const std::optional< CVehicleVelCmd::Ptr > &immediate, const std::optional< EnqueuedMotionCmd > &next)=0 |
| virtual bool | supports_enqeued_motions () const |
| virtual bool | enqeued_motion_pending () const |
| virtual bool | enqeued_motion_timed_out () const |
| virtual std::optional< VehicleOdometryState > | enqued_motion_last_odom_when_triggered () const |
| virtual void | stop (const STOP_TYPE stopType)=0 |
| virtual void | stop_watchdog () |
| virtual void | start_watchdog ([[maybe_unused]] const size_t periodMilliseconds) |
| virtual double | robot_time () const |
Event callbacks | |
| virtual void | on_nav_end_due_to_error () |
| Callback if current navigation ended due to some error. More... | |
| virtual void | on_nav_start () |
| Callback upon starting a new waypointsequence navigation. More... | |
| virtual void | on_nav_end () |
| Callback if navigation ended by an accepted trigger or reached the last specified waypoint. More... | |
| virtual void | on_path_seems_blocked () |
| Callback for when NavEngine cannot make progress to get increasingly closer to the final target during a certain period of time. It may indicate that the high-level path the vehicle is trying to follow is no longer valid due to a blocked way. On your user side, you could call NavEngine::cancel() and/or re-compute an alternative path and issue a new set of navigation waypoints or just report the error to the user. More... | |
| virtual void | on_apparent_collision () |
| Callback when the NavEngine predicts a collision with an obstacle and needed to issue a stop command. More... | |
| virtual void | on_waypoint_reached (const size_t waypoint_index, bool reached_skipped) |
| Callback upon reaching a waypoint in a waypoint sequeunce. Mostly used for logging. More... | |
| virtual void | on_cannot_get_closer_to_blocked_target () |
| Callback when NavEngine cannot reach a specified target location because there are obstacles at the specified target. More... | |
The virtual interface between a path follower / plan executor and a real mobile platform (vehicle, robot), regarding controlling its motion.
To enable the use of this library with a new robot, the user must define a new class derived from this virtual class and implement all pure virtual and the desired virtual methods according to the docs below.
This class does not make assumptions about the kinematic model of the robot, so it can work with either Ackermann, differential-driven or holonomic robots. It will depend on the used PTGs, so checkout each PTG documentation for the lenght and meaning of velocity commands.
Assumptions: The platform...
map, see get_localization().odom, see get_odometry().
|
inline |
|
virtual |
|
inlinevirtual |
Reimplement to return true if an enqueued motions has been received from motion_execute() and it is still waiting to be executed, or false otherwise (no action enqeued, or it was already triggered and executed).
|
inlinevirtual |
Reimplement to return true if an enqueued motions has been received from motion_execute() and it has timed out, or false otherwise (no action enqeued, or it was already triggered correctly).
|
inlinevirtual |
Reimplement to return the exact odometry value at the precise moment that the last enqueued motion was executed by the vehicle motion controller. The optional<> should be empty only if no enqueued motion has been executed yet.
|
pure virtual |
Provides access to the vehicle localization data.
The implementation should not take too much time to return, so if it might take more than ~10ms to ask the robot for the instantaneous data, it may be good enough to return the latest cached values, updated in a parallel thread.
In case of a hardware/communication error, leave valid=false in the return structure.
Implemented in mpp::MVSIM_VehicleInterface.
|
pure virtual |
Provides access to the vehicle odometry data.
The implementation should not take too much time to return, so if it might take more than ~10ms to ask the robot for the instantaneous data, it may be good enough to return the latest cached values, updated in a parallel thread.
In case of a hardware/communication error, leave valid=false in the return structure.
Implemented in mpp::MVSIM_VehicleInterface.
|
pure virtual |
Sends a motion command to the vehicle "immediate" and "next" slots.
A vehicle may accept one or more different implementation-specific CVehicleVelCmd classes.
This method resets the watchdog timer started with startWatchdog()
The vehicle should be able to execute a motion primitive ("immediate" slot) and holding a pending one ("next" slot) which will be moved to the immediate slot when a given condition holds, leaving the "next" slot free.
Possible combinations of calls to this method:
1) immediate set, next not set: replaces whatever the vehicle was doing and executes the given immediate command, dropping possible former immediate and next commands.
2) immediate set, next set: replaces both vehicle execution "slots" with the given commands.
3) immediate not set, next set: should be received by a vehicle only while there is an "immediate" motion command under execution, and the "next" slot is free. This stores a new "next" motion command, leaving the currently-executing one untouched. When the "next condition" holds true, the "next" slot will replace the "immediate" slot and "next" will be free again.
4) immediate not set, next not set: This is a "NOP" motion command, which does not change anything but let the vehicle platform know that there is someone in charge checking the path following and the way is obstacles free and safe to keep moving.
Implemented in mpp::MVSIM_VehicleInterface.
|
inlinevirtual |
Callback when the NavEngine predicts a collision with an obstacle and needed to issue a stop command.
|
inlinevirtual |
Callback when NavEngine cannot reach a specified target location because there are obstacles at the specified target.
|
inlinevirtual |
Callback if navigation ended by an accepted trigger or reached the last specified waypoint.
|
inlinevirtual |
Callback if current navigation ended due to some error.
|
inlinevirtual |
Callback upon starting a new waypointsequence navigation.
|
inlinevirtual |
Callback for when NavEngine cannot make progress to get increasingly closer to the final target during a certain period of time. It may indicate that the high-level path the vehicle is trying to follow is no longer valid due to a blocked way. On your user side, you could call NavEngine::cancel() and/or re-compute an alternative path and issue a new set of navigation waypoints or just report the error to the user.
|
inlinevirtual |
Callback upon reaching a waypoint in a waypoint sequeunce. Mostly used for logging.
| waypoint_index | index of waypoint in the sequence |
| reached_skipped | whether it was reached(true) or skipped (false) |
|
inlinevirtual |
Returns clockwall time (UNIX timestamp as double) for real robots [default], simulated time in simulators.
|
inlinevirtual |
|
pure virtual |
Stops the vehicle. Different levels of abruptness in the stop can be considered given the emergency condition or not of the command.
|
inlinevirtual |
|
inlinevirtual |
Reimplement to return true if enqueued motions are supported in motion_execute()
1.8.13