Skip to content

Commit 5f31124

Browse files
committed
Moved utility function to message conversion utilities
1 parent 48d6891 commit 5f31124

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

devices/YarpRobotLoggerDevice/include/BipedalLocomotion/MessageConversionUtilities.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <trintrin/msgs/WearableTargets.h>
1414
#include <trintrin/msgs/WearableData.h>
1515

16+
#include <Eigen/Core>
17+
1618
#include <string>
1719

1820
namespace BipedalLocomotion
@@ -86,6 +88,14 @@ void convertToVectorsCollection(const trintrin::msgs::WearableData& message,
8688
const std::string& prefix,
8789
BipedalLocomotion::YarpUtilities::VectorsCollection& collection);
8890

91+
/**
92+
* @brief Convert a trintrin VectorXYZ message to an Eigen::Vector3d.
93+
*
94+
* @param vec The input VectorXYZ message to be converted.
95+
* @return Eigen::Vector3d The converted 3D vector.
96+
*/
97+
Eigen::Vector3d trintrinVectorXYZToVector3(const trintrin::msgs::VectorXYZ& vec);
98+
8999
}
90100

91101
#endif // BIPEDAL_LOCOMOTION_FRAMEWORK_YARP_ROBOT_LOGGER_DEVICE_MESSAGE_CONVERSION_UTILITIES_H

devices/YarpRobotLoggerDevice/src/MessageConversionUtilities.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,3 +428,12 @@ void BipedalLocomotion::convertToVectorsCollection(
428428
vsjoint.data.acceleration.z};
429429
}
430430
}
431+
432+
Eigen::Vector3d BipedalLocomotion::trintrinVectorXYZToVector3(const trintrin::msgs::VectorXYZ& vec)
433+
{
434+
Eigen::Vector3d eigenVec;
435+
eigenVec(0) = vec.x;
436+
eigenVec(1) = vec.y;
437+
eigenVec(2) = vec.z;
438+
return eigenVec;
439+
}

devices/YarpRobotLoggerDevice/src/YarpRobotLoggerDevice.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,6 @@ void findAndReplaceAll(std::string& data,
8282
}
8383
}
8484

85-
Eigen::Vector3d trintrinVectorXYZToVector3(const trintrin::msgs::VectorXYZ& vec)
86-
{
87-
Eigen::Vector3d eigenVec;
88-
eigenVec(0) = vec.x;
89-
eigenVec(1) = vec.y;
90-
eigenVec(2) = vec.z;
91-
return eigenVec;
92-
}
93-
9485
bool YarpRobotLoggerDevice::VectorsCollectionSignal::connect()
9586
{
9687
return client.connect();

0 commit comments

Comments
 (0)