Drake
 All Classes Files Functions Variables
SimpleDynamicsFullKinematicsPlanner Class Reference
Inheritance diagram for SimpleDynamicsFullKinematicsPlanner:
Collaboration diagram for SimpleDynamicsFullKinematicsPlanner:

Public Member Functions

function SimpleDynamicsFullKinematicsPlanner (plant, robot, N, tf_range, Q_contact_force, contact_wrench_struct, options)
 
function kinematicsData (obj, q, kinematics_cache_ptr)
 
function setFixInitialState (obj, flag, x0)
 set obj.fix_initial_state = flag. More...
 
function addKinematicConstraint (obj, constraint, time_index)
 Add a kinematic constraint that is a function of the state at the specified time or times. More...
 
function addRigidBodyConstraint (obj, constraint, time_index)
 Add a kinematic constraint that is a function of the state at the specified time or times. More...
 
function contactWrench (obj, x)
 Given x as the decision variables, find out the contact wrench. More...
 
- Public Member Functions inherited from DirectTrajectoryOptimization
function DirectTrajectoryOptimization (plant, N, durations, options)
 function obj = DirectTrajectoryOptimization(plant,initial_cost,running_cost,final_cost, % t_init,traj_init,T_span,constraints, options) Trajectory optimization constructor More...
 
function getN (obj)
 
function getXinds (obj)
 
function getHinds (obj)
 
function addInputConstraint (obj, constraint, time_index)
 Add constraint (or composite constraint) that is a function of the input at the specified time or times. More...
 
function addStateConstraint (obj, constraint, time_index, x_indices)
 Add constraint (or composite constraint) that is a function of the state at the specified time or times. More...
 
function addTrajectoryDisplayFunction (obj, display_fun)
 add a dispay function that gets called on every iteration of the algorithm More...
 
function solveTraj (obj, t_init, traj_init)
 Solve the nonlinear program and return resulting trajectory. More...
 
function getInitialVars (obj, t_init, traj_init)
 evaluates the initial trajectories at the sampled times and constructs the nominal z0. More...
 
function setupVariables (obj, N)
 Default implementation, Assumes, if time is not fixed, that there are N-1 time steps N corresponding state variables and N-1 corresponding input variables Overwrite to change. More...
 
function addInitialCost (obj, initial_cost)
 Adds a cost to the initial state f(x0) More...
 
function addFinalCost (obj, final_cost_function)
 adds a cost to the final state and total time More...
 
function reconstructInputTrajectory (obj, z)
 default behavior is to use first order holds, but this can be re-implemented by a subclass. More...
 
function reconstructStateTrajectory (obj, z)
 default behavior is to use first order holds, but this can be re-implemented by a subclass. More...
 
function extractFirstInput (obj, z)
 When using trajectory optimization a part of a model-predictive control system, we often only need to extract u(0). More...
 
virtual function addRunningCost (obj, running_cost_function)
 Adds an integrated cost to all time steps, which is numerical implementation specific (thus abstract) this cost is assumed to be time-invariant. More...
 
virtual function addDynamicConstraints (obj)
 
- Public Member Functions inherited from NonlinearProgram
function NonlinearProgram (num_vars, x_name)
 
function addCompositeConstraints (obj, cnstr, xind, data_ind)
 add a CompositeConstraint to the object, change the constraint evalation of the program. More...
 
