Class AbstractControllerExecution
Defined in File abstract_controller_execution.h
Inheritance Relationships
Base Type
public mbf_abstract_nav::AbstractExecutionBase(Class AbstractExecutionBase)
Class Documentation
The AbstractControllerExecution class loads and binds the controller plugin. It contains a thread running the plugin in a cycle to move the robot. An internal state is saved and will be pulled by server, to monitor controller execution. Due to a state change it wakes up all threads connected to the condition variable.
Public Types
Internal states.
Values:
Controller has been initialized successfully.
Controller has been started.
Executing the plugin.
The controller has been started without a plan.
Exceeded the maximum number of retries without a valid command.
Exceeded the patience time without a valid command.
Received an empty plan.
Received an invalid plan that the controller plugin rejected.
Received no velocity command by the plugin, in the current cycle.
Got a valid velocity command from the plugin.
The robot arrived the goal.
The controller has been canceled.
The controller has been stopped!
An internal error occurred.
The robot is stuck and ignored velocity command.
Public Functions
Constructor.
- Parameters:
name – Name of this execution
controller_ptr – Pointer to the controller plugin
robot_info – Current robot state
vel_pub – Velocity publisher
goal_pub – Current goal publisher
config – Initial configuration for this execution
Destructor.
Starts the controller, a valid plan should be given in advance.
- Returns:
false if the thread is already running, true if starting the controller succeeded!
Sets a new plan to the controller execution.
- Parameters:
plan – A vector of stamped poses.
tolerance_from_action – flag that will be set to true when the new plan (action) has tolerance
action_dist_tolerance – distance to goal tolerance specific for this new plan (action)
action_angle_tolerance – angle to goal tolerance specific for this new plan (action)
Cancel the controller execution. Normally called upon aborting the navigation. This calls the cancel method of the controller plugin. If the plugins returns true, it becomes responsible of stopping, and we will keep requesting velocity commands until it returns CANCELED. If it returns false (meaning cancel is not implemented, or that the controller defers handling it), MBF will set the cancel_ flag to true, and wait for the control loop to stop.
- Returns:
true, if the controller handles the stooping, or the control loop stops within a cycle time.
Return the current state of the controller execution. Thread communication safe.
- Returns:
current state, enum value of ControllerState
Returns the time of the last plugin call.
- Returns:
Time of the last plugin call
Returns the last velocity command calculated by the plugin. Set by setVelocityCmd method. Note that it doesn’t need to be a valid command sent to the robot, as we report also failed calls to the plugin on controller action feedback.
- Returns:
The last valid velocity command.
Checks whether the patience duration time has been exceeded, ot not.
- Returns:
true, if the patience has been exceeded.
Sets the controller frequency.
- Parameters:
frequency – The controller frequency
- Returns:
true, if the controller frequency has been changed / set succesfully, false otherwise
Is called by the server thread to reconfigure the controller execution, if a user uses dynamic reconfigure to reconfigure the current state.
- Parameters:
config – The dynamic reconfigure config.
Returns whether the robot should normally move or not. True if the controller seems to work properly.
- Returns:
true, if the robot should normally move, false otherwise
Public Static Attributes
Protected Functions
Request plugin for a new velocity command, given the current position, orientation, and velocity of the robot. We use this virtual method to give concrete implementations as move_base the chance to override it and do additional stuff, for example locking the costmap.
- Parameters:
pose – the current pose of the robot.
velocity – the current velocity of the robot.
cmd_vel – Will be filled with the velocity command to be passed to the robot base.
message – Optional more detailed outcome as a string.
- Returns:
Result code as described on ExePath action result and plugin’s header.
Sets the velocity command, to make it available for another thread.
- Parameters:
vel_cmd_stamped – current velocity command
Check if the robot is ignoring the cmd_vel longer than threshold time.
- Parameters:
cmd_vel – the latest cmd_vel being published by the controller
- Returns:
true if cmd_vel is being ignored by the robot longer than tolerance time, false otherwise
The main run method, a thread will execute this method. It contains the main controller execution loop.
Check if its safe to drive. This method gets called at every controller cycle, stopping the robot if its not. When overridden by child class, gives a chance to the specific execution implementation to stop the robot if it detects something wrong on the underlying map.
- Returns:
Always true, unless overridden by child class.
Protected Attributes
the name of the loaded plugin
The local planer to calculate the velocity command.
The current cycle start time of the last cycle run. Will by updated each cycle.
The time the controller has been started.
The time the controller responded with a success output (output < 10).
The time when the robot started ignoring velocity commands.
The maximum number of retries.
The time / duration of patience, before changing the state.
the frame of the robot, which will be used to determine its position.
the global frame the robot is controlling in.