Solves motion planning problem using Approximate Inference Control method. More...
#include <aico_solver.h>
Public Member Functions | |
AICOSolver () | |
void | Instantiate (const AICOSolverInitializer &init) override |
void | Solve (Eigen::MatrixXd &solution) override |
Solves the problem. More... | |
void | SpecifyProblem (PlanningProblemPtr pointer) override |
Binds the solver to a specific problem which must be pre-initalised. More... | |
virtual | ~AICOSolver () |
Public Member Functions inherited from exotica::MotionSolver | |
int | GetNumberOfMaxIterations () |
double | GetPlanningTime () |
PlanningProblemPtr | GetProblem () const |
void | InstantiateBase (const Initializer &init) override |
MotionSolver ()=default | |
std::string | Print (const std::string &prepend) const override |
void | SetNumberOfMaxIterations (int max_iter) |
virtual | ~MotionSolver ()=default |
Public Member Functions inherited from exotica::Object | |
std::string | GetObjectName () |
void | InstantiateObject (const Initializer &init) |
Object () | |
virtual std::string | type () const |
virtual | ~Object () |
Public Member Functions inherited from exotica::InstantiableBase | |
InstantiableBase ()=default | |
virtual | ~InstantiableBase ()=default |
Public Member Functions inherited from exotica::Instantiable< AICOSolverInitializer > | |
std::vector< Initializer > | GetAllTemplates () const override |
Initializer | GetInitializerTemplate () override |
const AICOSolverInitializer & | GetParameters () const |
void | InstantiateInternal (const Initializer &init) override |
Protected Member Functions | |
void | InitMessages () |
Initializes message data. More... | |
void | InitTrajectory (const std::vector< Eigen::VectorXd > &q_init) |
Initialise AICO messages from an initial trajectory. More... | |
Private Types | |
enum | SweepMode { FORWARD = 0, SYMMETRIC, LOCAL_GAUSS_NEWTON, LOCAL_GAUSS_NEWTON_DAMPED } |
Private Member Functions | |
double | EvaluateTrajectory (const std::vector< Eigen::VectorXd > &x, bool skip_update=false) |
Computes the cost of the trajectory. More... | |
double | GetTaskCosts (int t) |
Updates the task cost terms for time step . UnconstrainedTimeIndexedProblem::Update() has to be called before calling this function. More... | |
void | PerhapsUndoStep () |
Reverts back to previous state if the cost of the current state is higher. More... | |
void | RememberOldState () |
Stores the previous state. More... | |
double | Step () |
Compute one step of the AICO algorithm. More... | |
void | UpdateBwdMessage (int t) |
Updates the backward message at time step $t$. More... | |
void | UpdateFwdMessage (int t) |
Updates the forward message at time step $t$. More... | |
void | UpdateTaskMessage (int t, const Eigen::Ref< const Eigen::VectorXd > &qhat_t, double tolerance, double max_step_size=-1.) |
void | UpdateTimestep (int t, bool update_fwd, bool update_bwd, int max_relocation_iterations, double tolerance, bool force_relocation, double max_step_size=-1.) |
Update messages for given time step. More... | |
void | UpdateTimestepGaussNewton (int t, bool update_fwd, bool update_bwd, int max_relocation_iterations, double tolerance, double max_step_size=-1.) |
Update messages for given time step using the Gauss Newton method. More... | |
Private Attributes | |
std::vector< Eigen::VectorXd > | b |
Belief mean. More... | |
std::vector< Eigen::VectorXd > | b_old |
Belief mean (last most optimal value) More... | |
double | b_step_ = 0.0 |
Squared configuration space step. More... | |
double | b_step_old_ |
int | best_sweep_ = 0 |
int | best_sweep_old_ = 0 |
std::vector< Eigen::MatrixXd > | Binv |
Belief covariance inverse. More... | |
std::vector< Eigen::MatrixXd > | Binv_old |
Belief covariance inverse (last most optimal value) More... | |
Eigen::VectorXd | bwd_msg_v_ |
Backward message initialisation mean. More... | |
Eigen::MatrixXd | bwd_msg_Vinv_ |
Backward message initialisation covariance. More... | |
double | cost_ = 0.0 |
cost of MAP trajectory More... | |
Eigen::VectorXd | cost_control_ |
Control cost for each time step. More... | |
Eigen::VectorXd | cost_control_old_ |
Control cost for each time step (last most optimal value) More... | |
double | cost_old_ = std::numeric_limits<double>::max() |
cost of MAP trajectory (last most optimal value) More... | |
double | cost_prev_ = std::numeric_limits<double>::max() |
previous iteration cost More... | |
Eigen::VectorXd | cost_task_ |
Task cost for each task for each time step. More... | |
Eigen::MatrixXd | cost_task_old_ |
Task cost for each task for each time step (last most optimal value) More... | |
double | damping = 0.01 |
Damping. More... | |
double | damping_init_ = 0.0 |
Damping. More... | |
std::vector< Eigen::VectorXd > | damping_reference_ |
Damping reference point. More... | |
double | function_tolerance_ = 1e-5 |
Relative function tolerance/first-order optimality criterion. More... | |
int | iteration_count_ |
Iteration counter. More... | |
int | last_T_ |
T the last time InitMessages was called. More... | |
int | max_backtrack_iterations_ = 10 |
Max. number of sweeps without improvement before terminating (= line-search) More... | |
double | minimum_step_tolerance_ = 1e-5 |
Update tolerance to stop update of messages if change of maximum coefficient is less than this tolerance. More... | |
UnconstrainedTimeIndexedProblemPtr | prob_ |
Shared pointer to the planning problem. More... | |
std::vector< Eigen::VectorXd > | q |
Configuration space trajectory. More... | |
std::vector< Eigen::VectorXd > | q_old |
Configuration space trajectory (last most optimal value) More... | |
std::vector< SinglePassMeanCovariance > | q_stat_ |
Cost weighted normal distribution of configurations across sweeps. More... | |
std::vector< Eigen::VectorXd > | qhat |
Point of linearisation. More... | |
std::vector< Eigen::VectorXd > | qhat_old |
Point of linearisation (last most optimal value) More... | |
std::vector< Eigen::VectorXd > | r |
Task message mean. More... | |
std::vector< Eigen::MatrixXd > | R |
Task message covariance. More... | |
std::vector< Eigen::VectorXd > | r_old |
Task message mean (last most optimal value) More... | |
std::vector< Eigen::MatrixXd > | R_old |
Task message covariance (last most optimal value) More... | |
Eigen::VectorXd | rhat |
Task message point of linearisation. More... | |
Eigen::VectorXd | rhat_old |
Task message point of linearisation (last most optimal value) More... | |
std::vector< Eigen::VectorXd > | s |
Forward message mean. More... | |
std::vector< Eigen::VectorXd > | s_old |
Forward message mean (last most optimal value) More... | |
std::vector< Eigen::MatrixXd > | Sinv |
Forward message covariance inverse. More... | |
std::vector< Eigen::MatrixXd > | Sinv_old |
Forward message covariance inverse (last most optimal value) More... | |
double | step_tolerance_ = 1e-5 |
Relative step tolerance (termination criterion) More... | |
int | sweep_ = 0 |
Sweeps so far. More... | |
bool | sweep_improved_cost_ |
Whether the last sweep improved the cost (for backtrack iterations count) More... | |
int | sweep_mode_ = 0 |
Sweep mode. More... | |
int | update_count_ = 0 |
bool | use_bwd_msg_ = false |
Flag for using backward message initialisation. More... | |
std::vector< Eigen::VectorXd > | v |
Backward message mean. More... | |
std::vector< Eigen::VectorXd > | v_old |
Backward message mean (last most optimal value) More... | |
bool | verbose_ = false |
std::vector< Eigen::MatrixXd > | Vinv |
Backward message covariance inverse. More... | |
std::vector< Eigen::MatrixXd > | Vinv_old |
Backward message covariance inverse (last most optimal value) More... | |
Eigen::MatrixXd | W |
Configuration space weight matrix inverse. More... | |
Eigen::MatrixXd | Winv |
Configuration space weight matrix inverse. More... | |
Additional Inherited Members | |
Public Attributes inherited from exotica::Object | |
bool | debug_ |
std::string | ns_ |
std::string | object_name_ |
Protected Attributes inherited from exotica::MotionSolver | |
int | max_iterations_ |
double | planning_time_ |
PlanningProblemPtr | problem_ |
Protected Attributes inherited from exotica::Instantiable< AICOSolverInitializer > | |
AICOSolverInitializer | parameters_ |
Solves motion planning problem using Approximate Inference Control method.
Definition at line 72 of file aico_solver.h.
|
private |
Enumerator | |
---|---|
FORWARD | |
SYMMETRIC | |
LOCAL_GAUSS_NEWTON | |
LOCAL_GAUSS_NEWTON_DAMPED |
Definition at line 158 of file aico_solver.h.
|
default |
|
virtualdefault |
|
private |
Computes the cost of the trajectory.
x | Trajectory. |
Definition at line 436 of file aico_solver.cpp.
|
private |
Updates the task cost terms for time step . UnconstrainedTimeIndexedProblem::Update() has to be called before calling this function.
t | Time step to be updated. |
Definition at line 362 of file aico_solver.cpp.
|
protected |
Initializes message data.
q0 | Start configuration |
Definition at line 203 of file aico_solver.cpp.
|
protected |
Initialise AICO messages from an initial trajectory.
q_init | Initial trajectory |
Definition at line 260 of file aico_solver.cpp.
|
overridevirtual |
Reimplemented from exotica::Instantiable< AICOSolverInitializer >.
Definition at line 45 of file aico_solver.cpp.
|
private |
Reverts back to previous state if the cost of the current state is higher.
Definition at line 582 of file aico_solver.cpp.
|
private |
Stores the previous state.
Definition at line 561 of file aico_solver.cpp.
|
overridevirtual |
Solves the problem.
solution | Returned solution trajectory as a vector of joint configurations. |
Implements exotica::MotionSolver.
Definition at line 85 of file aico_solver.cpp.
|
overridevirtual |
Binds the solver to a specific problem which must be pre-initalised.
pointer | Shared pointer to the motion planning problem |
Reimplemented from exotica::MotionSolver.
Definition at line 73 of file aico_solver.cpp.
|
private |
Compute one step of the AICO algorithm.
Definition at line 474 of file aico_solver.cpp.
|
private |
Updates the backward message at time step $t$.
t | Time step Updates the mean and covariance of the backward message using: , where and . |
Definition at line 315 of file aico_solver.cpp.
|
private |
Updates the forward message at time step $t$.
t | Time step Updates the mean and covariance of the forward message using: , where and . |
Definition at line 306 of file aico_solver.cpp.
|
private |
brief Updates the task message at time step $t$
t | Time step |
qhat_t | Point of linearisation at time step $t$ |
tolerance | Lazy update tolerance (only update the task message if the state changed more than this value) |
max_step_size | If step size >0, cap the motion at this step to the step size. Updates the mean and covariance of the task message using: |
Definition at line 340 of file aico_solver.cpp.
|
private |
Update messages for given time step.
t | Time step. |
update_fwd | Update the forward message. |
update_bwd | Update the backward message. |
max_relocation_iterations | Maximum number of relocation while searching for a good linearisation point |
tolerance | Tolerance for for stopping the search. |
force_relocation | Set to true to force relocation even when the result is within tolerance. |
max_step_size | Step size for UpdateTaskMessage. |
Definition at line 387 of file aico_solver.cpp.
|
private |
Update messages for given time step using the Gauss Newton method.
t | Time step. |
update_fwd | Update the forward message. |
update_bwd | Update the backward message. |
max_relocation_iterations | Maximum number of relocation while searching for a good linearisation point |
tolerance | Tolerance for for stopping the search. |
max_step_size | Step size for UpdateTaskMessage. First, the messages , and are computed. Then, the belief is updated: where the mean and covariance are updated as follows: . |
Definition at line 428 of file aico_solver.cpp.
|
private |
Belief mean.
Definition at line 122 of file aico_solver.h.
|
private |
Belief mean (last most optimal value)
Definition at line 136 of file aico_solver.h.
|
private |
Squared configuration space step.
Definition at line 147 of file aico_solver.h.
|
private |
Definition at line 148 of file aico_solver.h.
|
private |
Definition at line 156 of file aico_solver.h.
|
private |
Definition at line 157 of file aico_solver.h.
|
private |
Belief covariance inverse.
Definition at line 123 of file aico_solver.h.
|
private |
Belief covariance inverse (last most optimal value)
Definition at line 137 of file aico_solver.h.
|
private |
Backward message initialisation mean.
Definition at line 108 of file aico_solver.h.
|
private |
Backward message initialisation covariance.
Definition at line 109 of file aico_solver.h.
|
private |
cost of MAP trajectory
Definition at line 144 of file aico_solver.h.
|
private |
Control cost for each time step.
Definition at line 126 of file aico_solver.h.
|
private |
Control cost for each time step (last most optimal value)
Definition at line 140 of file aico_solver.h.
|
private |
cost of MAP trajectory (last most optimal value)
Definition at line 145 of file aico_solver.h.
|
private |
previous iteration cost
Definition at line 146 of file aico_solver.h.
|
private |
Task cost for each task for each time step.
Definition at line 127 of file aico_solver.h.
|
private |
Task cost for each task for each time step (last most optimal value)
Definition at line 141 of file aico_solver.h.
|
private |
Damping.
Definition at line 101 of file aico_solver.h.
|
private |
Damping.
Definition at line 102 of file aico_solver.h.
|
private |
Damping reference point.
Definition at line 143 of file aico_solver.h.
|
private |
Relative function tolerance/first-order optimality criterion.
Definition at line 105 of file aico_solver.h.
|
private |
Iteration counter.
Definition at line 111 of file aico_solver.h.
|
private |
T the last time InitMessages was called.
Definition at line 153 of file aico_solver.h.
|
private |
Max. number of sweeps without improvement before terminating (= line-search)
Definition at line 106 of file aico_solver.h.
|
private |
Update tolerance to stop update of messages if change of maximum coefficient is less than this tolerance.
Definition at line 103 of file aico_solver.h.
|
private |
Shared pointer to the planning problem.
Definition at line 100 of file aico_solver.h.
|
private |
Configuration space trajectory.
Definition at line 124 of file aico_solver.h.
|
private |
Configuration space trajectory (last most optimal value)
Definition at line 138 of file aico_solver.h.
|
private |
Cost weighted normal distribution of configurations across sweeps.
Definition at line 113 of file aico_solver.h.
|
private |
Point of linearisation.
Definition at line 125 of file aico_solver.h.
|
private |
Point of linearisation (last most optimal value)
Definition at line 139 of file aico_solver.h.
|
private |
Task message mean.
Definition at line 119 of file aico_solver.h.
|
private |
Task message covariance.
Definition at line 120 of file aico_solver.h.
|
private |
Task message mean (last most optimal value)
Definition at line 133 of file aico_solver.h.
|
private |
Task message covariance (last most optimal value)
Definition at line 134 of file aico_solver.h.
|
private |
Task message point of linearisation.
Definition at line 121 of file aico_solver.h.
|
private |
Task message point of linearisation (last most optimal value)
Definition at line 135 of file aico_solver.h.
|
private |
Forward message mean.
Definition at line 115 of file aico_solver.h.
|
private |
Forward message mean (last most optimal value)
Definition at line 129 of file aico_solver.h.
|
private |
Forward message covariance inverse.
Definition at line 116 of file aico_solver.h.
|
private |
Forward message covariance inverse (last most optimal value)
Definition at line 130 of file aico_solver.h.
|
private |
Relative step tolerance (termination criterion)
Definition at line 104 of file aico_solver.h.
|
private |
Sweeps so far.
Definition at line 155 of file aico_solver.h.
|
private |
Whether the last sweep improved the cost (for backtrack iterations count)
Definition at line 110 of file aico_solver.h.
|
private |
Sweep mode.
Definition at line 165 of file aico_solver.h.
|
private |
Definition at line 166 of file aico_solver.h.
|
private |
Flag for using backward message initialisation.
Definition at line 107 of file aico_solver.h.
|
private |
Backward message mean.
Definition at line 117 of file aico_solver.h.
|
private |
Backward message mean (last most optimal value)
Definition at line 131 of file aico_solver.h.
|
private |
Definition at line 168 of file aico_solver.h.
|
private |
Backward message covariance inverse.
Definition at line 118 of file aico_solver.h.
|
private |
Backward message covariance inverse (last most optimal value)
Definition at line 132 of file aico_solver.h.
|
private |
Configuration space weight matrix inverse.
Definition at line 150 of file aico_solver.h.
|
private |
Configuration space weight matrix inverse.
Definition at line 151 of file aico_solver.h.