From f83fe291dc26ea3f9ce2ebd806d628db7af38c2e Mon Sep 17 00:00:00 2001 From: Davide Facont Date: Sat, 19 Jan 2019 19:45:42 +0100 Subject: [PATCH] new icons and new style --- plotter_gui/filterablelistwidget.cpp | 7 +- plotter_gui/filterablelistwidget.h | 4 + plotter_gui/filterablelistwidget.ui | 12 +- plotter_gui/main.cpp | 37 +-- plotter_gui/mainwindow.cpp | 3 + plotter_gui/mainwindow.ui | 79 ++--- plotter_gui/plotmatrix.h | 2 +- plotter_gui/plotwidget.cpp | 2 + plotter_gui/plotwidget.h | 1 + plotter_gui/resource.qrc | 8 +- plotter_gui/resources/add_column.svg | 93 ++++++ plotter_gui/resources/add_row.svg | 101 ++++++ plotter_gui/resources/add_tab.svg | 83 +++++ plotter_gui/resources/cog.png | Bin 1048 -> 0 bytes plotter_gui/resources/settings-cog.svg | 53 ++++ plotter_gui/resources/stylesheet.qss | 84 +++++ plotter_gui/resources/zoom_horizontal.svg | 81 +++++ plotter_gui/resources/zoom_vertical.svg | 81 +++++ plotter_gui/tabbedplotwidget.ui | 293 +++++++++--------- .../statepublisher_rostopic.cpp | 118 +++---- .../statepublisher_rostopic.h | 3 + 21 files changed, 871 insertions(+), 274 deletions(-) create mode 100644 plotter_gui/resources/add_column.svg create mode 100644 plotter_gui/resources/add_row.svg create mode 100644 plotter_gui/resources/add_tab.svg delete mode 100644 plotter_gui/resources/cog.png create mode 100644 plotter_gui/resources/settings-cog.svg create mode 100644 plotter_gui/resources/stylesheet.qss create mode 100644 plotter_gui/resources/zoom_horizontal.svg create mode 100644 plotter_gui/resources/zoom_vertical.svg diff --git a/plotter_gui/filterablelistwidget.cpp b/plotter_gui/filterablelistwidget.cpp index 2f5cc1829..62fb210ac 100644 --- a/plotter_gui/filterablelistwidget.cpp +++ b/plotter_gui/filterablelistwidget.cpp @@ -106,7 +106,6 @@ void FilterableListWidget::clear() ui->labelNumberDisplayed->setText( "0 of 0"); } - void FilterableListWidget::addItem(const QString &item_name) { if( _model->findItems(item_name).size() > 0) @@ -529,3 +528,9 @@ void FilterableListWidget::on_buttonEditCustom_clicked() auto item = _model->item( selected_index.row(), 0 ); editMathPlot( item->text().toStdString() ); } + +void FilterableListWidget::clearSelections() +{ + ui->tableViewCustom->clearSelection(); + ui->tableView->clearSelection(); +} diff --git a/plotter_gui/filterablelistwidget.h b/plotter_gui/filterablelistwidget.h index 43987cd2f..852408dcf 100644 --- a/plotter_gui/filterablelistwidget.h +++ b/plotter_gui/filterablelistwidget.h @@ -84,6 +84,10 @@ private slots: void onCustomSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected); +public slots: + + void clearSelections(); + private: Ui::FilterableListWidget *ui; diff --git a/plotter_gui/filterablelistwidget.ui b/plotter_gui/filterablelistwidget.ui index 8703cb91d..20c3928d5 100644 --- a/plotter_gui/filterablelistwidget.ui +++ b/plotter_gui/filterablelistwidget.ui @@ -115,13 +115,13 @@ border: 0.5px solid rgb(150, 150, 150); - - :/icons/resources/cog.png:/icons/resources/cog.png + + :/icons/resources/settings-cog.svg:/icons/resources/settings-cog.svg - 22 - 22 + 26 + 26 @@ -517,6 +517,8 @@ border: 1px solid rgb(150, 150, 150); - + + + diff --git a/plotter_gui/main.cpp b/plotter_gui/main.cpp index 3da1de406..b64036799 100644 --- a/plotter_gui/main.cpp +++ b/plotter_gui/main.cpp @@ -38,36 +38,13 @@ int main(int argc, char *argv[]) app.setOrganizationName("IcarusTechnology"); app.setApplicationName("PlotJuggler"); - qApp->setStyleSheet(QString("QToolTip {\n" - " border: 1px solid black;\n" - " border-radius: 4px;\n" - " background: white;\n" - " color: black; }\n" - " QMenu {" - "background-color: white;}" - - "QMenu::item {" - " padding: 2px 25px 2px 25px;" - " color:rgb(33, 33, 33);" - " border: 1px solid transparent; margin: 2px;" - " }" - - " QMenu::item:disabled {" - " background: white;" - " color:grey; }" - - " QMenu::item:selected {" - " background: rgb(122, 122, 122);" - " color:white; }" - - "QMenu::item:checked { color: rgb(66, 66, 100); font: bold; }" - "QMenu::item:unchecked { color: rgb(66, 66, 66); }" - - " QMenu::indicator {" - " width: 24px;" - " height: 20px; }" - ) - ); + // Load an application style + QFile styleFile( "://resources/stylesheet.qss" ); + styleFile.open( QFile::ReadOnly ); + + // Apply the loaded stylesheet + QString style( styleFile.readAll() ); + app.setStyleSheet( style ); QString VERSION_STRING = QString("%1.%2.%3"). arg(PJ_MAJOR_VERSION). diff --git a/plotter_gui/mainwindow.cpp b/plotter_gui/mainwindow.cpp index d9ef2fa64..4c6b1aa71 100644 --- a/plotter_gui/mainwindow.cpp +++ b/plotter_gui/mainwindow.cpp @@ -647,6 +647,9 @@ void MainWindow::onPlotAdded(PlotWidget* plot) connect( &_time_offset, SIGNAL( valueChanged(double)), plot, SLOT(on_changeTimeOffset(double)) ); + connect( plot, &PlotWidget::curvesDropped, + _curvelist_widget, &FilterableListWidget::clearSelections); + plot->on_changeTimeOffset( _time_offset.get() ); plot->activateGrid( ui->pushButtonActivateGrid->isChecked() ); plot->enableTracker( !isStreamingActive() ); diff --git a/plotter_gui/mainwindow.ui b/plotter_gui/mainwindow.ui index 280e562fa..c1b736c97 100644 --- a/plotter_gui/mainwindow.ui +++ b/plotter_gui/mainwindow.ui @@ -160,6 +160,9 @@ border-radius: 4px; 40 + + Qt::NoFocus + <html><head/><body><p>Show/Hide extra options</p></body></html> @@ -171,12 +174,12 @@ border-radius: 4px; - :/icons/resources/cog.png:/icons/resources/cog.png + :/icons/resources/settings-cog.svg:/icons/resources/settings-cog.svg - 22 - 22 + 28 + 28 @@ -187,6 +190,41 @@ border-radius: 4px; + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>Change the amount of information displayed with the vertical TimeTracker</p></body></html> + + + + + + + :/icons/resources/line_tracker_1.png:/icons/resources/line_tracker_1.png + + + + 36 + 36 + + + + false + + + @@ -392,41 +430,6 @@ background: white; - - - - - 40 - 40 - - - - - 40 - 40 - - - - <html><head/><body><p>Change the amount of information displayed with the vertical TimeTracker</p></body></html> - - - - - - - :/icons/resources/line_tracker_1.png:/icons/resources/line_tracker_1.png - - - - 36 - 36 - - - - false - - - diff --git a/plotter_gui/plotmatrix.h b/plotter_gui/plotmatrix.h index ebf8ba5e3..ea082e9e0 100644 --- a/plotter_gui/plotmatrix.h +++ b/plotter_gui/plotmatrix.h @@ -11,7 +11,7 @@ class PlotMatrix: public QFrame Q_OBJECT public: - PlotMatrix(QString name, PlotDataMapRef &datamap, QWidget * parent = NULL ); + PlotMatrix(QString name, PlotDataMapRef &datamap, QWidget * parent = nullptr ); virtual ~PlotMatrix(); void addRow(); diff --git a/plotter_gui/plotwidget.cpp b/plotter_gui/plotwidget.cpp index c729a76f2..ada8026e2 100644 --- a/plotter_gui/plotwidget.cpp +++ b/plotter_gui/plotwidget.cpp @@ -502,11 +502,13 @@ void PlotWidget::dropEvent(QDropEvent *) bool added = addCurve( curve_name.toStdString() ); curves_changed = curves_changed || added; } + emit curvesDropped(); } else if( _dragging.mode == DragInfo::NEW_X) { changeAxisX( _dragging.curves.front() ); curves_changed = true; + emit curvesDropped(); } else if( _dragging.mode == DragInfo::SWAP_PLOTS ) { diff --git a/plotter_gui/plotwidget.h b/plotter_gui/plotwidget.h index 832de22b9..2efec984b 100644 --- a/plotter_gui/plotwidget.h +++ b/plotter_gui/plotwidget.h @@ -69,6 +69,7 @@ class PlotWidget : public QwtPlot void undoableChange(); void trackerMoved(QPointF pos); void curveListChanged(); + void curvesDropped(); public slots: diff --git a/plotter_gui/resource.qrc b/plotter_gui/resource.qrc index 74f2e5392..75027b9d0 100644 --- a/plotter_gui/resource.qrc +++ b/plotter_gui/resource.qrc @@ -5,7 +5,6 @@ resources/check.png resources/checkboxalt.png resources/circle_arrow_right.png - resources/cog.png resources/line_chart_32px.png resources/line_chart_48px.png resources/line_chart_64px.png @@ -43,11 +42,18 @@ resources/line_tracker_1.png resources/line_tracker_a.png resources/line_tracker.png + resources/add_column.svg + resources/add_row.svg + resources/add_tab.svg + resources/zoom_horizontal.svg + resources/zoom_vertical.svg + resources/settings-cog.svg resources/splash.jpg resources/default.snippets.xml + resources/stylesheet.qss diff --git a/plotter_gui/resources/add_column.svg b/plotter_gui/resources/add_column.svg new file mode 100644 index 000000000..fd28d5787 --- /dev/null +++ b/plotter_gui/resources/add_column.svg @@ -0,0 +1,93 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/plotter_gui/resources/add_row.svg b/plotter_gui/resources/add_row.svg new file mode 100644 index 000000000..ff1c4de13 --- /dev/null +++ b/plotter_gui/resources/add_row.svg @@ -0,0 +1,101 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/plotter_gui/resources/add_tab.svg b/plotter_gui/resources/add_tab.svg new file mode 100644 index 000000000..78da02dbf --- /dev/null +++ b/plotter_gui/resources/add_tab.svg @@ -0,0 +1,83 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/plotter_gui/resources/cog.png b/plotter_gui/resources/cog.png deleted file mode 100644 index 8e1cf5272d04e314a47d285f3bd892d4dfedfad3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1048 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE0wix1Z>k4UEa{HEjtmSN`?>!lvVtU&J%W50 z7^+km7#f-x7=Hc-(k~epN(~qoUL`OvSj}Ky5YL|!f7A`AmMO{G-G$+Qd;gjJKptm- zM`SSr1Gg{;GcwGYBf-GH*yriu7~*k!>6E>GOpYS0_Np5dBO)XgaYn4>%=g$4j ztS0@O_js(CJIl5?&)+@xAQZDehqJ~=>Wr;Zuuwt7W#M*Srqex|>fX(da)Y1Gt9`_v zvSZQeBjqoG)EFJ+*uGn_`Et2`!p4f1J1GNUZYQ&Q|4IT7F@F><^Z(CfjqX9^F$B@=Z{uoAe9v z((N~e`Jvh58v<0tU}$V+YH4U_VPUSe$(ISJL>S4O;LNI224g)VLvJT1#ipfmfznY( z(xE|~3~8A;slWix&&bbB1qDMIYx^YrpkOZ1ad@^mwE)Aitj$$9$4 iMalYxh6cu_5Yos@59m(2s!5<6&*16m=d#Wzp$P!{g=b;_ diff --git a/plotter_gui/resources/settings-cog.svg b/plotter_gui/resources/settings-cog.svg new file mode 100644 index 000000000..4aeb55298 --- /dev/null +++ b/plotter_gui/resources/settings-cog.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plotter_gui/resources/stylesheet.qss b/plotter_gui/resources/stylesheet.qss new file mode 100644 index 000000000..ee989e597 --- /dev/null +++ b/plotter_gui/resources/stylesheet.qss @@ -0,0 +1,84 @@ +QMainWindow { + background: #EFEFEF; +} + +QDialog { + background: #EFEFEF; +} +QLabel { + color: black; +} + +QTabWidget::pane { /* The tab widget frame */ + border: 2px solid #AAAAAA; + background: white; + top: -2px; +} + +QTabBar::tab { + border-top-left-radius: 4px; + border-top-right-radius: 4px; + min-width: 10ex; + padding: 6px; +} + +QTabBar::tab:selected { + border-left: 2px solid #AAAAAA; + border-right: 2px solid #AAAAAA; + border-top: 2px solid #AAAAAA; + background: white; +} +QTabBar::tab:!selected { + background: #EEEEEE; + border-bottom: 2px solid #AAAAAA; +} + +QListView::item:selected { + background: #446688; +} + +QTableView::item:selected { + background: #446688; +} + + +QToolTip { + border: 1px solid black; + border-radius: 4px; + background: white; + color: black; } + +QMenu { + background-color: white; + } + +QMenu::item { + padding: 2px 25px 2px 25px; + color:rgb(33, 33, 33); + border: 1px solid transparent; + margin: 2px; +} + +QMenu::item:disabled { + background: white; + color:grey; +} + +QMenu::item:selected { + background: #86869b; + color:white; +} + +QMenu::item:checked { + color: rgb(66, 66, 100); + font: bold; +} + +QMenu::item:unchecked { + color: rgb(66, 66, 66); +} + +QMenu::indicator { + width: 24px; + height: 20px; +} diff --git a/plotter_gui/resources/zoom_horizontal.svg b/plotter_gui/resources/zoom_horizontal.svg new file mode 100644 index 000000000..6e142ca5f --- /dev/null +++ b/plotter_gui/resources/zoom_horizontal.svg @@ -0,0 +1,81 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/plotter_gui/resources/zoom_vertical.svg b/plotter_gui/resources/zoom_vertical.svg new file mode 100644 index 000000000..46694aed4 --- /dev/null +++ b/plotter_gui/resources/zoom_vertical.svg @@ -0,0 +1,81 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/plotter_gui/tabbedplotwidget.ui b/plotter_gui/tabbedplotwidget.ui index a48a97a52..d5554d838 100644 --- a/plotter_gui/tabbedplotwidget.ui +++ b/plotter_gui/tabbedplotwidget.ui @@ -19,19 +19,19 @@ - 2 + 4 - 2 + 4 - 2 + 4 - 2 + 4 - 2 + 4 @@ -44,9 +44,6 @@ false - - - -1 @@ -67,6 +64,9 @@ + + 4 + QLayout::SetMinimumSize @@ -83,11 +83,24 @@ 2 - + + + Qt::Horizontal + + + + 40 + 40 + + + + + + 40 - 34 + 40 @@ -100,10 +113,10 @@ Qt::NoFocus - <html><head/><body><p>Show/hide the legend</p></body></html> + Maximize the vertical zoom - - + + false @@ -113,31 +126,25 @@ - :/icons/resources/list_alt_32px.png:/icons/resources/list_alt_32px.png + :/icons/resources/zoom_vertical.svg:/icons/resources/zoom_vertical.svg - 30 - 30 + 32 + 32 - - true - - - true - true - + 40 - 34 + 40 @@ -150,75 +157,75 @@ Qt::NoFocus - <html><head/><body><p>Link the horizontal between plots</p></body></html> - - - + <html><head/><body><p>Maximize the horizontal zoom</p></body></html> - + QToolTip { +border: 1px solid black; +border-radius: 6px; +background: white; +} - :/icons/resources/link.png:/icons/resources/link.png + :/icons/resources/zoom_horizontal.svg:/icons/resources/zoom_horizontal.svg - 30 - 30 + 32 + 32 - - true - - - true - true - + + + + 0 + 0 + + 40 - 34 + 40 - 40 + 44 34 + + + 10 + + Qt::NoFocus - Maximize the vertical zoom - - - false - - - + <html><head/><body><p>Add a column to the current plot matrix</p></body></html> - :/icons/resources/resize_vertical.png:/icons/resources/resize_vertical.png + :/icons/resources/add_column.svg:/icons/resources/add_column.svg - 30 - 30 + 32 + 32 @@ -227,43 +234,47 @@ - + + + + 0 + 0 + + 40 - 34 + 40 - 40 + 44 34 + + + 10 + + Qt::NoFocus - <html><head/><body><p>Maximize the horizontal zoom</p></body></html> - - - QToolTip { -border: 1px solid black; -border-radius: 6px; -background: white; -} + <html><head/><body><p>Add a row to the current plot matrix</p></body></html> - :/icons/resources/resize_horizontal.png:/icons/resources/resize_horizontal.png + :/icons/resources/add_row.svg:/icons/resources/add_row.svg - 30 - 30 + 32 + 32 @@ -272,30 +283,11 @@ background: white; - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - + - 44 - 34 + 40 + 40 @@ -313,20 +305,14 @@ background: white; Qt::NoFocus - <html><head/><body><p>Add a column to the current plot matrix</p></body></html> - - - border: 1px solid black; -border-radius: 6px; -background: white; - + <html><head/><body><p>Add a new plot matrix in a new tab</p></body></html> - :/icons/resources/splitbutton_vertical@2x.png:/icons/resources/splitbutton_vertical@2x.png + :/icons/resources/add_tab.svg:/icons/resources/add_tab.svg @@ -340,17 +326,14 @@ background: white; - - - - 0 - 0 - + + + true - 44 - 34 + 40 + 40 @@ -368,20 +351,14 @@ background: white; Qt::NoFocus - <html><head/><body><p>Add a row to the current plot matrix</p></body></html> - - - border: 1px solid black; -border-radius: 6px; -background: white; - + <html><head/><body><p>Remove those rows and column containing only empty plots</p></body></html> - :/icons/resources/splitbutton_horizontal@2x.png:/icons/resources/splitbutton_horizontal@2x.png + :/icons/resources/clean_pane_small@2x.png:/icons/resources/clean_pane_small@2x.png @@ -395,91 +372,106 @@ background: white; - + - 44 - 34 + 10 + 42 + + + + QFrame::Plain + + + 1 + + + Qt::Vertical + + + + + + + + 40 + 40 - 44 + 40 34 - - - 10 - - Qt::NoFocus - <html><head/><body><p>Add a new plot matrix in a new tab</p></body></html> + <html><head/><body><p>Show/hide the legend</p></body></html> + + + - border: 1px solid black; -border-radius: 6px; -background: white; - + - :/icons/resources/add_tab.png:/icons/resources/add_tab.png + :/icons/resources/list_alt_32px.png:/icons/resources/list_alt_32px.png - 32 - 32 + 30 + 30 + + true + + + true + + + true + - - - true - + - 44 - 34 + 40 + 40 - 44 + 40 34 - - - 10 - - Qt::NoFocus - <html><head/><body><p>Remove those rows and column containing only empty plots</p></body></html> + <html><head/><body><p>Link the horizontal between plots</p></body></html> + + + - border: 1px solid black; -border-radius: 6px; -background: white; - + - :/icons/resources/clean_pane_small@2x.png:/icons/resources/clean_pane_small@2x.png + :/icons/resources/link.png:/icons/resources/link.png @@ -487,6 +479,15 @@ background: white; 30 + + true + + + true + + + true + diff --git a/plugins/ROS/TopicPublisherROS/statepublisher_rostopic.cpp b/plugins/ROS/TopicPublisherROS/statepublisher_rostopic.cpp index cae1340d2..c87f684f4 100644 --- a/plugins/ROS/TopicPublisherROS/statepublisher_rostopic.cpp +++ b/plugins/ROS/TopicPublisherROS/statepublisher_rostopic.cpp @@ -53,6 +53,10 @@ void TopicPublisherROS::setEnabled(bool to_enable) if(enabled_) { ChangeFilter(); + if( !_tf_publisher) + { + _tf_publisher = std::unique_ptr( new tf::TransformBroadcaster ); + } } } @@ -138,13 +142,11 @@ void TopicPublisherROS::ChangeFilter(bool) } } - -void TopicPublisherROS::updateState(double current_time) +void TopicPublisherROS::broadcastTF(double current_time) { - if(!enabled_ || !_node) return; - const ros::Time ros_time = ros::Time::now(); + const PlotDataAny* tf_data = nullptr; for(const auto& data_it: _datamap->user_defined ) { @@ -161,73 +163,85 @@ void TopicPublisherROS::updateState(double current_time) { continue; } - RosIntrospection::ShapeShifter shapeshifted_msg = *shapeshifter; - int last_index = plot_any.getIndexFromX( current_time ); - if( last_index < 0) - { - continue; - } - std::unordered_map transforms; + tf_data = &plot_any; + break; + } - std::vector raw_buffer; + if( !tf_data ) + { + return; + } - for(size_t index = 0; index <= last_index; index++ ) - { - const nonstd::any& any_value = plot_any.at(index).y; + int last_index = tf_data->getIndexFromX( current_time ); - const bool isRosbagMessage = any_value.type() == typeid(rosbag::MessageInstance); + if( last_index < 0) + { + return; + } + std::unordered_map transforms; - if( isRosbagMessage ) - { - const auto& msg_instance = nonstd::any_cast( any_value ); - raw_buffer.resize( msg_instance.size() ); - ros::serialization::OStream ostream(raw_buffer.data(), raw_buffer.size()); - msg_instance.write(ostream); + std::vector raw_buffer; + + for(size_t index = 0; index <= last_index; index++ ) + { + const nonstd::any& any_value = tf_data->at(index).y; + + const bool isRosbagMessage = any_value.type() == typeid(rosbag::MessageInstance); + + if( isRosbagMessage ) + { + const auto& msg_instance = nonstd::any_cast( any_value ); + raw_buffer.resize( msg_instance.size() ); + ros::serialization::OStream ostream(raw_buffer.data(), raw_buffer.size()); + msg_instance.write(ostream); - tf::tfMessage tf_msg; - ros::serialization::IStream istream( raw_buffer.data(), raw_buffer.size() ); - ros::serialization::deserialize(istream, tf_msg); + tf::tfMessage tf_msg; + ros::serialization::IStream istream( raw_buffer.data(), raw_buffer.size() ); + ros::serialization::deserialize(istream, tf_msg); - for(const auto& stamped_transform: tf_msg.transforms) + for(const auto& stamped_transform: tf_msg.transforms) + { + const auto& child_id = stamped_transform.child_frame_id; + auto it = transforms.find(child_id); + if( it == transforms.end()) + { + transforms.insert( {stamped_transform.child_frame_id, stamped_transform} ); + } + else if( it->second.header.stamp < stamped_transform.header.stamp) { - const auto& child_id = stamped_transform.child_frame_id; - auto it = transforms.find(child_id); - if( it == transforms.end()) - { - transforms.insert( {stamped_transform.child_frame_id, stamped_transform} ); - } - else if( it->second.header.stamp < stamped_transform.header.stamp) - { - it->second = stamped_transform; - } + it->second = stamped_transform; } } } - if( !_tf_publisher) - { - _tf_publisher = std::unique_ptr( new tf::TransformBroadcaster ); - } + } - std::vector transforms_vector; + std::vector transforms_vector; + transforms_vector.reserve(transforms.size()); - for(const auto& trans: transforms) - { - transforms_vector.push_back( trans.second ); - } + for(auto& trans: transforms) + { + trans.second.header.stamp = ros_time; + transforms_vector.emplace_back( std::move(trans.second) ); + } - for(auto& stamped_transform: transforms_vector) - { - stamped_transform.header.stamp = ros_time; + _tf_publisher->sendTransform(transforms_vector); +} - } - _tf_publisher->sendTransform(transforms_vector); - } +void TopicPublisherROS::updateState(double current_time) +{ + if(!enabled_ || !_node) return; + + const ros::Time ros_time = ros::Time::now(); + //----------------------------------------------- + broadcastTF(current_time); + //----------------------------------------------- + for(const auto& data_it: _datamap->user_defined ) - { + { const std::string& topic_name = data_it.first; if( _filter_topics && _topics_to_publish.count(topic_name) == 0) { diff --git a/plugins/ROS/TopicPublisherROS/statepublisher_rostopic.h b/plugins/ROS/TopicPublisherROS/statepublisher_rostopic.h index 5221884cc..b4b4f477a 100644 --- a/plugins/ROS/TopicPublisherROS/statepublisher_rostopic.h +++ b/plugins/ROS/TopicPublisherROS/statepublisher_rostopic.h @@ -33,6 +33,9 @@ public slots: void ChangeFilter(bool toggled = true); private: + + void broadcastTF(double current_time); + std::map _publishers; bool enabled_; ros::NodeHandlePtr _node;