function addConstraint (obj, cnstr, varargin)
 obj = addConstraint(obj,cnstr,varargin) Queries the constraint type and calls the appropriate addConstraint method (e.g. More...
 
function addNonlinearConstraint (obj, cnstr, xind, data_ind)
 add a NonlinearConstraint to the object, change the constraint evalation of the program. More...
 
function addLinearConstraint (obj, cnstr, xind)
 add a LinearConstraint to the program More...
 
function addBoundingBoxConstraint (obj, cnstr, xind)
 add a BoundingBoxConstraint to the program More...
 
function addCost (obj, cnstr, xind, data_ind)
 Add a cost to the objective function. More...
 
function addQuadraticCost (obj, Q, x_desired, xind)
 helper function for the very common case of adding the objective g(x) = (x-xd)'Q(x-xd), Q = Q' >= 0 More...
 
function getArgumentArray (obj, x, xind)
 Retrieves the elements from the vector x related to xind and returns them as a cell array where: args{i} = x(xind{i}) More...
 
function nonlinearConstraints (obj, x)
 evaluate the nonlinear constraints More...
 
function objective (obj, x)
 return the value of the objective More...
 
function objectiveAndNonlinearConstraints (obj, x)
 evaluate the objective and the nonlinear constraints altogher More...
 
function addDecisionVariable (obj, num_new_vars, var_name)
 appending new decision variables to the end of the current decision variables More...
 
function replaceCost (obj, cost, cost_idx, xind)
 replace the cost_idx'th cost in the original problem with a new cost More...
 
function addSharedDataFunction (obj, user_fun, xind)
 Adds the specified shared data function to be evaluated within each iteration of the program. More...
 
function getNumSharedDataFunctions (obj)
 
function evaluateSharedDataFunctions (obj, x)
 Evaluate all shared data functions and return the data object. More...
 
function addDisplayFunction (obj, display_fun, indices)
 add a dispay function that gets called on every iteration of the algorithm More...
 
function setCheckGrad (obj, check_grad)
 
function setConstraintErrTol (obj, tol)
 
function setSolver (obj, solver)
 
function setSolverOptions (obj, solver, optionname, optionval)
 
function getNonlinearGradientSparsity (obj)
 This function sets the nonlinear sparsity vector iGfun and jGvar based on the nonlinear sparsity of the objective, nonlinear inequality constraints and nonlinear equality constraints. More...
 
function bounds (obj)
 return the bounds for all the objective function, nonlinear constraints and linear constraints More...
 
function solve (obj, x0)
 
function compareSolvers (obj, x0, solvers)
 
function isNonlinearConstraintID (obj, cnstr_id)
 Given an ID, determine if any of the nonlinear constraint obj.nlcon has that ID. More...
 
function isLinearConstraintID (obj, cnstr_id)
 Given an ID, determine if any of the linear constraint obj.lcon has that ID. More...
 
function isBoundingBoxConstraintID (obj, cnstr_id)
 Given an ID, determine if any of the bounding box constraint obj.bbcon has that ID. More...
 
function deleteConstraint (obj, delete_cnstr_id)
 delete a constraint from the program More...
 
function updateConstraint (obj, varargin)
 update a Constraint of the program. More...
 
function deleteNonlinearConstraint (obj, delete_cnstr_id)
 delete a nonlinear constraint from the program More...
 
function updateNonlinearConstraint (obj, varargin)
 updateNonlinearConstraint(obj,cnstr_id,cnstr,xind,data_ind) update the nonlinear constraint whose id=cnstr_id with a new Constraint object cnstr, the newly added Constraint cnstr has the ID new_cnstr_id More...
 
function deleteLinearConstraint (obj, delete_cnstr_id)
 delete the LinearConstraint obj.lcon{cnstr_idx} from the program More...
 
function updateLinearConstraint (obj, varargin)
 updateLinearConstraint(obj,cnstr_id,cnstr,xind) update the linear constraint whose id=cnstr_id with a new Constraint object cnstr, the newly added Constraint cnstr has the ID new_cnstr_id More...
 
function deleteBoundingBoxConstraint (obj, cnstr_id)
 delete the BoundingBoxConstraint in obj.bbcon with ID=cnstr_id from the program More...
 
function updateBoundingBoxConstraint (obj, varargin)
 updateBoundingBoxConstraint(obj,cnstr_id,cnstr,xind) update the BoundingBoxConstraint whose id=cnstr_id with a new BoundingBoxConstraint cnstr More...
 

Protected Member Functions

function parseRigidBodyContactWrench (obj)
 
function addForceNormCost (obj)
 add a quadratic cost on sum_i,j force_j[i]'*obj.Q_contact_force*force_j[i] More...
 
function addSimpleDynamicConstraints (obj)
 First I find out the order of the contact_wrench such that it is in the same order of lambda. More...
 
virtual function addContactDynamicConstraints (obj, num_knot, contact_wrench_idx, knot_lambda_idx)
 
- Protected Member Functions inherited from DirectTrajectoryOptimization
function final_cost (obj, final_cost_function, h, x)
 
- Protected Member Functions inherited from NonlinearProgram
function snopt (obj, x0)
 
function fmincon (obj, x0)
 if (obj.num_cin + obj.num_ceq) nonlinearConstraints = .nonlinearConstraint; else nonlinearConstraints = []; end More...
 
function ipopt (obj, x0)
 
function setVarBounds (obj, lb, ub)
 
function mapSolverInfo (obj, exitflag, x)
 Based on the solver information and solution, re-map the info. More...
 

Protected Attributes

Property robot
 
Property nq
 
Property nv
 
Property q_inds
 
Property v_inds
 
Property qsc_weight_inds
 
Property fix_initial_state
 
Property g
 
Property kinsol_dataind
 N-element vector of indices into the shared_data, where shared_data{kinsol_dataind(i)} is the kinsol for knot point i. More...
 
Property kinematics_cache_ptrs
 kinematics cache pointers, one for each knot point More...
 
Property contact_wrench
 
Property contact_wrench_active_knot
 
Property unique_contact_bodies
 
Property unique_body_contact_pts
 
Property lambda_inds
 
Property lambda2contact_wrench
 
Property num_lambda_knot
 lambda{i}(:,j,k) are the contact forces whose information are encoded in the RigidBodyContactWrench obj.contact_wrench(obj.lambda2contact_wrench{i}(j,k)) If there is no active RigidBodyContactWrench, then the value of lambda2contact_wrench is set to be 0. More...
 
Property robot_mass
 
Property Q_contact_force
 
- Protected Attributes inherited from DirectTrajectoryOptimization
Property N
 
Property options
 
Property plant
 
Property h_inds
 
Property x_inds
 
Property u_inds
 
Property dynamic_constraints
 
Property constraints
 
- Protected Attributes inherited from NonlinearProgram
Property num_vars
 
Property num_cin
 
Property num_ceq
 
Property Ain
 
Property bin
 
Property Ain_name
 
Property Aeq
 
Property beq
 
Property Aeq_name
 
Property cin_lb
 
Property cin_ub
 
Property cin_name
 
Property ceq_name
 
Property x_lb
 
Property x_ub
 
Property x_name
 
Property solver
 
Property solver_options
 
Property display_funs
 
Property display_fun_indices
 
Property check_grad
 
Property constraint_err_tol
 numerical gradient at the begining and end of the nonlinear optimization More...
 
Property nlcon
 
Property lcon
 
Property bbcon
 
Property cost
 
Property nlcon_xind
 
Property bbcon_xind
 nlcon{i}.eval(x(nlcon_xind{i}{1},x(nlcon_xind{i}{2},) cost_xind_cell % A cell array, cost_xind{i} is a cell array of int vectors recording the indices of x that is used in evaluating obj.cost{i} More...
 
Property shared_data_xind_cell
 a cell array like nlcon_xind, where shared_data_xind_cell{i} is a cell array of int vectors recording indices used in evaluating the shared_data_function More...
 
Property nlcon_dataind
 a cell array of function handles, each of which returns a data object so that shared_data{i} = shared_data_functions(x(shared_data_xind_cell{i}{1}),x(shared_data_xind_cell{i}{2}),) shared_data_functions More...
 
Property cost_dataind
 
Property iFfun
 2 if user has their own snopt in MATLAB path More...
 
Property iCinfun
 
Property iCeqfun
 

Constructor & Destructor Documentation

function SimpleDynamicsFullKinematicsPlanner ( plant  ,
robot  ,
N  ,
tf_range  ,
Q_contact_force  ,
contact_wrench_struct  ,
options   
)
Parameters
plantThis is the plant going to be used in DirectTRajectoryOptimization, it can be different from robot since we want to use simple dynamics here. Refer to DirectTrajectoryOptimization for more details.
robotA RigidBodyManipulator or a TimeSteppingRigidBodyManipulator
NThe number of knot points
tf_rangeA double. The bounds on the total time
Q_contact_force.A 3 x 3 PSD matrix. minimize the weighted L2 norm of the contact force
contact_wrench_structA cell of of structs, with fields 'active_knot' and 'cw', where 'cw' fields contain the RigidBodyContactWrench objects
Return values
obj

Member Function Documentation

virtual function addContactDynamicConstraints ( obj  ,
num_knot  ,
contact_wrench_idx  ,
knot_lambda_idx   
)
protectedvirtual
function addForceNormCost ( obj  )
protected

add a quadratic cost on sum_i,j force_j[i]'*obj.Q_contact_force*force_j[i]

Return values
obj
function addKinematicConstraint ( obj  ,
constraint  ,
time_index   
)

Add a kinematic constraint that is a function of the state at the specified time or times.

Parameters
constrainta CompositeConstraint
time_indexa cell array of time indices ex1., time_index = {1, 2, 3} means the constraint is applied individually to knot points 1, 2, and 3 ex2,. time_index = {[1 2], [3 4]} means the constraint is applied to knot points 1 and 2 together (taking the combined state as an argument) and 3 and 4 together.
Return values
obj
function addRigidBodyConstraint ( obj  ,
constraint  ,
time_index   
)

Add a kinematic constraint that is a function of the state at the specified time or times.

Parameters
constrainta RigidBodyConstraint object
time_indexa cell array of time indices ex1., time_index = {1, 2, 3} means the constraint is applied individually to knot points 1, 2, and 3 ex2,. time_index = {[1 2], [3 4]} means the constraint is applied to knot points 1 and 2 together (taking the combined state as an argument) and 3 and 4 together.
Return values
obj
function addSimpleDynamicConstraints ( obj  )
protected

First I find out the order of the contact_wrench such that it is in the same order of lambda.

Return values
obj
function contactWrench ( obj  ,
 
)

Given x as the decision variables, find out the contact wrench.

Parameters
xAn obj.num_vars x 1 vector
Return values
wrench_solAn length(obj.unique_contact_bodies) x obj.N array of struct, each struct contains fiels of body, body_pts, pts_pos, force and torque
function kinematicsData ( obj  ,
,
kinematics_cache_ptr   
)
Return values
data
function parseRigidBodyContactWrench ( obj  )
protected
Return values
obj
function setFixInitialState ( obj  ,
flag  ,
x0   
)

set obj.fix_initial_state = flag.

If flag = true, then fix the initial state to x0

Parameters
x0A 2*obj.robot.getNumPositions() x 1 double vector. x0 = [q0;qdot0]. The initial state
Return values
obj

Member Data Documentation

Property contact_wrench
protected
Property contact_wrench_active_knot
protected
Property fix_initial_state
protected
Property g
protected
Property kinematics_cache_ptrs
protected

kinematics cache pointers, one for each knot point

Property kinsol_dataind
protected

N-element vector of indices into the shared_data, where shared_data{kinsol_dataind(i)} is the kinsol for knot point i.

Property lambda2contact_wrench
protected
Property lambda_inds
protected
Property nq
protected
Property num_lambda_knot
protected

lambda{i}(:,j,k) are the contact forces whose information are encoded in the RigidBodyContactWrench obj.contact_wrench(obj.lambda2contact_wrench{i}(j,k)) If there is no active RigidBodyContactWrench, then the value of lambda2contact_wrench is set to be 0.

Furthermore, I guarantee that in obj.lambda2contact_wrench{i}, the same RigidBodyContactWrench indices are grouped together. Namely obj.lambda2contact_wrench{2}(:,1) would be [1;1;1;2;2] rather than [1;2;1;1;2];

Property nv
protected
Property Q_contact_force
protected
Property q_inds
protected
Property qsc_weight_inds
protected
Property robot
protected
Property robot_mass
protected
Property unique_body_contact_pts
protected
Property unique_contact_bodies
protected
Property v_inds
protected

The documentation for this class was generated from the following file: