Skip to content

Commit

Permalink
Add Eigen::Vector3d yaml support
Browse files Browse the repository at this point in the history
  • Loading branch information
Levi-Armstrong committed Oct 10, 2023
1 parent 783a6dd commit 1ec9ab1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tesseract_common/include/tesseract_common/yaml_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,30 @@ struct convert<Eigen::Vector2d>
}
};

template <>
struct convert<Eigen::Vector3d>
{
static Node encode(const Eigen::Vector3d& rhs)
{
Node node;
for (long i = 0; i < rhs.size(); ++i)
node.push_back(rhs(i));

return node;
}

static bool decode(const Node& node, Eigen::Vector3d& rhs)
{
if (!node.IsSequence() || (node.size() != 3))
return false;

for (long i = 0; i < 3; ++i)
rhs(i) = node[i].as<double>();

return true;
}
};

template <>
struct convert<tesseract_common::KinematicsPluginInfo>
{
Expand Down

0 comments on commit 1ec9ab1

Please sign in to comment.