Skip to content

Commit 71a1955

Browse files
authored
Update Getentity state to return normalized quatanion and relative to refrecne (#17)
1 parent c54d106 commit 71a1955

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Source/RapyutaSimulationPlugins/Private/Tools/SimulationState.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,12 @@ void ASimulationState::GetEntityStateSrv(UROS2GenericSrv* Service)
8888
}
8989
AActor* Entity = Entities[Request.name];
9090
Response.state_name = Request.name;
91-
FVector Pos = Entity->GetActorLocation() / 100.f - RefPos;
91+
FVector Pos = RefQuat.Inverse().RotateVector(Entity->GetActorLocation() / 100.f - RefPos);
9292
Response.state_pose_position_x = Pos.X;
9393
Response.state_pose_position_y = Pos.Y;
9494
Response.state_pose_position_z = Pos.Z;
9595
Response.state_pose_orientation = Entity->GetActorQuat() * RefQuat.Inverse();
96+
Response.state_pose_orientation.Normalize();
9697
LeftToRight(Response.state_pose_position_x,
9798
Response.state_pose_position_y,
9899
Response.state_pose_position_z,

0 commit comments

Comments
 (0)