Skip to content
Snippets Groups Projects
Commit 400b2cfb authored by Fabian Reister's avatar Fabian Reister
Browse files

occupancy grid conversion

parent c0f41f49
No related branches found
No related tags found
No related merge requests found
...@@ -6,14 +6,12 @@ ...@@ -6,14 +6,12 @@
#include <RobotAPI/interface/units/LaserScannerUnit.h> #include <RobotAPI/interface/units/LaserScannerUnit.h>
#include <RobotAPI/libraries/armem_vision/aron/LaserScan.aron.generated.h> #include <RobotAPI/libraries/armem_vision/aron/LaserScan.aron.generated.h>
#include <RobotAPI/libraries/aron/common/aron_conversions.h>
#include <RobotAPI/libraries/aron/converter/common/Converter.h> #include <RobotAPI/libraries/aron/converter/common/Converter.h>
#include <RobotAPI/libraries/aron/core/navigator/data/complex/NDArray.h> #include <RobotAPI/libraries/aron/core/navigator/data/complex/NDArray.h>
#include <RobotAPI/libraries/aron/common/aron_conversions.h>
#include "types.h" #include "types.h"
namespace armarx::armem namespace armarx::armem
{ {
...@@ -27,8 +25,8 @@ namespace armarx::armem ...@@ -27,8 +25,8 @@ namespace armarx::armem
SensorHeader fromAron(const arondto::SensorHeader& aronSensorHeader) SensorHeader fromAron(const arondto::SensorHeader& aronSensorHeader)
{ {
return {.agent = aronSensorHeader.agent, return {.agent = aronSensorHeader.agent,
.frame = aronSensorHeader.frame, .frame = aronSensorHeader.frame,
.timestamp = timeFromAron(aronSensorHeader.timestamp)}; .timestamp = timeFromAron(aronSensorHeader.timestamp)};
} }
...@@ -39,8 +37,10 @@ namespace armarx::armem ...@@ -39,8 +37,10 @@ namespace armarx::armem
// laserScan.data = fromAron(aronLaserScan.data); // laserScan.data = fromAron(aronLaserScan.data);
} }
void fromAron(const arondto::LaserScanStamped& aronLaserScan, LaserScan& laserScan, void fromAron(const arondto::LaserScanStamped& aronLaserScan,
std::int64_t& timestamp, std::string& frame, LaserScan& laserScan,
std::int64_t& timestamp,
std::string& frame,
std::string& agentName) std::string& agentName)
{ {
const auto header = fromAron(aronLaserScan.header); const auto header = fromAron(aronLaserScan.header);
...@@ -48,14 +48,12 @@ namespace armarx::armem ...@@ -48,14 +48,12 @@ namespace armarx::armem
// laserScan = fromAron(aronLaserScan.data); // laserScan = fromAron(aronLaserScan.data);
timestamp = header.timestamp.toMicroSeconds(); timestamp = header.timestamp.toMicroSeconds();
frame = header.frame; frame = header.frame;
agentName = header.agent; agentName = header.agent;
} }
/************ toAron ************/ /************ toAron ************/
// auto toAron(const LaserScan& laserScan, aron::LaserScan& aronLaserScan) // auto toAron(const LaserScan& laserScan, aron::LaserScan& aronLaserScan)
// { // {
// aronLaserScan.scan = toAron(laserScan); // aronLaserScan.scan = toAron(laserScan);
...@@ -70,8 +68,8 @@ namespace armarx::armem ...@@ -70,8 +68,8 @@ namespace armarx::armem
{ {
arondto::SensorHeader aronSensorHeader; arondto::SensorHeader aronSensorHeader;
aronSensorHeader.agent = sensorHeader.agent; aronSensorHeader.agent = sensorHeader.agent;
aronSensorHeader.frame = sensorHeader.frame; aronSensorHeader.frame = sensorHeader.frame;
aronSensorHeader.timestamp = toAron(sensorHeader.timestamp); aronSensorHeader.timestamp = toAron(sensorHeader.timestamp);
return aronSensorHeader; return aronSensorHeader;
...@@ -94,20 +92,21 @@ namespace armarx::armem ...@@ -94,20 +92,21 @@ namespace armarx::armem
{ {
.agent = agentName, .frame = frame, .timestamp = timestamp}; .agent = agentName, .frame = frame, .timestamp = timestamp};
const LaserScanStamped laserScanStamped{.header = header, .data = laserScan}; const LaserScanStamped laserScanStamped{.header = header,
.data = laserScan};
toAron(laserScanStamped, aronLaserScanStamped); toAron(laserScanStamped, aronLaserScanStamped);
} }
void toAron(arondto::OccupancyGrid& dto, const OccupancyGrid& bo) void toAron(arondto::OccupancyGrid& dto, const OccupancyGrid& bo)
{ {
aron::toAron(dto.frame, bo.frame); aron::toAron(dto.frame, bo.frame);
aron::toAron(dto.pose, bo.pose); aron::toAron(dto.pose, bo.pose);
aron::toAron(dto.resolution, bo.resolution); aron::toAron(dto.resolution, bo.resolution);
// bo.grid is NdArray -> need special handling. // bo.grid is NdArray -> need special handling.
} }
void fromAron(arondto::OccupancyGrid& dto, OccupancyGrid& bo) void fromAron(const arondto::OccupancyGrid& dto, OccupancyGrid& bo)
{ {
aron::fromAron(dto.frame, bo.frame); aron::fromAron(dto.frame, bo.frame);
aron::fromAron(dto.pose, bo.pose); aron::fromAron(dto.pose, bo.pose);
...@@ -115,4 +114,4 @@ namespace armarx::armem ...@@ -115,4 +114,4 @@ namespace armarx::armem
// bo.grid is NdArray -> need special handling. // bo.grid is NdArray -> need special handling.
} }
} // namespace armarx::armem } // namespace armarx::armem
\ No newline at end of file \ No newline at end of file
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <RobotAPI/libraries/armem/core/Time.h> #include <RobotAPI/libraries/armem/core/Time.h>
#include <RobotAPI/libraries/armem_vision/aron/OccupancyGrid.aron.generated.h> #include <RobotAPI/libraries/armem_vision/aron/OccupancyGrid.aron.generated.h>
#include <RobotAPI/libraries/aron/converter/common/VectorConverter.h> #include <RobotAPI/libraries/aron/converter/common/VectorConverter.h>
#include <RobotAPI/libraries/aron/converter/eigen/EigenConverter.h>
#include <RobotAPI/libraries/aron/core/navigator/data/complex/NDArray.h> #include <RobotAPI/libraries/aron/core/navigator/data/complex/NDArray.h>
namespace armarx::armem namespace armarx::armem
...@@ -49,7 +50,7 @@ namespace armarx::armem ...@@ -49,7 +50,7 @@ namespace armarx::armem
auto fromAron(const aron::datanavigator::NDArrayNavigatorPtr& navigator) auto fromAron(const aron::datanavigator::NDArrayNavigatorPtr& navigator)
{ {
return aron::converter::AronVectorConverter::ConvertToVector<T>( return aron::converter::AronVectorConverter::ConvertToVector<T>(
navigator); navigator);
} }
void fromAron(const arondto::LaserScanStamped& aronLaserScan, void fromAron(const arondto::LaserScanStamped& aronLaserScan,
...@@ -70,12 +71,12 @@ namespace armarx::armem ...@@ -70,12 +71,12 @@ namespace armarx::armem
// OccupancyGrid // OccupancyGrid
void toAron(arondto::OccupancyGrid& dto, const OccupancyGrid& bo); void toAron(arondto::OccupancyGrid& dto, const OccupancyGrid& bo);
void fromAron(arondto::OccupancyGrid& dto, OccupancyGrid& bo); void fromAron(const arondto::OccupancyGrid& dto, OccupancyGrid& bo);
inline aron::datanavigator::NDArrayNavigatorPtr inline aron::datanavigator::NDArrayNavigatorPtr
toAron(const OccupancyGrid::Grid& grid) toAron(const OccupancyGrid::Grid& grid)
{ {
return aron::converter::AronVectorConverter::ConvertFromVector(grid); return aron::converter::AronEigenConverter::ConvertFromArray(grid);
} }
} // namespace armarx::armem } // namespace armarx::armem
\ No newline at end of file
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