Go to the documentation of this file.
43 virtual void onJointPathUpdated();
47 virtual bool calcInverseKinematics(
const Vector3& end_p,
const Matrix33& end_R);
48 virtual bool hasAnalyticalIK();
56 customizerInterface->destroy(customizerHandle);
62 for(
unsigned int sensorType =0; sensorType < numSensorTypes(); ++sensorType){
63 int n = numSensors(sensorType);
64 for(
int i=0;
i <
n; ++
i){
65 Sensor* s = sensor(sensorType,
i);
79 customizerInterface = 0;
80 bodyHandleEntity.body =
this;
81 bodyHandle = &bodyHandleEntity;
86 : allSensors(
Sensor::NUM_SENSOR_TYPES)
100 modelName_(org.modelName_),
101 allSensors(
Sensor::NUM_SENSOR_TYPES)
111 std::map<Link*, int> linkToIndexMap;
115 linkToIndexMap[lnk] =
i;
119 for(
int sensorType = 0; sensorType <
n; ++sensorType){
123 int linkIndex = linkToIndexMap[orgSensor->
link];
126 *cloneSensor = *orgSensor;
135 for(
int j=0; j < 2; ++j){
177 empty->
R.setIdentity();
189 empty->
Rs.setIdentity();
195 empty->
dvo.setZero();
196 empty->
fext.setZero();
221 for(
int i=0;
i <
n; ++
i){
245 std::cerr <<
"Warning: Model " <<
modelName_ <<
246 " has empty joint ID in the valid IDs." << std::endl;
281 for(
int i=0;
i <
n; ++
i){
302 for(
int i=0;
i <
n; ++
i){
317 for(
int i=0;
i <
n;
i++){
353 out_M.resize(totaldof,totaldof);
354 b1.resize(totaldof, 1);
361 ddqorg[
i] =
ptr->ddq;
376 for(
int i=0;
i < 3; ++
i){
381 for(
int i=0;
i < 3; ++
i){
396 out_M(j, j) +=
ptr->Jm2;
401 for(
int i = 0;
i < out_M.cols(); ++
i){
408 ptr->ddq = ddqorg[
i];
425 out_M.block<6,1>(0, column) <<
f, tau;
429 for(
int i = 0;
i <
n; ++
i){
431 out_M(
i + 6, column) =
ptr->u;
446 sw.noalias() = parent->
R *
ptr->a;
447 sv =
ptr->p.cross(sw);
453 ptr->vo = parent->
vo + sv *
ptr->dq;
454 ptr->w = parent->
w + sw *
ptr->dq;
456 dsv = parent->
w.cross(sv) + parent->
vo.cross(sw);
457 dsw = parent->
w.cross(sw);
459 ptr->dw = parent->
dw + dsw *
ptr->dq + sw *
ptr->ddq;
470 I.noalias() =
ptr->R *
ptr->I *
ptr->R.transpose();
472 I.noalias() +=
ptr->m * c_hat * c_hat.transpose();
473 P.noalias() =
ptr->m * (
ptr->vo +
ptr->w.cross(
c));
476 out_f =
ptr->m * (
ptr->dvo +
ptr->dw.cross(
c)) +
ptr->w.cross(P);
477 out_tau =
ptr->m *
c.cross(
ptr->dvo) + I *
ptr->dw +
ptr->vo.cross(P) +
ptr->w.cross(L);
487 ptr->u =
ptr->sv.dot(out_f) +
ptr->sw.dot(out_tau);
514 for(
int i=0;
i <
n;
i++){
542 for(
int i=0;
i <
n;
i++){
571 if(sensorType < Sensor::NUM_SENSOR_TYPES && id >= 0){
574 int n = sensors.size();
576 sensors.resize(
id + 1, 0);
580 std::cerr <<
"duplicated sensor Id is specified(id = "
581 <<
id <<
", name = " <<
name <<
")" << std::endl;
601 if(sensorType < Sensor::NUM_SENSOR_TYPES && id >= 0){
603 int n = sensors.size();
605 sensors.resize(
id + 1, 0);
607 Sensor* sameId = sensors[id];
609 std::cerr <<
"duplicated sensor Id is specified(id = "
610 <<
id <<
", name = " <<
sensor->
name <<
")" << std::endl;
652 for(
int i=0;
i <
n; ++
i){
663 for(
int i=0;
i <
n; ++
i){
674 out <<
"Body: model name = " <<
modelName_ <<
" name = " <<
name_ <<
"\n\n";
677 for(
int i=0;
i <
n; ++
i){
696 return interface ? installCustomizer(interface) : false;
834 p_relative.noalias() = baseLink_->
R.transpose() * (end_p - baseLink_->
p);
835 R_relative.noalias() = baseLink_->
R.transpose() * end_R;
837 p_relative.noalias() = end_R.transpose() * (baseLink_->
p - end_p);
838 R_relative.noalias() = end_R.transpose() * baseLink_->
R;
850 double errsqr = dp.dot(dp) + omega.dot(omega);
879 Link *skip =
jp->joint(0);
901 for (
unsigned int i=1;
i<
jp->numJoints();
i++){
916 for (
unsigned int i=0;
i<
jp->numJoints();
i++)
sgn[
jp->joint(
i)->jointId] = -1;
937 std::cerr <<
"calcCMJacobian() : unsupported jointType("
943 J(0,
c ) = 1.0; J(0,
c+1) = 0.0; J(0,
c+2) = 0.0;
944 J(1,
c ) = 0.0; J(1,
c+1) = 1.0; J(1,
c+2) = 0.0;
945 J(2,
c ) = 0.0; J(2,
c+1) = 0.0; J(2,
c+2) = 1.0;
948 J(0,
c+3) = 0.0; J(0,
c+4) = dp(2); J(0,
c+5) = -dp(1);
949 J(1,
c+3) = -dp(2); J(1,
c+4) = 0.0; J(1,
c+5) = dp(0);
950 J(2,
c+3) = dp(1); J(2,
c+4) = -dp(0); J(2,
c+5) = 0.0;
966 Link *skip =
jp->joint(0);
988 for (
unsigned int i=1;
i<
jp->numJoints();
i++){
1003 for (
unsigned int i=0;
i<
jp->numJoints();
i++)
sgn[
jp->joint(
i)->jointId] = -1;
1030 std::cerr <<
"calcCMJacobian() : unsupported jointType("
1036 H.block(0,
c, 3, 3).setZero();
1039 H.block(0,
c+3, 3, 3) = Iw;
1046 H.block(0,0,3,
c) -= cm_cross * M;
HRP_UTIL_EXPORT Vector3 omegaFromRot(const Matrix33 &r)
ConstraintForceArray constraintForces
@ ROTATIONAL_JOINT
6-DOF root link
LinkTraverse linkTraverse_
void calcSubMassInertia(Matrix33 &subIw)
compute sum of I of subtree
ColdetModelPtr coldetModel
virtual void find(Link *root, bool doUpward=false, bool doDownward=true)
NameToLinkMap nameToLinkMap
unsigned int numJoints() const
Link * joint(int index) const
bool isCustomizedIkPathReversed
void clearExternalForces()
Vector3 fext
external force
void setDefaultRootPosition(const Vector3 &p, const Matrix33 &R)
double Jm2
Equivalent rotor inertia: n^2*Jm [kg.m^2].
double ddq
joint acceleration
void calcInverseDynamics(Link *link, Vector3 &out_f, Vector3 &out_tau)
LinkArray jointIdToLinkArray
Sensor * createSensor(Link *link, int sensorType, int id, const std::string &name)
unsigned int numSensors(int sensorType) const
BodyCustomizerDestroyFunc destroy
Link * createEmptyJoint(int jointId)
BodyCustomizerSetVirtualJointForcesFunc setVirtualJointForces
CustomizedJointPath(Body *body, Link *baseLink, Link *targetLink)
Vector3 defaultRootPosition
static const char * getLinkName(BodyHandle bodyHandle, int linkIndex)
unsigned int numSensorTypes() const
Vector3 vo
translation elements of spacial velocity
std::ostream & operator<<(std::ostream &out, Body &body)
virtual bool calcInverseKinematics(const Vector3 &end_p, const Matrix33 &end_R)
BodyCustomizerInitializeAnalyticIkFunc initializeAnalyticIk
void setRootLink(Link *link)
unsigned int numLinks() const
void updateLinkColdetModelPositions()
unsigned int numJoints() const
Link * link(int index) const
Sensor * sensor(int sensorType, int sensorId) const
void calcCMJacobian(Link *base, dmatrix &J)
compute CoM Jacobian
Vector3 w
angular velocity, omega
BodyCustomizerInterface * customizerInterface
static BodyInterface * bodyInterface()
const std::string & name()
void calcMassMatrix(dmatrix &out_M)
friend class CustomizedJointPath
void calcForwardKinematics(bool calcVelocity=false, bool calcAcceleration=false) const
void addSensor(Sensor *sensor, int sensorType, int id)
static Sensor * create(int type)
void getDefaultRootPosition(Vector3 &out_p, Matrix33 &out_R)
void setAttitude(const Matrix33 &R)
static double * getJointValuePtr(BodyHandle bodyHandle, int linkIndex)
double lvlimit
the lower limit of joint velocities
void setColumnOfMassMatrix(dmatrix &M, int column)
static double * getJointTorqueForcePtr(BodyHandle bodyHandle, int linkIndex)
void calcSubMassCM()
compute sum of m x wc of subtree
@ SLIDE_JOINT
translational joint (1 dof)
void calcTotalMomentum(Vector3 &out_P, Vector3 &out_L)
BodyCustomizerCreateFunc create
virtual bool calcInverseKinematics(const Vector3 &end_p, const Matrix33 &end_R)
The header file of the LinkPath and JointPath classes.
Vector3 b
relative position (parent local)
Matrix33 Rs
relative attitude of the link segment (self local)
Matrix33 hat(const Vector3 &c)
static const bool PUT_DEBUG_MESSAGE
Light * light(const std::string &name)
Light * createLight(Link *link, int lightType, const std::string &name)
double uvlimit
the upper limit of joint velocities
NameToSensorMap nameToSensorMap
std::vector< Sensor * > SensorArray
unsigned int numLinks() const
Vector3 tauext
external torque (around the world origin)
static void destroy(Sensor *sensor)
void initializeConfiguration()
png_infop png_charpp name
Matrix33 defaultRootAttitude
void calcForwardKinematics(bool calcVelocity=false, bool calcAcceleration=false) const
The definitions of the body customizer interface for increasing binary compatibility.
NameToLightMap nameToLightMap
std::vector< ExtraJoint > extraJoints
void calcTotalMomentumFromJacobian(Vector3 &out_P, Vector3 &out_L)
Vector3 dv
linear acceleration
Matrix33 I
inertia tensor (self local, around c)
boost::shared_ptr< JointPath > JointPathPtr
static int getLinkIndexFromName(BodyHandle bodyHandle, const char *linkName)
Vector3 cross(const Vector3 &v1, const Vector3 &v2)
static const int BODY_INTERFACE_VERSION
Vector3 dvo
derivative of vo
void calcAngularMomentumJacobian(Link *base, dmatrix &H)
compute Angular Momentum Jacobian around CoM of base
virtual ~CustomizedJointPath()
static Link * extractLink(BodyHandle bodyHandle, int linkIndex)
Vector3 dw
derivative of omega
Vector3 a
rotational joint axis (self local)
void putInformation(std::ostream &out)
JointPathPtr getJointPath(Link *baseLink, Link *targetLink)
double llimit
the lower limit of joint values
Vector3 d
translation joint axis (self local)
double subm
mass of subtree
@ FIXED_JOINT
fixed joint(0 dof)
void calcForwardKinematics(bool calcVelocity=false, bool calcAcceleration=false)
Vector3 c
center of mass (self local)
virtual void onJointPathUpdated()
std::vector< Sensor * > sensors
sensors attached to this link
double ulimit
the upper limit of joint values
virtual bool hasAnalyticalIK()
static double * getJointVelocityPtr(BodyHandle bodyHandle, int linkIndex)
int jointId
jointId value written in a model file
Link * joint(int id) const
BodyCustomizerHandle customizerHandle
Vector3 submwc
sum of m x wc of subtree
Matrix33 segmentAttitude()
void setVirtualJointForcesSub()
static bool pluginsInDefaultDirectoriesLoaded
double Ir
rotor inertia [kg.m^2]
std::vector< SensorArray > allSensors
HRPMODEL_API int loadBodyCustomizers(const std::string pathString, BodyInterface *bodyInterface)
openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:02