A sparse MPC solver for walking motion generation.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
oru_walk Class Reference

The main walking module class. More...

#include <oru_walk.h>

Inheritance diagram for oru_walk:

Public Member Functions

 oru_walk (ALPtr< ALBroker > broker, const string &name)
 
 ~oru_walk ()
 
void init ()
 
void stopWalkingRemote ()
 An interface function that is called remotely to stop the execution. More...
 
void initPosition ()
 
void setStiffness (const float &)
 Set stiffness of joints. More...
 
void walk ()
 Construct and initialize all necessary classes and register callback function. More...
 

Private Member Functions

void initFastRead (const vector< string > &)
 Initializes variables, that are necessary for fast reading of data from memory. More...
 
void initFastWrite (const vector< string > &)
 Initializes variables, that are necessary for fast sending of parameters to DCM. More...
 
void initWalkCommands ()
 Initialize commands, that will be sent to DCM. More...
 
void initJointAngles (ALValue &)
 
void initWalkPattern (WMG &)
 Initialize selected walk pattern. More...
 
void initWalkPattern_Straight (WMG &)
 Initializes walk pattern. More...
 
void initWalkPattern_Diagonal (WMG &)
 Initializes walk pattern. More...
 
void initWalkPattern_Circular (WMG &)
 Initializes walk pattern. More...
 
void initSolver ()
 Initialize solver. More...
 
void readSensors (jointState &)
 Update joint angles. More...
 
bool solveMPCProblem (WMG &, smpc_parameters &)
 Solve the MPC problem. More...
 
void solveIKsendCommands (const smpc_parameters &, const smpc::state_com &, const int, WMG &)
 Solve inverse kinematics and send commands to the controllers. More...
 
void correctNextSupportPosition (WMG &)
 The position of the next support foot may change from the targeted, this function moves it to the right place. More...
 
void feedbackError (smpc::state_com &)
 Correct state and the model based on the sensor data. More...
 
void halt (const char *, const char *)
 Log a message, remove stiffness and die. More...
 
void stopWalking (const char *)
 Unregister callback and log a message. More...
 
void walkControl ()
 A control loop, that is executed in separate thread. More...
 
void dcmCallback ()
 Wake up walk control thread periodically. More...
 

Private Attributes

ProcessSignalConnection dcm_callback_connection
 
ALPtr< ALMemoryFastAccess > access_sensor_values
 
int * last_dcm_time_ms_ptr
 
ALValue joint_commands
 
nao_igm nao
 
double ref_joint_angles [LOWER_JOINTS_NUM]
 
walkParameters wp
 
smpc::solver * solver
 
int dcm_loop_counter
 
int last_dcm_time_ms
 
ALPtr< DCMProxy > dcm_proxy
 
ALPtr< ALMemoryProxy > memory_proxy
 
boost::condition_variable walk_control_condition
 
boost::mutex walk_control_mutex
 

Detailed Description

The main walking module class.

Definition at line 73 of file oru_walk.h.

Constructor & Destructor Documentation

◆ oru_walk()

oru_walk::oru_walk ( ALPtr< ALBroker >  broker,
const string &  name 
)

Constructor for oru_walk object

Parameters
brokerThe parent broker
nameThe name of the module

Definition at line 18 of file oru_walk.cpp.

◆ ~oru_walk()

oru_walk::~oru_walk ( )

Destructor for oru_walk object

Definition at line 48 of file oru_walk.cpp.

Member Function Documentation

◆ correctNextSupportPosition()

void oru_walk::correctNextSupportPosition ( WMG &  wmg)
private

The position of the next support foot may change from the targeted, this function moves it to the right place.

Definition at line 115 of file walking.cpp.

◆ dcmCallback()

void oru_walk::dcmCallback ( )
private

Wake up walk control thread periodically.

Definition at line 95 of file walking.cpp.

◆ feedbackError()

void oru_walk::feedbackError ( smpc::state_com &  init_state)
private

Correct state and the model based on the sensor data.

Parameters
[in,out]init_stateexpected state

Definition at line 338 of file walking.cpp.

◆ halt()

void oru_walk::halt ( const char *  message,
const char *  function 
)
private

Log a message, remove stiffness and die.

Parameters
[in]messagea message
[in]functionname of the calling function.

Definition at line 441 of file walking.cpp.

◆ init()

void oru_walk::init ( )

Definition at line 66 of file oru_walk.cpp.

◆ initFastRead()

void oru_walk::initFastRead ( const vector< string > &  joint_names)
private

Initializes variables, that are necessary for fast reading of data from memory.

Definition at line 14 of file oru_walk_init.cpp.

◆ initFastWrite()

void oru_walk::initFastWrite ( const vector< string > &  joint_names)
private

Initializes variables, that are necessary for fast sending of parameters to DCM.

Definition at line 40 of file oru_walk_init.cpp.

◆ initJointAngles()

void oru_walk::initJointAngles ( ALValue &  init_joint_angles)
private

Definition at line 128 of file oru_walk_init.cpp.

◆ initPosition()

void oru_walk::initPosition ( )
Attention
Hardcoded parameter!

