SMACC
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
smacc_rviz_plugin::SmaccRvizDisplay Class Reference

#include <smacc_rviz_display.h>

Inheritance diagram for smacc_rviz_plugin::SmaccRvizDisplay:
Inheritance graph
Collaboration diagram for smacc_rviz_plugin::SmaccRvizDisplay:
Collaboration graph

Public Member Functions

 SmaccRvizDisplay ()
 
virtual ~SmaccRvizDisplay ()
 
virtual void subscribe ()
 
virtual void unsubscribe ()
 

Protected Member Functions

virtual void onInitialize ()
 
virtual void reset ()
 

Private Slots

void updateCurrentState ()
 
void updateTopic ()
 

Private Member Functions

void processMessage (const smacc_msgs::SmaccStatus::ConstPtr &msg)
 

Private Attributes

rviz::StringProperty * current_state_
 
rviz::RosTopicProperty * topic_property_
 
ros::NodeHandle nh_
 
ros::Subscriber sub_
 

Detailed Description

Definition at line 72 of file smacc_rviz_display.h.

Constructor & Destructor Documentation

◆ SmaccRvizDisplay()

smacc_rviz_plugin::SmaccRvizDisplay::SmaccRvizDisplay ( )

Definition at line 51 of file smacc_rviz_display.cpp.

52{
53
54 /*
55 color_property_ = new rviz::ColorProperty( "Color", QColor( 204, 51, 204 ),
56 "Color to draw the acceleration arrows.",
57 this, SLOT( updateColorAndAlpha() ));
58
59 alpha_property_ = new rviz::FloatProperty( "Alpha", 1.0,
60 "0 is fully transparent, 1.0 is fully opaque.",
61 this, SLOT( updateColorAndAlpha() ));
62
63 history_length_property_ = new rviz::IntProperty( "History length", 1,
64 "Number of prior measurements to display.",
65 this, SLOT( updateHistoryLength() ));
66 */
67
68 current_state_ = new rviz::StringProperty( "CurrentState", "",
69 "current smacc state",
70 this, SLOT( updateCurrentState() ));
71
72
73 topic_property_ = new rviz::RosTopicProperty( "Topic", "",
74 "", "",
75 this, SLOT( updateTopic() ));
76
77 QString message_type = QString::fromStdString( ros::message_traits::datatype<smacc_msgs::SmaccStatus>() );
78 topic_property_->setMessageType( message_type );
79 topic_property_->setDescription( message_type + " topic to subscribe to." );
80
81
82 //history_length_property_->setMin( 1 );
83 //history_length_property_->setMax( 100000 );
84}
rviz::RosTopicProperty * topic_property_

References current_state_, topic_property_, updateCurrentState(), and updateTopic().

Here is the call graph for this function:

◆ ~SmaccRvizDisplay()

smacc_rviz_plugin::SmaccRvizDisplay::~SmaccRvizDisplay ( )
virtual

Definition at line 122 of file smacc_rviz_display.cpp.

123{
124}

Member Function Documentation

◆ onInitialize()

void smacc_rviz_plugin::SmaccRvizDisplay::onInitialize ( )
protectedvirtual

Definition at line 116 of file smacc_rviz_display.cpp.

117{
118 //MFDClass::onInitialize();
119 current_state_->setValue(QString(""));
120}

References current_state_.

◆ processMessage()

void smacc_rviz_plugin::SmaccRvizDisplay::processMessage ( const smacc_msgs::SmaccStatus::ConstPtr &  msg)
private

Definition at line 139 of file smacc_rviz_display.cpp.

