##

TimerGUIPlugin.hh
Go to the documentation of this file.
/*
* Copyright (C) 2014 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_PLUGINS_TIMERGUIPLUGIN_HH_
#define GAZEBO_PLUGINS_TIMERGUIPLUGIN_HH_
#include <mutex>
#include <string>
#include <vector>
#include <ignition/transport/Node.hh>
#include <gazebo/common/Events.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Timer.hh>
#include <gazebo/gui/GuiPlugin.hh>
#ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829
# include <gazebo/transport/transport.hh>
#endif
namespace gazebo
{
class GAZEBO_VISIBLE TimerGUIPlugin : public GUIPlugin
{
Q_OBJECT
public: TimerGUIPlugin();
public: virtual ~TimerGUIPlugin();
// Documentation inherited
public: void Load(sdf::ElementPtr _elem);
public: common::Time GetCurrentTime() const;
signals: void SetTime(QString _string);
signals: void SetStartStopButton(QString _state);
private: void OnTimerCtrl(ConstGzStringPtr &_msg);
private: void Start();
private: void Stop();
private: void Reset();
private slots: void OnStartStopButton();
private slots: void OnSetStartStopButton(QString _state);
private slots: void OnResetButton();
private: void PreRender();
private: bool eventFilter(QObject *_obj, QEvent *_event);
private: transport::NodePtr node;
private: transport::SubscriberPtr ctrlSub;
private: common::Timer timer;
private: std::vector<event::ConnectionPtr> connections;
private: std::mutex timerMutex;
private: QPushButton *startStopButton;
private: std::string startStyle;
private: std::string stopStyle;
private: QPushButton *resetButton;
private: int posX;
private: int posY;
// Place ignition::transport objects at the end of this file to
// guarantee they are destructed first.
private: ignition::transport::Node nodeIgn;
};
}
#endif
gazebo::GUIPlugin
A plugin loaded within the gzclient on startup.
Definition: GuiPlugin.hh:26
Events.hh
Timer.hh
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::common::Time
A Time class, can be used to hold wall- or sim-time. stored as sec and nano-sec.
Definition: Time.hh:47
gazebo::transport::SubscriberPtr
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
gazebo::transport::NodePtr
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
gazebo::common::Timer
A timer class, used to time things in real world walltime.
Definition: Timer.hh:38
gazebo::TimerGUIPlugin
A GUI plugin that displays a timer.
Definition: TimerGUIPlugin.hh:53
GuiPlugin.hh
Plugin.hh
GAZEBO_VISIBLE
#define GAZEBO_VISIBLE
Definition: system.hh:59