Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here's an example I got working today. Follow the system plugin tutorial to compile/run it.

#include <gazebo/math/Rand.hh>
#include <gazebo/gui/GuiIface.hh>
#include <gazebo/rendering/rendering.hh>
#include <gazebo/gazebo.hh>
#include <gazebo/gui/MouseEventHandler.hh>
#include <gazebo/common/MouseEvent.hh>

namespace gazebo
  class SystemGUI : public SystemPlugin

    // Destructor
    public: virtual ~SystemGUI()

    // Called after the plugin has been constructed.
    public: void Load(int /*_argc*/, char ** /*_argv*/)
            boost::bind(&SystemGUI::OnMousePress, this, _1));

    public: bool OnMousePress(const common::MouseEvent & /*_event*/)
        std::cout << "Mouse press detected!\n";
        return true;

  // Register this plugin with the simulator