140{
141 std::string concatenated;
142
143 for(auto& state: msg->current_states)
144 {
145 concatenated = concatenated + std::string("/")+ state;
146 }
147
148 ROS_DEBUG("current state: %s", concatenated.c_str());
149 current_state_->setValue(QString(concatenated.c_str()));
150 // Here we call the rviz::FrameManager to get the transform from the
151 // fixed frame to the frame in the header of this Imu message. If
152 // it fails, we can't do anything else so we return.
153 /*
154 Ogre::Quaternion orientation;
155 Ogre::Vector3 position;
156 if( !context_->getFrameManager()->getTransform( msg->header.frame_id,
157 msg->header.stamp,
158 position, orientation ))
159 {
160 ROS_DEBUG( "Error transforming from frame '%s' to frame '%s'",
161 msg->header.frame_id.c_str(), qPrintable( fixed_frame_ ));
162 return;
163 }
164
165 // We are keeping a circular buffer of visual pointers. This gets
166 // the next one, or creates and stores it if the buffer is not full
167 boost::shared_ptr<ImuVisual> visual;
168 if( visuals_.full() )
169 {
170 visual = visuals_.front();
171 }
172 else
173 {
174 visual.reset(new ImuVisual( context_->getSceneManager(), scene_node_ ));
175 }*/
176
177 // Now set or update the contents of the chosen visual.
178 //visual->setMessage( msg );
179 //visual->setFramePosition( position );
180 //visual->setFrameOrientation( orientation );
181
182 /*
183 float alpha = alpha_property_->getFloat();
184 Ogre::ColourValue color = color_property_->getOgreColor();
185 visual->setColor( color.r, color.g, color.b, alpha );
186
187 // And send it to the end of the circular buffer
188 visuals_.push_back(visual);
189 */
190}

References current_state_.

Referenced by subscribe().

Here is the caller graph for this function:

◆ reset()

void smacc_rviz_plugin::SmaccRvizDisplay::reset ( )
protectedvirtual

Definition at line 127 of file smacc_rviz_display.cpp.

128{
129 //MFDClass::reset();
130 //visuals_.clear();
131 current_state_->setValue(QString(""));
132}

References current_state_.

Referenced by updateTopic().

Here is the caller graph for this function:

◆ subscribe()

void smacc_rviz_plugin::SmaccRvizDisplay::subscribe ( )
virtual

Definition at line 94 of file smacc_rviz_display.cpp.

95 {
96 current_state_->setValue(QString(""));
97 sub_ = nh_.subscribe<smacc_msgs::SmaccStatus>(topic_property_->getTopic().toStdString(), 1, &SmaccRvizDisplay::processMessage , this);
98 }
void processMessage(const smacc_msgs::SmaccStatus::ConstPtr &msg)

References current_state_, nh_, processMessage(), sub_, and topic_property_.

Referenced by updateTopic().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unsubscribe()

void smacc_rviz_plugin::SmaccRvizDisplay::unsubscribe ( )
virtual

Definition at line 100 of file smacc_rviz_display.cpp.

101 {
102 current_state_->setValue(QString(""));
103 sub_.shutdown();
104
105 }

References current_state_, and sub_.

Referenced by updateTopic().

Here is the caller graph for this function:

◆ updateCurrentState

void smacc_rviz_plugin::SmaccRvizDisplay::updateCurrentState ( )
privateslot

Definition at line 134 of file smacc_rviz_display.cpp.

135{
136}

Referenced by SmaccRvizDisplay().

Here is the caller graph for this function:

◆ updateTopic

void smacc_rviz_plugin::SmaccRvizDisplay::updateTopic ( )
privateslot

Definition at line 86 of file smacc_rviz_display.cpp.

87 {
89 reset();
90 subscribe();
91 context_->queueRender();
92 }

References reset(), subscribe(), and unsubscribe().

Referenced by SmaccRvizDisplay().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ current_state_

rviz::StringProperty* smacc_rviz_plugin::SmaccRvizDisplay::current_state_
private

◆ nh_

ros::NodeHandle smacc_rviz_plugin::SmaccRvizDisplay::nh_
private

Definition at line 118 of file smacc_rviz_display.h.

Referenced by subscribe().

◆ sub_

ros::Subscriber smacc_rviz_plugin::SmaccRvizDisplay::sub_
private

Definition at line 119 of file smacc_rviz_display.h.

Referenced by subscribe(), and unsubscribe().

◆ topic_property_

rviz::RosTopicProperty* smacc_rviz_plugin::SmaccRvizDisplay::topic_property_
private

Definition at line 117 of file smacc_rviz_display.h.

Referenced by SmaccRvizDisplay(), and subscribe().


The documentation for this class was generated from the following files: