30 #include <boost/algorithm/string/erase.hpp> 31 #include <boost/foreach.hpp> 32 #include <boost/shared_ptr.hpp> 49 , messages_received_(0)
52 QString::fromStdString(ros::message_traits::datatype<sensor_msgs::Image>()),
53 "sensor_msgs::Image topic to subscribe to.",
this, SLOT(
updateTopic() ));
62 "Advanced: set the size of the incoming message queue. Increasing this " 63 "is useful if your incoming TF data is delayed significantly from your" 64 " image data, but it can greatly increase memory usage if the messages are big.",
71 "Prefer UDP topic transport",
90 if ( datatype == ros::message_traits::datatype<sensor_msgs::Image>() )
97 int index = topic.lastIndexOf(
"/");
100 ROS_WARN(
"ImageDisplayBase::setTopic() Invalid topic name: %s",
101 topic.toStdString().c_str());
104 QString transport = topic.mid(index + 1);
105 QString base_topic = topic.mid(0, index);
216 "image_transport::SubscriberPlugin");
225 std::string transport_name = boost::erase_last_copy(lookup_name,
"_sub");
226 transport_name = transport_name.substr(lookup_name.find(
'/') + 1);
255 property->clearOptions();
257 std::vector<std::string> choices;
259 choices.push_back(
"raw");
264 ros::master::V_TopicInfo::iterator it = topics.begin();
265 ros::master::V_TopicInfo::iterator end = topics.end();
266 for (; it != end; ++it)
274 const std::string& topic_name = ti.
name;
277 if (topic_name.find(topic) == 0 && topic_name != topic && topic_name[topic.size()] ==
'/' 278 && topic_name.find(
'/', topic.size() + 1) == std::string::npos)
280 std::string transport_type = topic_name.substr(topic.size() + 1);
286 choices.push_back(transport_type);
291 for (
size_t i = 0; i < choices.size(); i++)
293 property->addOptionStd(choices[i]);
void scanForTransportSubscriberPlugins()
virtual void setString(const QString &str)
virtual tf::TransformListener * getTFClient() const =0
Convenience function: returns getFrameManager()->getTFClient().
void fillTransportOptionList(EnumProperty *property)
Fill list of available and working transport options.
DisplayContext * context_
This DisplayContext pointer is the main connection a Display has into the rest of rviz...
void emitTimeSignal(ros::Time time)
Emit a time signal that other Displays can synchronize to.
virtual int getInt() const
Return the internal property value as an integer.
ros::NodeHandle update_nh_
A NodeHandle whose CallbackQueue is run from the main GUI thread (the "update" thread).
ROSCPP_DECL bool getTopics(V_TopicInfo &topics)
virtual void unsubscribe()
std::vector< TopicInfo > V_TopicInfo
Property specialized to provide max/min enforcement for integers.
ImageDisplayBase()
Constructor.
virtual void fixedFrameChanged()
Called by setFixedFrame(). Override to respond to changes to fixed_frame_.
std::string getStdString()
bool isEnabled() const
Return true if this Display is enabled, false if not.
virtual bool getBool() const
QString fixed_frame_
A convenience variable equal to context_->getFixedFrame().
BoolProperty * unreliable_property_
virtual void processMessage(const sensor_msgs::Image::ConstPtr &msg)=0
Implement this to process the contents of a message.
IntProperty * queue_size_property_
TransportHints & unreliable()
virtual void subscribe()
ROS topic management.
uint32_t messages_received_
virtual void reset()
Called to tell the display to clear its state.
std::vector< std::string > getDeclaredClasses()
virtual void updateQueueSize()
Update queue size of tf filter.
virtual FrameManager * getFrameManager() const =0
Return the FrameManager instance.
virtual void onInitialize()
Override this function to do subclass-specific initialization.
virtual void reset()
Reset display.
virtual void queueRender()=0
Queues a render. Multiple calls before a render happens will only cause a single render.
EnumProperty * transport_property_
RosTopicProperty * topic_property_
virtual void updateTopic()
Update topic and resubscribe.
boost::shared_ptr< tf::MessageFilter< sensor_msgs::Image > > tf_filter_
std::set< std::string > transport_plugin_types_
void incomingMessage(const sensor_msgs::Image::ConstPtr &msg)
Incoming message callback. Checks if the message pointer is valid, increments messages_received_, then calls processMessage().
std::string getTopicStd() const
boost::shared_ptr< image_transport::SubscriberFilter > sub_
bool setStdString(const std::string &std_str)
virtual void setString(const QString &str)
Set the value of this property to the given string. Does not force the value to be one of the list of...
BoolProperty(const QString &name=QString(), bool default_value=false, const QString &description=QString(), Property *parent=0, const char *changed_slot=0, QObject *receiver=0)
boost::scoped_ptr< image_transport::ImageTransport > it_
virtual void setStatus(StatusProperty::Level level, const QString &name, const QString &text)
Show status level and text. This is thread-safe.
virtual void setTopic(const QString &topic, const QString &datatype)
Set the ROS topic to listen to for this display.
virtual ~ImageDisplayBase()