30 #ifndef EXOTICA_CORE_KINEMATIC_ELEMENT_H_ 31 #define EXOTICA_CORE_KINEMATIC_ELEMENT_H_ 35 #include <kdl/frames.hpp> 36 #include <kdl/segment.hpp> 50 Eigen::Vector3d
scale = Eigen::Vector3d::Ones();
51 Eigen::Vector4d
color = Eigen::Vector4d(1.0, 1.0, 1.0, 1.0);
66 std::shared_ptr<KinematicElement> my_parent = parent.lock();
69 my_parent->RemoveExpiredChildren();
75 std::shared_ptr<KinematicElement> element = parent.lock();
76 closest_robot_link = std::shared_ptr<KinematicElement>(
nullptr);
77 while (element && element->id > 0)
79 if (element->is_robot_link)
81 closest_robot_link = element;
84 element = element->parent.lock();
86 SetChildrenClosestRobotLink();
91 if (is_trajectory_generated)
93 return generated_offset;
97 return segment.pose(
x);
103 for (
size_t i = 0; i < children.size(); ++i)
105 if (children[i].expired())
107 children.erase(children.begin() + i);
114 bool is_controlled =
false;
117 std::vector<std::weak_ptr<KinematicElement>>
children;
118 std::weak_ptr<KinematicElement> closest_robot_link = std::shared_ptr<KinematicElement>(
nullptr);
122 bool is_trajectory_generated =
false;
124 double velocity_limit = std::numeric_limits<double>::quiet_NaN();
125 double acceleration_limit = std::numeric_limits<double>::quiet_NaN();
128 Eigen::Vector3d
scale = Eigen::Vector3d::Ones();
129 bool is_robot_link =
false;
130 Eigen::Vector4d
color = Eigen::Vector4d(0.5, 0.5, 0.5, 1.0);
136 std::stack<std::shared_ptr<KinematicElement>> elements;
137 for (
auto child : children) elements.push(child.lock());
138 while (!elements.empty())
140 auto parent = elements.top();
142 parent->closest_robot_link = closest_robot_link;
143 for (
auto child : parent->children) elements.push(child.lock());
149 #endif // EXOTICA_CORE_KINEMATIC_ELEMENT_H_
std::vector< std::weak_ptr< KinematicElement > > children
void SetChildrenClosestRobotLink()
std::weak_ptr< KinematicElement > parent
KDL::Frame GetPose(const double &x=0.0)
std::shared_ptr< Shape > ShapePtr
void UpdateClosestRobotLink()
EIGEN_MAKE_ALIGNED_OPERATOR_NEW std::string name
EIGEN_MAKE_ALIGNED_OPERATOR_NEW KinematicElement(int _id, std::shared_ptr< KinematicElement > _parent, const KDL::Segment &_segment)
std::vector< VisualElement > visual
std::vector< double > joint_limits
void RemoveExpiredChildren()
std::string shape_resource_path
std::shared_ptr< const Shape > ShapeConstPtr