42 #include <opencv2/core/core.hpp> 57 PosePlugin::PosePlugin() : config_widget_(new QWidget())
61 ui_.color->setColor(Qt::green);
65 p.setColor(QPalette::Background, Qt::white);
69 QPalette p3(
ui_.status->palette());
70 p3.setColor(QPalette::Text, Qt::red);
71 ui_.status->setPalette(p3);
73 QObject::connect(
ui_.selecttopic, SIGNAL(clicked()),
this,
75 QObject::connect(
ui_.topic, SIGNAL(editingFinished()),
this,
77 QObject::connect(
ui_.positiontolerance, SIGNAL(valueChanged(
double)),
this,
79 QObject::connect(
ui_.buffersize, SIGNAL(valueChanged(
int)),
this,
81 QObject::connect(
ui_.drawstyle, SIGNAL(activated(QString)),
this,
83 QObject::connect(
ui_.static_arrow_sizes, SIGNAL(clicked(
bool)),
85 QObject::connect(
ui_.arrow_size, SIGNAL(valueChanged(
int)),
87 QObject::connect(
ui_.color, SIGNAL(colorEdited(
const QColor&)),
this,
89 QObject::connect(
ui_.show_laps, SIGNAL(toggled(
bool)),
this,
91 QObject::connect(
ui_.buttonResetBuffer, SIGNAL(pressed()),
this,
104 if (!topic.
name.empty())
106 ui_.topic->setText(QString::fromStdString(topic.
name));
113 std::string topic =
ui_.topic->text().trimmed().toStdString();
142 stamped_point.
stamp = pose->header.stamp;
146 pose->pose.position.y,
147 pose->pose.position.z);
150 pose->pose.orientation.x,
151 pose->pose.orientation.y,
152 pose->pose.orientation.z,
153 pose->pose.orientation.w);
201 node[
"topic"] >> topic;
202 ui_.topic->setText(topic.c_str());
208 node[
"color"] >> color;
209 QColor qcolor(color.c_str());
211 ui_.color->setColor(qcolor);
214 if (node[
"draw_style"])
216 std::string draw_style;
217 node[
"draw_style"] >> draw_style;
219 if (draw_style ==
"lines")
221 ui_.drawstyle->setCurrentIndex(0);
224 else if (draw_style ==
"points")
226 ui_.drawstyle->setCurrentIndex(1);
229 else if (draw_style ==
"arrows")
231 ui_.drawstyle->setCurrentIndex(2);
236 if (node[
"position_tolerance"])
238 double position_tolerance;
239 node[
"position_tolerance"] >> position_tolerance;
240 ui_.positiontolerance->setValue(position_tolerance);
244 if (node[
"buffer_size"])
247 node[
"buffer_size"] >> buffer_size;
248 ui_.buffersize->setValue(buffer_size);
252 if (node[
"show_laps"])
254 bool show_laps =
false;
255 node[
"show_laps"] >> show_laps;
256 ui_.show_laps->setChecked(show_laps);
260 if (node[
"static_arrow_sizes"])
262 bool static_arrow_sizes = node[
"static_arrow_sizes"].as<
bool>();
263 ui_.static_arrow_sizes->setChecked(static_arrow_sizes);
267 if (node[
"arrow_size"])
269 int arrow_size = node[
"arrow_size"].as<
int>();
270 ui_.arrow_size->setValue(arrow_size);
279 std::string topic =
ui_.topic->text().toStdString();
280 emitter << YAML::Key <<
"topic" << YAML::Value << topic;
282 emitter << YAML::Key <<
"color" << YAML::Value
283 <<
ui_.color->color().name().toStdString();
285 std::string draw_style =
ui_.drawstyle->currentText().toStdString();
286 emitter << YAML::Key <<
"draw_style" << YAML::Value << draw_style;
288 emitter << YAML::Key <<
"position_tolerance" <<
291 emitter << YAML::Key <<
"buffer_size" << YAML::Value <<
bufferSize();
293 bool show_laps =
ui_.show_laps->isChecked();
294 emitter << YAML::Key <<
"show_laps" << YAML::Value << show_laps;
296 emitter << YAML::Key <<
"static_arrow_sizes" << YAML::Value <<
ui_.static_arrow_sizes->isChecked();
298 emitter << YAML::Key <<
"arrow_size" << YAML::Value <<
ui_.arrow_size->value();
double positionTolerance() const
static ros::master::TopicInfo selectTopic(const std::string &datatype, QWidget *parent=0)
virtual void PositionToleranceChanged(double value)
virtual void SetArrowSize(int arrowSize)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
virtual bool DrawPoints(double scale)
static void PrintWarningHelper(QLabel *status_label, const std::string &message, double throttle=0.0)
static void PrintErrorHelper(QLabel *status_label, const std::string &message, double throttle=0.0)
void PrintError(const std::string &message)
void PrintInfo(const std::string &message)
static void PrintInfoHelper(QLabel *status_label, const std::string &message, double throttle=0.0)
void SaveConfig(YAML::Emitter &emitter, const std::string &path)
void Draw(double x, double y, double scale)
QWidget * GetConfigWidget(QWidget *parent)
virtual void BufferSizeChanged(int value)
virtual void LapToggled(bool checked)
virtual void SetColor(const QColor &color)
virtual void SetStaticArrowSizes(bool isChecked)
ros::Subscriber pose_sub_
double bufferSize() const
void PoseCallback(const geometry_msgs::PoseStampedConstPtr &pose)
void pushPoint(StampedPoint point)
virtual void SetDrawStyle(QString style)
bool Initialize(QGLWidget *canvas)
void PrintWarning(const std::string &message)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
tf::Quaternion orientation
void LoadConfig(const YAML::Node &node, const std::string &path)