Skip to content
Snippets Groups Projects
Commit 5f7f2982 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Use proprioception type. WIP: Transform robot unit data to format

parent 42102108
No related branches found
No related tags found
2 merge requests!185Clean up interfaces and unneeded code in memory core classes,!178Draft: Make RobotStateMemory ready
This commit is part of merge request !178. Comments created here will be created in the context of that merge request.
......@@ -26,6 +26,7 @@
#include <RobotAPI/libraries/armem_robot/aron_conversions.h>
#include <RobotAPI/libraries/armem_robot/robot_conversions.h>
#include <RobotAPI/libraries/armem_robot/aron/RobotDescription.aron.generated.h>
#include <RobotAPI/libraries/armem_robot_state/aron/Proprioception.aron.generated.h>
namespace armarx::armem::server::robot_state::description
......
......@@ -21,7 +21,7 @@
#include <RobotAPI/libraries/armem_robot/robot_conversions.h>
#include <RobotAPI/libraries/armem_robot/aron/Robot.aron.generated.h>
#include <RobotAPI/libraries/armem_robot_state/aron/JointState.aron.generated.h>
#include <RobotAPI/libraries/armem_robot_state/aron/Proprioception.aron.generated.h>
#include <RobotAPI/libraries/armem_objects/aron_conversions.h>
......@@ -31,7 +31,7 @@ namespace armarx::armem::server::robot_state::proprioception
{
Segment::Segment(armem::server::MemoryToIceAdapter& memoryToIceAdapter) :
SpecializedSegment(memoryToIceAdapter, nullptr,
SpecializedSegment(memoryToIceAdapter, prop::arondto::Proprioception::toAronType(),
"Proprioception", 1024)
{
}
......@@ -106,23 +106,20 @@ namespace armarx::armem::server::robot_state::proprioception
TIMING_END_COMMENT_STREAM(tGetLatestInstance, "tGetLatestInstance " + std::to_string(i), ARMARX_DEBUG);
TIMING_START(tCastJointState);
// tryCast is too slow.
// const auto jointState = tryCast<armarx::armem::arondto::JointState>(entityInstance);
aron::datanavigator::DictNavigatorPtr data = entityInstance.data();
// Avoid throwing an exception.
if (!(data->hasElement("name") && data->hasElement("position")))
{
continue;
}
armarx::armem::arondto::JointState jointState;
jointState.name = adn::StringNavigator::DynamicCastAndCheck(data->getElement("name"))->getValue();
jointState.position = adn::FloatNavigator::DynamicCastAndCheck(data->getElement("position"))->getValue();
const std::string jointName = adn::StringNavigator::DynamicCastAndCheck(data->getElement("name"))->getValue();
const float jointPosition = adn::FloatNavigator::DynamicCastAndCheck(data->getElement("position"))->getValue();
TIMING_END_COMMENT_STREAM(tCastJointState, "tCastJointState " + std::to_string(i), ARMARX_DEBUG);
TIMING_START(tEmplace);
if (jointState.name.size() > 0)
if (not jointName.empty())
{
jointMap[robotName].emplace(jointState.name, jointState.position);
jointMap[robotName].emplace(jointName, jointPosition);
}
else
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment