Skip to content

Commit

Permalink
apply origin rotation to inertia box visualization (#1171)
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas Otto <[email protected]>
  • Loading branch information
ottojo authored Mar 20, 2024
1 parent 175110b commit 2273179
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -897,8 +897,14 @@ void RobotLink::createInertia(const urdf::LinkConstSharedPtr & link)
link->inertial->origin.position.x,
link->inertial->origin.position.y,
link->inertial->origin.position.z);

double x, y, z, w;
link->inertial->origin.rotation.getQuaternion(x, y, z, w);
Ogre::Quaternion originRotate(w, x, y, z);

Ogre::Quaternion rotate(box_rot.W(), box_rot.X(), box_rot.Y(), box_rot.Z());
Ogre::SceneNode * offset_node = inertia_node_->createChildSceneNode(translate, rotate);
Ogre::SceneNode * offset_node = inertia_node_->createChildSceneNode(
translate, originRotate * rotate);
inertia_shape_ = new Shape(Shape::Cube, scene_manager_, offset_node);

inertia_shape_->setColor(1, 0, 0, 1);
Expand Down

0 comments on commit 2273179

Please sign in to comment.