59 t = std::min(std::max(0.0, t), 1.0);
60 ss <<
", clipped |t| " << t;
87 for (
int i = 0; i <
kinematics[0].Phi.rows(); ++i)
89 const Eigen::Vector3d p =
line_start_ + Eigen::Map<const Eigen::Vector3d>(
kinematics[0].Phi(i).p.data);
97 if (jacobian.rows() !=
kinematics[0].jacobian.rows() * 3 || jacobian.cols() !=
kinematics[0].jacobian(0).data.cols())
ThrowNamed(
"Wrong size of jacobian! " <<
kinematics[0].jacobian(0).data.cols());
99 for (
int i = 0; i <
kinematics[0].Phi.rows(); ++i)
102 const Eigen::Vector3d p =
line_start_ + Eigen::Map<const Eigen::Vector3d>(
kinematics[0].Phi(i).p.data);
105 phi.segment<3>(i * 3) = dv;
107 if ((dv + p -
line_start_).norm() < std::numeric_limits<double>::epsilon())
110 jacobian.middleRows<3>(i * 3) = -
kinematics[0].jacobian[i].data.topRows<3>();
114 for (
int j = 0; j < jacobian.cols(); ++j)
116 jacobian.middleRows<3>(i * 3).col(j) =
kinematics[0].jacobian[i].data.topRows<3>().col(j).dot(
line_ /
line_.squaredNorm()) *
line_ -
kinematics[0].jacobian[i].data.topRows<3>().col(j);
124 const std::string common_frame =
"exotica/" +
base_name_;
125 visualization_msgs::MarkerArray ma;
128 visualization_msgs::Marker mc;
130 mc.frame_locked =
true;
131 mc.header.frame_id = common_frame;
133 mc.type = visualization_msgs::Marker::ARROW;
138 geometry_msgs::Point pp;
142 mc.points.push_back(pp);
144 const Eigen::Vector3d pe = p + dv;
148 mc.points.push_back(pp);
153 ma.markers.push_back(mc);
157 visualization_msgs::Marker ml;
159 ml.frame_locked =
true;
160 ml.header.frame_id = common_frame;
162 ml.type = visualization_msgs::Marker::SPHERE;
170 ml.pose.position.x = p.x();
171 ml.pose.position.y = p.y();
172 ml.pose.position.z = p.z();
173 ma.markers.push_back(ml);
177 visualization_msgs::Marker mdv;
178 mdv.header.stamp = t;
179 mdv.frame_locked =
true;
180 mdv.header.frame_id = common_frame;
182 mdv.type = visualization_msgs::Marker::ARROW;
186 mdv.pose.position.x = p.x();
187 mdv.pose.position.y = p.y();
188 mdv.pose.position.z = p.z();
189 mdv.points.push_back(geometry_msgs::Point());
190 geometry_msgs::Point pdv;
194 mdv.points.push_back(pdv);
199 ma.markers.push_back(mdv);
204 visualization_msgs::Marker mt;
206 mt.frame_locked =
true;
207 mt.header.frame_id = common_frame;
209 mt.type = visualization_msgs::Marker::TEXT_VIEW_FACING;
211 mt.pose.position.x = p.x();
212 mt.pose.position.y = p.y();
213 mt.pose.position.z = p.z();
221 ma.markers.push_back(mt);
243 pub_marker_ = Server::Advertise<visualization_msgs::MarkerArray>(
"p2l", 1,
true);
244 pub_marker_label_ = Server::Advertise<visualization_msgs::MarkerArray>(
"p2l_label", 1,
true);
246 visualization_msgs::Marker md;
248 visualization_msgs::MarkerArray ma;
249 ma.markers.push_back(md);
251 pub_marker_label_.publish(ma);
Eigen::Vector3d line_
vector from start to end point of line
Eigen::Vector3d line_end_
end point of line in base frame
void publish(const boost::shared_ptr< M > &message) const
std::vector< KinematicFrameRequest > frames_
std::string link_name_
frame of defined point
Eigen::Vector3d Direction(const Eigen::Vector3d &point)
direction computes the vector from a point to its projection on a line
Eigen::Vector3d line_start_
start point of line in base frame
Eigen::Ref< Eigen::VectorXd > VectorXdRef
EIGEN_MAKE_ALIGNED_OPERATOR_NEW PointToLine()
int TaskSpaceDim() override
std::string base_name_
frame of defined line
void Update(Eigen::VectorXdRefConst x, Eigen::VectorXdRef phi) override
ros::Publisher pub_marker_label_
marker label
ros::Publisher pub_marker_
publish marker for RViz
const Eigen::Ref< const Eigen::VectorXd > & VectorXdRefConst
void Instantiate(const PointToLineInitializer &init) override
#define HIGHLIGHT_NAMED(name, x)
Eigen::Ref< Eigen::MatrixXd > MatrixXdRef
Eigen::Vector3d GetEndPoint()
REGISTER_TASKMAP_TYPE("PointToLine", exotica::PointToLine)
void SetEndPoint(const Eigen::Vector3d &point)