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

Added get/setPose() and solref/solimp attributes

parent b301c3c9
No related branches found
No related tags found
No related merge requests found
#include "Attribute.h"
namespace mjcf
{
Eigen::Vector5f solimpDefault()
{
Eigen::Vector5f v;
v << 0.9f, 0.95f, 0.001f, 0.5, 2;
return v;
}
}
#pragma once
#include <VirtualRobot.h>
#include <VirtualRobot/math/Helpers.h>
#include "Element.h"
......@@ -296,7 +299,23 @@ namespace mjcf
// pose = pos + quat
#define mjcf_PoseAttributes(Derived) \
mjcf_PosAttribute(Derived);\
Eigen::Matrix4f getPose() const \
{ return math::Helpers::Pose(pos.get(), quat.get()); } \
void setPose(const Eigen::Matrix4f& p) \
{ pos = math::Helpers::Position(p); \
quat = Eigen::Quaternionf(math::Helpers::Orientation(p)); } \
mjcf_PosAttribute(Derived); \
mjcf_QuatAttribute(Derived)
Eigen::Vector5f mjcf_solimpDefault();
// solref
#define mjcf_SolrefAttribute(Derived) \
mjcf_AttributeDef(Derived, Eigen::Vector2f, solref, Eigen::Vector2f(0.02f, 1.f))
// solimp
#define mjcf_SolimpAttribute(Derived) \
mjcf_AttributeDef(Derived, Eigen::Vector5f, solimp, mjcf_solimpDefault())
}
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