Skip to content

Commit

Permalink
Use pose multiplication instead of addition (#1369)
Browse files Browse the repository at this point in the history
The ign-math Pose addition operator is going to be
deprecated, so use the multiplication operator instead.
It works in the opposite order, matching the behavior
of coordinate transform multiplication.

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters authored Mar 2, 2022
1 parent b04aaed commit 6ac12c6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ math::Pose3d worldPose(const Entity &_entity,
if (!parentPose)
break;
// transform pose
pose = pose + parentPose->Data();
pose = parentPose->Data() * pose;
// keep going up the tree
p = _ecm.Component<components::ParentEntity>(p->Data());
}
Expand Down
4 changes: 2 additions & 2 deletions src/rendering/RenderUtil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ void RenderUtil::Update()
trajPose.Rot() = tf.second["actorPose"].Rotation();
}

actorVisual->SetLocalPose(trajPose + globalPose);
actorVisual->SetLocalPose(globalPose * trajPose);

tf.second.erase("actorPose");
actorMesh->SetSkeletonLocalTransforms(tf.second);
Expand Down Expand Up @@ -3035,7 +3035,7 @@ void RenderUtilPrivate::UpdateAnimation(const std::unordered_map<Entity,
trajPose.Rot() = poseFrame.Rotation();
}

actorVisual->SetLocalPose(trajPose + globalPose);
actorVisual->SetLocalPose(globalPose * trajPose);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/systems/optical_tactile_plugin/Visualization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ void OpticalTactilePluginVisualization::AddNormalForceToMarkerMsgs(
ignition::math::Pose3f normalForcePoseFromSensor(
normalForcePositionFromSensor, normalForceOrientationFromSensor);

ignition::math::Pose3f normalForcePoseFromWorld =
(normalForcePoseFromSensor + this->depthCameraOffset) + _sensorWorldPose;
ignition::math::Pose3f normalForcePoseFromWorld = _sensorWorldPose *
this->depthCameraOffset * normalForcePoseFromSensor;
normalForcePoseFromWorld.Correct();

// Get the start point of the normal force
Expand All @@ -222,8 +222,8 @@ void OpticalTactilePluginVisualization::AddNormalForceToMarkerMsgs(
normalForcePoseFromSensor.Set(normalForcePositionFromSensor +
_normalForce * this->forceLength, normalForceOrientationFromSensor);

normalForcePoseFromWorld =
(normalForcePoseFromSensor + this->depthCameraOffset) + _sensorWorldPose;
normalForcePoseFromWorld = _sensorWorldPose * this->depthCameraOffset *
normalForcePoseFromSensor;
normalForcePoseFromWorld.Correct();

ignition::math::Vector3f endPointFromWorld =
Expand Down

0 comments on commit 6ac12c6

Please sign in to comment.