40 #include <opencv2/core/core.hpp> 50 position_tolerance_(0.0),
52 covariance_checked_(false),
53 show_all_covariances_checked_(false),
56 buffer_holder_(false),
58 static_arrow_sizes_(false),
61 QObject::connect(
this,
69 ROS_INFO(
"PointDrawingPlugin::ClearHistory()");
78 icon.fill(Qt::transparent);
80 QPainter painter(&icon);
81 painter.setRenderHint(QPainter::Antialiasing,
true);
88 pen.setCapStyle(Qt::RoundCap);
90 painter.drawPoint(8, 8);
95 pen.setCapStyle(Qt::FlatCap);
97 painter.drawLine(1, 14, 14, 1);
102 pen.setCapStyle(Qt::SquareCap);
104 painter.drawLine(2, 13, 13, 2);
105 painter.drawLine(13, 2, 13, 8);
106 painter.drawLine(13, 2, 7, 2);
121 if (style ==
"lines")
125 else if (style ==
"points")
129 else if (style ==
"arrows")
171 for (std::deque<StampedPoint>& lap:
laps_)
175 point.transformed =
false;
180 point.transformed =
false;
193 points_.push_back(stamped_point);
252 bool transformed =
true;
295 if (((std::fabs(check.x()) <= 3) && (std::fabs(check.y()) <= 3)) &&
308 if (((std::fabs(check.x()) > 25) && (std::fabs(check.y()) > 25)) &&
322 glBegin(GL_LINE_STRIP);
332 success &= pt.transformed;
335 glVertex2d(pt.transformed_point.getX(), pt.transformed_point.getY());
427 double arrow_width = size / 5.0;
428 double head_length = size * 0.75;
432 if(std::fabs(q.x()*q.x() + q.y()*q.y() + q.z()*q.z() + q.w()*q.w() - 1) > 0.01)
450 for (uint32_t i = 0; i < point.
cov_points.size(); i++)
464 bool transformed =
false;
472 if (
laps_.size() > 0)
474 for (
auto &lap :
laps_)
482 if (!points_.empty() && !transformed)
491 bool transformed =
points_.size() != 0;
494 QColor base_color =
color_;
496 for (
size_t i = 0; i <
laps_.size(); i++)
502 glBegin(GL_LINE_STRIP);
510 for (
const auto& pt :
laps_[i])
514 glVertex2d(pt.transformed_point.getX(),
515 pt.transformed_point.getY());
524 glBegin(GL_LINE_STRIP);
532 glColor4d(base_color.redF(), base_color.greenF(), base_color.blueF(), 0.5);
538 transformed &= pt.transformed;
541 glVertex2d(pt.transformed_point.getX(),
542 pt.transformed_point.getY());
553 int hue =
static_cast<int>(
color_.hue() + (i + 1.0) * 10.0 * M_PI);
558 int sat =
color_.saturation();
560 base_color.setHsv(hue, sat, v);
561 glColor4d(base_color.redF(), base_color.greenF(), base_color.blueF(),
575 if (!pt.transformed || pt.transformed_cov_points.empty())
579 glBegin(GL_LINE_STRIP);
581 for (uint32_t i = 0; i < pt.transformed_cov_points.size(); i++)
583 glVertex2d(pt.transformed_cov_points[i].getX(),
584 pt.transformed_cov_points[i].getY());
587 glVertex2d(pt.transformed_cov_points.front().getX(),
588 pt.transformed_cov_points.front().getY());
595 glBegin(GL_LINE_STRIP);
612 bool success =
laps_.size() != 0 &&
points_.size() != 0;
615 QColor base_color =
color_;
616 if (
laps_.size() != 0)
618 for (
size_t i = 0; i <
laps_.size(); i++)
621 for (
const auto &pt :
laps_[i])
623 glBegin(GL_LINE_STRIP);
630 int hue =
static_cast<int>(
color_.hue() +
laps_.size() * 10.0 * M_PI);
631 int sat =
color_.saturation();
633 base_color.setHsv(hue, sat, v);
634 glColor4d(base_color.redF(), base_color.greenF(), base_color.blueF(),
642 glBegin(GL_LINE_STRIP);
bool GetTransform(const ros::Time &stamp, swri_transform_util::Transform &transform, bool use_latest_transforms=true)
std::vector< tf::Point > cov_points
virtual void DrawCovariance()
double bufferSize() const
tf::Point transformed_arrow_right
virtual void PositionToleranceChanged(double value)
virtual void SetArrowSize(int arrowSize)
tf::Point transformed_arrow_point
virtual bool DrawPoints(double scale)
double positionTolerance() const
virtual void UpdateColor(QColor base_color, int i)
std::vector< std::deque< StampedPoint > > laps_
std::string target_frame_
tf::Point transformed_point
virtual bool DrawArrows()
virtual bool DrawLapsArrows()
std::deque< StampedPoint > points_
double position_tolerance_
void TargetFrameChanged(const std::string &target_frame)
virtual void BufferSizeChanged(int value)
virtual void LapToggled(bool checked)
virtual void SetColor(const QColor &color)
virtual void SetStaticArrowSizes(bool isChecked)
virtual bool DrawArrow(const StampedPoint &point)
virtual void CollectLaps()
std::vector< tf::Point > transformed_cov_points
virtual void ShowAllCovariancesToggled(bool checked)
void transform(marti_nav_msgs::Path &path, const swri_transform_util::Transform &transform, const std::string &target_frame)
virtual void CovariancedToggled(bool checked)
bool show_all_covariances_checked_
void pushPoint(StampedPoint point)
tf::Point transformed_arrow_left
virtual void SetDrawStyle(QString style)
tf::Quaternion orientation
const std::deque< StampedPoint > & points() const
virtual bool TransformPoint(StampedPoint &point)
virtual void PrintError(const std::string &message)=0
void ResetTransformedPoints()