Definition at line 203 of file oru_walk.cpp.

◆ initSolver()

void oru_walk::initSolver ( )
private

Initialize solver.

Definition at line 126 of file walking.cpp.

◆ initWalkCommands()

void oru_walk::initWalkCommands ( )
private

Initialize commands, that will be sent to DCM.

Definition at line 109 of file oru_walk_init.cpp.

◆ initWalkPattern()

void oru_walk::initWalkPattern ( WMG &  wmg)
private

Initialize selected walk pattern.

Definition at line 16 of file walk_patterns.cpp.

◆ initWalkPattern_Circular()

void oru_walk::initWalkPattern_Circular ( WMG &  wmg)
private

Initializes walk pattern.

Definition at line 133 of file walk_patterns.cpp.

◆ initWalkPattern_Diagonal()

void oru_walk::initWalkPattern_Diagonal ( WMG &  wmg)
private

Initializes walk pattern.

Definition at line 89 of file walk_patterns.cpp.

◆ initWalkPattern_Straight()

void oru_walk::initWalkPattern_Straight ( WMG &  wmg)
private

Initializes walk pattern.

Definition at line 48 of file walk_patterns.cpp.

◆ readSensors()

void oru_walk::readSensors ( jointState &  joint_state)
private

Update joint angles.

Definition at line 72 of file walking.cpp.

◆ setStiffness()

void oru_walk::setStiffness ( const float &  stiffnessValue)

Set stiffness of joints.

Parameters
[in]stiffnessValuevalue of stiffness [0;1]
Attention
Hardcoded parameter!

Definition at line 151 of file oru_walk.cpp.

◆ solveIKsendCommands()

void oru_walk::solveIKsendCommands ( const smpc_parameters &  mpc,
const smpc::state_com &  CoM,
const int  control_loop_num,
WMG &  wmg 
)
private

Solve inverse kinematics and send commands to the controllers.

Parameters
[in]mpcMPC parameters
[in]CoMCoM position
[in]control_loop_numnumber of control loops in future (>= 1).
[in,out]wmgWMG

Definition at line 278 of file walking.cpp.

◆ solveMPCProblem()

bool oru_walk::solveMPCProblem ( WMG &  wmg,
smpc_parameters &  mpc 
)
private

Solve the MPC problem.

Parameters
[in,out]wmgWMG
[in,out]mpcMPC parameters
Returns
false if there is not enough steps, true otherwise.

Definition at line 388 of file walking.cpp.

◆ stopWalking()

void oru_walk::stopWalking ( const char *  message)
private

Unregister callback and log a message.

Parameters
[in]messagea message

Definition at line 426 of file walking.cpp.

◆ stopWalkingRemote()

void oru_walk::stopWalkingRemote ( )

An interface function that is called remotely to stop the execution.

Definition at line 454 of file walking.cpp.

◆ walk()

void oru_walk::walk ( )

Construct and initialize all necessary classes and register callback function.

Definition at line 17 of file walking.cpp.

◆ walkControl()

void oru_walk::walkControl ( )
private

A control loop, that is executed in separate thread.

Attention
REAL-TIME!

Definition at line 173 of file walking.cpp.

Member Data Documentation

◆ access_sensor_values

ALPtr<ALMemoryFastAccess> oru_walk::access_sensor_values
private

Definition at line 127 of file oru_walk.h.

◆ dcm_callback_connection

ProcessSignalConnection oru_walk::dcm_callback_connection
private

Definition at line 124 of file oru_walk.h.

◆ dcm_loop_counter

int oru_walk::dcm_loop_counter
private

Definition at line 140 of file oru_walk.h.

◆ dcm_proxy

ALPtr<DCMProxy> oru_walk::dcm_proxy
private

Definition at line 143 of file oru_walk.h.

◆ joint_commands

ALValue oru_walk::joint_commands
private

Definition at line 131 of file oru_walk.h.

◆ last_dcm_time_ms

int oru_walk::last_dcm_time_ms
private

Definition at line 141 of file oru_walk.h.

◆ last_dcm_time_ms_ptr

int* oru_walk::last_dcm_time_ms_ptr
private

Definition at line 128 of file oru_walk.h.

◆ memory_proxy

ALPtr<ALMemoryProxy> oru_walk::memory_proxy
private

Definition at line 144 of file oru_walk.h.

◆ nao

nao_igm oru_walk::nao
private

Definition at line 134 of file oru_walk.h.

◆ ref_joint_angles

double oru_walk::ref_joint_angles[LOWER_JOINTS_NUM]
private

Definition at line 135 of file oru_walk.h.

◆ solver

smpc::solver* oru_walk::solver
private

Definition at line 138 of file oru_walk.h.

◆ walk_control_condition

boost::condition_variable oru_walk::walk_control_condition
private

Definition at line 146 of file oru_walk.h.

◆ walk_control_mutex

boost::mutex oru_walk::walk_control_mutex
private

Definition at line 147 of file oru_walk.h.

◆ wp

walkParameters oru_walk::wp
private

Definition at line 137 of file oru_walk.h.


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