##

TopicView.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 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 _TOPICVIEW_HH_
#define _TOPICVIEW_HH_
#include <list>
#include <string>
#include <boost/thread/mutex.hpp>
#include "gazebo/common/Time.hh"
#include "gazebo/gui/qt.h"
#include "gazebo/transport/TransportTypes.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace gui
{
class GZ_GUI_VISIBLE TopicCombo : public QComboBox
{
public: TopicCombo(QWidget *_w, const std::string &_msgTypeName,
const std::string &_viewType, transport::NodePtr _node);
public: virtual ~TopicCombo();
public: void SetMsgTypeName(const std::string &_type);
public: virtual void showPopup();
private: void UpdateList();
private: std::string msgTypeName;
private: std::string viewType;
private: transport::NodePtr node;
private: boost::mutex mutex;
};
class GZ_GUI_VISIBLE TopicView : public QDialog
{
Q_OBJECT
public: TopicView(QWidget *_parent, const std::string &_msgType,
const std::string &_viewType,
unsigned int _displayPeriod = 500);
public: virtual ~TopicView();
public: virtual void SetTopic(const std::string &_topicName);
protected: void OnMsg(const common::Time &_dataTime, int _size);
protected: virtual void closeEvent(QCloseEvent *_event);
private slots: void Update();
private: virtual void UpdateImpl();
private slots: void OnTopicChanged(int _index);
protected: QFrame *frame;
protected: transport::SubscriberPtr sub;
protected: transport::NodePtr node;
protected: std::string msgTypeName;
private: TopicCombo *topicCombo;
private: common::Time prevTime;
private: common::Time prevDisplayTime;
private: QLineEdit *hzEdit;
private: double hz;
private: QLineEdit *bandwidthEdit;
private: std::list<int> msgSizes;
private: std::list<common::Time> times;
private: std::list<common::Time> dataTimes;
private: boost::mutex updateMutex;
};
}
}
#endif
gazebo::gui::TopicView::TopicView
TopicView(QWidget *_parent, const std::string &_msgType, const std::string &_viewType, unsigned int _displayPeriod=500)
Constructor.
Time.hh
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
qt.h
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::gui::TopicView::OnMsg
void OnMsg(const common::Time &_dataTime, int _size)
Used by child class to indicate when a message has been received.
TransportTypes.hh
Forward declarations for transport.
system.hh
gazebo::gui::TopicView::node
transport::NodePtr node
Pointer to the node for communication.
Definition: TopicView.hh:129
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::gui::TopicView::closeEvent
virtual void closeEvent(QCloseEvent *_event)
Qt close event callback.
gazebo::gui::TopicView::frame
QFrame * frame
This is the frame that each child class should populate.
Definition: TopicView.hh:123
gui
gui
Definition: KeyEventHandler.hh:29
gazebo::gui::TopicView::sub
transport::SubscriberPtr sub
Pointer to the topic subscriber that receives display data.
Definition: TopicView.hh:126
gazebo::gui::TopicView::SetTopic
virtual void SetTopic(const std::string &_topicName)
Set the name of the topic to get data from.
gazebo::gui::TopicView::~TopicView
virtual ~TopicView()
Destructor.
gazebo::gui::TopicView::msgTypeName
std::string msgTypeName
Typename of the messages that can be displayed.
Definition: TopicView.hh:132
gazebo::gui::TopicView
Base class for widgets that display topic data.
Definition: TopicView.hh:78