The class representing the whole mechanism. May contain multiple characters. More...
#include <chain.h>

Classes | |
| struct | scale_object |
| XML utility functions. More... | |
Public Member Functions | |
| void | add_scale_object (const scale_object &_s) |
| int | AddJoint (Joint *target, Joint *p) |
Add a new joint target as a child of joint p. More... | |
| int | AddJoint (Joint *target, const char *parent_name, const char *charname=0) |
Add a new joint target as a child of joint with name parent_name. More... | |
| Joint * | AddJoint (JointData *joint_data, const char *charname=0) |
Create and add a joint using JointData structure. More... | |
| Joint * | AddRoot (const char *name=0, const fVec3 &grav=fVec3(0.0, 0.0, 9.8)) |
| Add the (unique) root joint. More... | |
| int | AddRoot (Joint *r) |
| Add the (unique) root joint. More... | |
| void | ApplyGeomScale (SceneGraph *sg) |
| int | BeginCreateChain (int append=false) |
| Indicates begining of creating a kinematic chain. More... | |
| void | CalcAcceleration () |
| void | CalcPosition () |
| Forward kinematics. More... | |
| void | CalcVelocity () |
| Chain () | |
| virtual void | Clear () |
| Remove all joints and clear all parameters. More... | |
| void | clear_scale_object_list () |
| int | ClearExtForce () |
| Clear the external forces/torques. More... | |
| int | ClearJointForce () |
| Clear the joint forces/torques. More... | |
| double | ComJacobian (fMat &J, fVec3 &com, const char *chname=0) |
| Computes the com Jacobian. More... | |
| int | Connect (Joint *virtual_joint, Joint *parent_joint) |
| Connect two links by adding a new virtual joint. More... | |
| int | CreateParallel (int num_char, const char *prmname, const char *charname, const fVec3 &init_pos=0.0, const fMat33 &init_att=1.0, const fVec3 &pos_offset=0.0, const fMat33 &att_offset=1.0, int init_num=0) |
| Automatically generate multiple identical chains. More... | |
| int | CreateSerial (int num_joint, const JointData &joint_data, const char *charname=0, Joint *parent_joint=0) |
| Automatically generate a serial chain. More... | |
| int | Disconnect (Joint *j) |
| Disconnect the loop at the specified virtual joint. More... | |
| int | EndCreateChain (SceneGraph *sg=NULL) |
| End editing a chain. More... | |
| Joint * | FindCharacterRoot (const char *charname) |
Find the root joint of the character with name charname. More... | |
| Joint * | FindJoint (const char *jname, const char *charname=0) |
| Find a joint from name. More... | |
| Joint * | FindJoint (int _id) |
Find a joint with ID _id. More... | |
| int | GetJointAcc (fVec &accs) |
| int | GetJointForce (fVec &forces) |
| Obtain the joint forces/torques. More... | |
| int | GetJointList (Joint **&joints) |
| Obtain a list of pointers to all joints. More... | |
| int | GetJointNameList (char **&jnames) |
| Obtain a list of joint names. More... | |
| int | GetJointValue (fVec &values) |
| Obtain the joint values/velocities/accelerations. More... | |
| int | GetJointVel (fVec &vels) |
| int | Integrate (double timestep) |
Performs Euler integration with timestep timestep [s]. More... | |
| int | IntegrateAdaptive (double ×tep, int step, double min_timestep=DEFAULT_MIN_TIMESTEP, double max_integ_error=DEFAULT_MAX_INTEG_ERROR) |
| Performs Euler integration with adaptive timestep. More... | |
| int | IntegrateRK4 (double timestep, int step) |
| Performs 4-th order Runge-Kutta integration. More... | |
| int | IntegrateRK4Value (double timestep, int step) |
| int | IntegrateRK4Velocity (double timestep, int step) |
| int | IntegrateValue (double timestep) |
| Integrate value/velocity only. More... | |
| int | IntegrateVelocity (double timestep) |
| void | InvDyn (fVec &tau) |
| Inverse dynamics. More... | |
| int | Load (const char *fname, const char *charname=0) |
| Load the chain from a file in original (*.prm) format. More... | |
| int | LoadXML (const char *fname, const char *charname=0) |
| Load the chain from an XML file. More... | |
| int | NumDOF () |
| Total degrees of freedom. More... | |
| int | NumJoint () |
| Total number of joints. More... | |
| int | NumValue () |
| Dimension of the joint value vector (using Euler parameter representation for orientation). More... | |
| int | RemoveJoint (Joint *j) |
disconnect joint j from its parent More... | |
| Joint * | Root () |
| int | Save (const char *fname, const char *charname=0) const |
| Save the chain data to a file in original (*.prm) format. More... | |
| int | Save (ostream &ost, const char *charname=0) const |
| int | SaveStatus (fVec &value, fVec &vel, fVec &acc) |
| Save current joint values, velocities, and accelerations. More... | |
| int | SaveXML (const char *fname, const char *charname=0) const |
| Save the chain data to a file in XML format. More... | |
| int | SaveXML (ostream &ost, const char *charname=0) const |
| int | set_abs_position_orientation (Joint *jnt, const fVec3 &abs_pos, const fMat33 &abs_att) |
| int | SetAllTorqueGiven (int _tg) |
| Change torque/motion control property of all joints. More... | |
| int | SetCharacterTorqueGiven (const char *charname, int _tg) |
| Change torque/motion control property of a character. More... | |
| int | SetJointAcc (const fVec &accs) |
| int | SetJointForce (const fVec &forces) |
| Set all joint forces/torques. More... | |
| int | SetJointValue (const fVec &values) |
| Set all joint values. More... | |
| int | SetJointVel (const fVec &vels) |
| Set all joint velocities/accelerations. More... | |
| int | SetStatus (const fVec &value, const fVec &vel, const fVec &acc) |
| Set current joint values, velocities, and accelerations. More... | |
| int | SetTorqueGiven (Joint *_joint, int _tg) |
| Change torque/motion control property of a joint. More... | |
| double | TotalCOM (fVec3 &com, const char *chname=0) |
| Center of mass of the chain. More... | |
| virtual | ~Chain () |
Protected Member Functions | |
| void | _apply_scale (Joint *jnt, double scale) |
| void | apply_geom_scale (SceneGraph *sg, Joint *cur) |
| virtual void | apply_scale () |
| void | apply_scale (const scale_object &_s) |
| void | apply_scale_sub (Joint *cur, double scale) |
| void | apply_scale_top (Joint *top, double scale) |
| void | calc_abs_positions (Joint *cur, SceneGraph *sg) |
| void | calc_rel_positions (Joint *cur, SceneGraph *sg) |
| virtual int | clear_data () |
| Clear arrays only; don't delete joints. More... | |
| virtual int | init (SceneGraph *sg) |
| Initialize the parameters. More... | |
| void | init_scale (SceneGraph *sg) |
| void | init_scale_sub (Node *node) |
| void | reset_scale () |
| void | reset_scale_sub (Joint *jnt) |
| void | set_all_torque_given (Joint *cur, int _tg) |
| void | set_relative_positions (SceneGraph *sg) |
Protected Attributes | |
| double ** | all_value |
| Pointers to the integration variables. More... | |
| double ** | all_value_dot |
| double ** | all_vel |
| double ** | all_vel_dot |
| int | do_connect |
| true after Connect() was called; application (or subclass) must reset the flag More... | |
| int | in_create_chain |
true if between BeginCreateChain() and EndCreateChain(). More... | |
| double * | init_value |
| double * | init_vel |
| double * | j_acc_p [4] |
| double * | j_value_dot [4] |
| for 4-th order Runge-Kutta More... | |
| int | n_dof |
| int | n_joint |
| int | n_thrust |
| total DOF of the joints with t_given = false More... | |
| int | n_value |
| Joint * | root |
| Chain information. More... | |
| std::list< scale_object > | scale_object_list |
Friends | |
| class | Joint |
The class representing the whole mechanism. May contain multiple characters.
| void Chain::add_scale_object | ( | const scale_object & | _s | ) |
Add a new joint target as a child of joint with name parent_name.
Add a new joint target as a child of joint p.
| [in] | target | the pointer to the new joint |
| [in] | parent_name | name of the parent joint |
| [in] | charname | character name of the parent joint |
|
protectedvirtual |
|
protected |
Indicates begining of creating a kinematic chain.
Indicates begining of creating a kinematic chain. Must be called before editing the chain.
| [in] | append | If false (default), clean up the current chain and build from scratch. Otherwise append new joints to the current chain. |
|
virtual |
|
protectedvirtual |
| void Chain::clear_scale_object_list | ( | ) |
| int Chain::ClearExtForce | ( | ) |
| int Chain::ClearJointForce | ( | ) |
Computes the com Jacobian.
Computes the com Jacobian.
| [out] | J | com Jacobian |
| [out] | com | com |
| [in] | chname | name of the character to compute com Jacobian; all joints if omitted |
Definition at line 18 of file jacobi.cpp.
| int Chain::CreateParallel | ( | int | num_char, |
| const char * | prmname, | ||
| const char * | charname, | ||
| const fVec3 & | init_pos = 0.0, |
||
| const fMat33 & | init_att = 1.0, |
||
| const fVec3 & | pos_offset = 0.0, |
||
| const fMat33 & | att_offset = 1.0, |
||
| int | init_num = 0 |
||
| ) |
Automatically generate multiple identical chains.
Generate num_char chains with identical structure in a prm file.
| [in] | num_char | number of chains to generate |
| [in] | prmname | prm file name |
| [in] | charname | character name (the actual name includes the number starting from init_num) |
| [in] | init_pos | the position offset of the first chain |
| [in] | init_att | the orientation offset of the first chain |
| [in] | pos_offset | the position offset of each chain from the previous |
| [in] | att_offset | the orientation offset of each chain from the previous |
| [in] | init_num | the number of the first chain |
| int Chain::CreateSerial | ( | int | num_joint, |
| const JointData & | joint_data, | ||
| const char * | charname = 0, |
||
| Joint * | parent_joint = 0 |
||
| ) |
Automatically generate a serial chain.
Generate a serial chain with num_joint joints.
| [in] | num_joint | number of joints |
| [in] | joint_data | JointData structure to be used as the template for the joints; each joint will named as joint_data.name + number |
| [in] | charname | character name (optional) |
| [in] | parent_joint | pointer to the root of the serial chain (optional); the global root if omitted or NULL |
| int Chain::EndCreateChain | ( | SceneGraph * | sg = NULL | ) |
Find a joint from name.
Find a joint from name. If charname is not null, find a joint whose basename is jname and character name is charname. Otherwise, find a joint whose name is jname.
| [in] | jname | joint name |
| [in] | charname | character name |
| int Chain::GetJointNameList | ( | char **& | jnames | ) |
|
protectedvirtual |
| int Chain::Integrate | ( | double | timestep | ) |
| int Chain::IntegrateAdaptive | ( | double & | timestep, |
| int | step, | ||
| double | min_timestep = DEFAULT_MIN_TIMESTEP, |
||
| double | max_integ_error = DEFAULT_MAX_INTEG_ERROR |
||
| ) |
Performs Euler integration with adaptive timestep.
Performs Euler integration with adaptive timestep. Requires two acceleration computations per step.
| [in,out] | timestep | inputs maximum timestep and overwritten by the actual timestep |
| [in] | step | step in the integration (0/1) |
| [in] | min_timestep | minimum timestep |
| [in] | max_integ_error | maximum error |
estimate the integration error by comparing x1 and x2, where (1) x1 = x(t) + xdot(t)dt (2) x(t+dt/2) = x(t) + xdot(t)dt/2, x2 = x(t+dt/2) + xdot(t+dt/2)dt/2 the actual timestep will be equal to or smaller than the timestep parameter, which will be overwritten by the actual timestep
| int Chain::IntegrateValue | ( | double | timestep | ) |
Load the chain from an XML file.
|
inline |
|
protected |
Save the chain data to a file in original (*.prm) format.
Save the chain data to a file in XML format.
|
protected |
Set all joint forces/torques.
Set all joint forces/torques. The index of the first data of a joint is Joint::i_dof.
Set all joint values.
Set all joint values. The orientation of spherical/free joints are represented as Euler parameters. The index of the first data of a joint is Joint::i_value.
Set all joint velocities/accelerations.
Set all joint velocities/accelerations. The index of the first data of a joint is Joint::i_dof.
|
protected |
|
protected |
|
protected |
true if between BeginCreateChain() and EndCreateChain().
|
protected |
|
protected |
|
protected |