Home | Tutorials | Wiki | Issues
Ask Your Question
0

How to get the angle value of the base link of a floating based robot in Gazebo9

asked 2018-06-22 06:49:38 -0500

longwoo gravatar image

updated 2018-06-22 06:50:08 -0500

According to the api gazebo 9.0 link. for example ,I can get

this->model->GetLink("link1")->WorldPose();
this->model->GetLink("link1")->WorldLinearVel();
this->model->GetLink("link1")->WorldAngularVel();
this->model->GetLink("link1")->WorldLinearAccel();

But I can not find a way to get the angle value of the base link of a floating based robot like

this->model->GetLink("link1")->WorldAngular();
this->model->GetLink("link1")->WorldTwist();

Is there any suggestion? Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-06-25 06:29:37 -0500

wentz gravatar image

The WorldPose() function return ignition::math::Pose3d which consists of the position and orientation. You can get these like this:

ignition::math::Vector3 pos = this->model->GetLink("link1")->WorldPose()->Pos();

ignition::math::Quaternion rot = this->model->GetLink("link1")->WorldPose()->Rot();

Since the twist is a combination of angular_vel + linear_vel you just combine the WorldLinearVel() and WorldAngularVel() and you have it.

edit flag offensive delete link more

Comments

Thank you. It works.

longwoo gravatar imagelongwoo ( 2018-06-26 00:45:14 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-06-22 06:49:38 -0500

Seen: 64 times

Last updated: Jun 25