LoginSignup
0
0

More than 3 years have passed since last update.

Panelプラグインの雛形

Posted at

rviz2プラグインの作り方 トップページへ

tool_template.hpp
#ifndef SAMPLE_RVIZ_PLUGINS_PANEL_TEMPLATE_HPP
#define SAMPLE_RVIZ_PLUGINS_PANEL_TEMPLATE_HPP

#ifndef Q_MOC_RUN
#include <rclcpp/rclcpp.hpp>
#include <rviz_common/panel.hpp>
#include <QtWidgets>
#endif

namespace sample_rviz_plugins
{

class PanelTemplate : public rviz_common::Panel
{
    Q_OBJECT
public:
    PanelTemplate(QWidget *parent = nullptr);

    virtual void onInitialize();
    virtual void load(const rviz_common::Config &config);
    virtual void save(rviz_common::Config config) const;

protected:
    QHBoxLayout *layout_;
    // QPushButton* button_;
};

}

#endif // SAMPLE_RVIZ_PLUGINS_PANEL_TEMPLATE_HPP
tool_template.cpp
#include "panel_template.hpp"

#include <rviz_common/config.hpp>

// #include <QVBoxLayout>
// #include <QHBoxLayout>
// #include <QSignalMapper>
// #include <rviz_common/display_context.hpp>

namespace sample_rviz_plugins
{

PanelTemplate::PanelTemplate(QWidget *parent)
    : rviz_common::Panel(parent)
{
}

void PanelTemplate::onInitialize()
{
}

void PanelTemplate::save(rviz_common::Config config) const
{
    rviz_common::Panel::save(config);
}

void PanelTemplate::load(const rviz_common::Config &config)
{
    rviz_common::Panel::load(config);
}

}

#include <pluginlib/class_list_macros.hpp>
PLUGINLIB_EXPORT_CLASS(sample_rviz_plugins::PanelTemplate, rviz_common::Panel)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0