utils.cpp
Go to the documentation of this file.
1
#include "
utils.h
"
2
3
#include <
RobotAPI/libraries/armem_robot_state/aron_conversions.h
>
4
#include <
RobotAPI/libraries/armem_objects/client/articulated_object/aron_conversions.h
>
5
6
#include <
ArmarXCore/core/logging/Logging.h
>
7
8
namespace
armarx::armem::articulated_object
9
{
10
std::optional<robot_state::description::RobotDescription>
11
convertRobotDescription
(
const
armem::wm::EntityInstance
& instance)
12
{
13
14
arondto::ObjectClass aronObjectInfo;
15
try
16
{
17
aronObjectInfo.fromAron(instance.
data
());
18
}
19
catch
(...)
20
{
21
ARMARX_WARNING
<<
"Conversion to ObjectPose failed!"
;
22
return
std::nullopt;
23
}
24
25
robot_state::description::RobotDescription
robotDescription;
26
fromAron
(aronObjectInfo, robotDescription);
27
28
// check if robot description is valid
29
const
auto
xml = robotDescription.
xml
.
serialize
();
30
if
(robotDescription.
name
.empty() or xml.package.empty() or xml.path.empty())
31
{
32
return
std::nullopt;
33
}
34
35
return
robotDescription;
36
}
37
38
}
// namespace armarx::armem::articulated_object
armarx::armem::robot_state::description::RobotDescription
Definition:
types.h:44
armarx::armem::wm::EntityInstance
Client-side working entity instance.
Definition:
memory_definitions.h:32
armarx::armem::robot_state::description::RobotDescription::xml
PackagePath xml
Definition:
types.h:49
armarx::PackagePath::serialize
data::PackagePath serialize() const
Definition:
PackagePath.cpp:76
armarx::armem::articulated_object::convertRobotDescription
std::optional< robot_state::description::RobotDescription > convertRobotDescription(const armem::wm::EntityInstance &instance)
Definition:
utils.cpp:11
aron_conversions.h
utils.h
armarx::armem::fromAron
void fromAron(const arondto::MemoryID &dto, MemoryID &bo)
Definition:
aron_conversions.cpp:8
aron_conversions.h
armarx::armem::robot_state::description::RobotDescription::name
std::string name
Definition:
types.h:48
armarx::armem::articulated_object
Definition:
ArticulatedObjectReader.cpp:25
Logging.h
ARMARX_WARNING
#define ARMARX_WARNING
Definition:
Logging.h:186
armarx::armem::base::EntityInstanceBase::data
const DataT & data() const
Definition:
EntityInstanceBase.h:129
RobotAPI
libraries
armem_objects
client
articulated_object
utils.cpp
Generated on Sat Oct 12 2024 09:14:09 for armarx_documentation by
1.8.17