frame_conversions.h
Go to the documentation of this file.
1#pragma once
2
3#include <Eigen/Core>
4
6
8#include <RobotAPI/libraries/armem_locations/aron/Location.aron.generated.h>
10
12{
13 void
14 toGlobal(armarx::navigation::location::arondto::Location& framedLoc,
15 const Eigen::Matrix4f& framedToGlobal)
16 {
17 if (framedLoc.framedPose.header.frame == armarx::GlobalFrame)
18 {
19 // No need to change to global
20 framedLoc.framedPose.header.agent = ""; // sanity set
21 return;
22 }
23
24 framedLoc.framedPose.pose = framedToGlobal * framedLoc.framedPose.pose;
25 framedLoc.framedPose.header.frame = armarx::GlobalFrame;
26 framedLoc.framedPose.header.agent = "";
27 }
28
29 void
30 toGlobal(armarx::navigation::location::arondto::Location& framedLoc,
31 const armarx::objpose::ObjectPose& objPose)
32 {
33 if (framedLoc.framedPose.header.frame == armarx::GlobalFrame)
34 {
35 // No need to change to global
36 framedLoc.framedPose.header.agent = ""; // sanity set
37 return;
38 }
39
40 if (simox::alg::starts_with(objPose.objectID.str(), framedLoc.framedPose.header.agent))
41 {
42 ARMARX_CHECK(framedLoc.framedPose.header.frame ==
43 "root"); // TODO: Right now we only allow root
44 toGlobal(framedLoc, objPose.objectPoseGlobal);
45 return;
46 }
47
48 throw armarx::LocalException(
49 "Could not convert a framedLocation because the used object is wrong!");
50 }
51
52} // namespace armarx::armem::locations
std::string str() const
Return "dataset/className" or "dataset/className/instanceName".
Definition ObjectID.cpp:60
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
std::string const GlobalFrame
Variable of the global coordinate system.
Definition FramedPose.h:65
void toGlobal(armarx::navigation::location::arondto::Location &framedLoc, const Eigen::Matrix4f &framedToGlobal)
An object pose as stored by the ObjectPoseStorage.
Definition ObjectPose.h:34
armarx::ObjectID objectID
The object ID, i.e. dataset, class name and instance name.
Definition ObjectPose.h:56
Eigen::Matrix4f objectPoseGlobal
The object pose in the global frame.
Definition ObjectPose.h:71