From bb579b44a87a0f76527b48dcd6a184aaaefb93cf Mon Sep 17 00:00:00 2001 From: Shanil Date: Sat, 22 Sep 2018 12:44:14 +1000 Subject: [PATCH 01/10] OMS-4 Reset Usb Devices Created a new package #time 3h --- qt-gui.workspace.user | 51 ++++----------- src/gui/CMakeLists.txt | 2 +- src/gui/resources/main_window.qml | 25 ++++++++ src/gui/src/main_application.cpp | 6 ++ src/ros_video_components/package.xml | 26 ++++---- src/usb_reset/CMakeLists.txt | 55 ++++++++++++++++ .../include/usb_reset/owr_ros_components.hpp | 22 +++++++ .../include/usb_reset/ros_usb_reset.hpp | 58 +++++++++++++++++ src/usb_reset/package.xml | 60 +++++++++++++++++ src/usb_reset/src/owr_ros_components.cpp | 13 ++++ src/usb_reset/src/ros_usb_reset.cpp | 64 +++++++++++++++++++ 11 files changed, 328 insertions(+), 54 deletions(-) create mode 100644 src/usb_reset/CMakeLists.txt create mode 100644 src/usb_reset/include/usb_reset/owr_ros_components.hpp create mode 100644 src/usb_reset/include/usb_reset/ros_usb_reset.hpp create mode 100644 src/usb_reset/package.xml create mode 100644 src/usb_reset/src/owr_ros_components.cpp create mode 100644 src/usb_reset/src/ros_usb_reset.cpp diff --git a/qt-gui.workspace.user b/qt-gui.workspace.user index f79686e..004c26a 100644 --- a/qt-gui.workspace.user +++ b/qt-gui.workspace.user @@ -1,10 +1,10 @@ - + EnvironmentId - {87d6e2af-d768-4e25-a852-033ba8fb5a4a} + {1cdd7bd7-53f1-43dd-8e81-2dd8afa72b84} ProjectExplorer.Project.ActiveTarget @@ -19,7 +19,7 @@ Cpp - CppGlobal + ROSProject.CppCodeStyle @@ -54,33 +54,21 @@ ProjectExplorer.Project.PluginSettings - - - + ProjectExplorer.Project.Target.0 Desktop Desktop - {f4cc9e8d-34cc-4663-9466-ea6b16c693b9} + {53a1a275-3cec-4649-8add-1b460e25bc60} 0 0 0 - - true - CatkinMake Step - - ROSProjectManager.ROSCatkinMakeStep - - - - 0 - - 1 + 0 Build ProjectExplorer.BuildSteps.Build @@ -93,28 +81,11 @@ 2 false - - CMAKE_PREFIX_PATH=/home/ros/owr-qtgui/devel:/home/ros/owr_software/rover/devel:/home/ros/ros_deps/devel:/opt/ros/kinetic - LD_LIBRARY_PATH=/home/ros/owr-qtgui/devel/lib:/home/ros/owr_software/rover/devel/lib:/home/ros/ros_deps/devel/lib:/opt/ros/kinetic/lib:/opt/ros/kinetic/lib/x86_64-linux-gnu:/opt/qt57/lib/x86_64-linux-gnu:/opt/qt57/lib - PATH=/opt/ros/kinetic/bin:/opt/qt57/bin:/home/ros/bin:/home/ros/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin - PKG_CONFIG_PATH=/home/ros/owr-qtgui/devel/lib/pkgconfig:/home/ros/owr_software/rover/devel/lib/pkgconfig:/home/ros/ros_deps/devel/lib/pkgconfig:/opt/ros/kinetic/lib/pkgconfig:/opt/ros/kinetic/lib/x86_64-linux-gnu/pkgconfig:/opt/qt57/lib/pkgconfig - PWD=/home/ros/owr-qtgui - PYTHONPATH=/home/ros/owr-qtgui/devel/lib/python2.7/dist-packages:/home/ros/owr_software/rover/devel/lib/python2.7/dist-packages:/home/ros/ros_deps/devel/lib/python2.7/dist-packages:/opt/ros/kinetic/lib/python2.7/dist-packages - ROSLISP_PACKAGE_DIRECTORIES=/home/ros/owr-qtgui/devel/share/common-lisp:/home/ros/owr_software/rover/devel/share/common-lisp:/home/ros/ros_deps/devel/share/common-lisp - ROS_DISTRO=kinetic - ROS_ETC_DIR=/opt/ros/kinetic/etc/ros - ROS_MASTER_URI=http://localhost:11311 - ROS_PACKAGE_PATH=/home/ros/owr-qtgui/src:/home/ros/owr_software/rover/src:/home/ros/ros_deps/src:/opt/ros/kinetic/share - ROS_ROOT=/opt/ros/kinetic/share/ros - ROS_VERSION=1 - SHLVL=3 - TERM=xterm - _=/usr/bin/env - + Debug Debug ROSProjectManager.ROSBuildConfiguration - 0 + 61797536 0 @@ -137,7 +108,7 @@ Release Release ROSProjectManager.ROSBuildConfiguration - 48753808 + 61797536 1 @@ -160,7 +131,7 @@ Release with Debug Information Release with Debug Information ROSProjectManager.ROSBuildConfiguration - 48753808 + 61797536 2 @@ -183,7 +154,7 @@ Minimum Size Release Minimum Size Release ROSProjectManager.ROSBuildConfiguration - 48753808 + 61797536 3 4 diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 526dc55..e854051 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -10,7 +10,7 @@ project(gui) ############################################################################## # qt_build provides the qt cmake glue, roscpp the comms for a default talker -find_package(catkin REQUIRED COMPONENTS qt_build roscpp sensor_msgs image_transport ros_video_components owr_messages) +find_package(catkin REQUIRED COMPONENTS qt_build roscpp sensor_msgs image_transport ros_video_components owr_messages usb_reset) set(QML_IMPORT_PATH "${QML_IMPORT_PATH};${CATKIN_GLOBAL_LIB_DESTINATION}" ) set(QML_IMPORT_PATH2 "${QML_IMPORT_PATH};${CATKIN_GLOBAL_LIB_DESTINATION}" ) include_directories(${catkin_INCLUDE_DIRS}) diff --git a/src/gui/resources/main_window.qml b/src/gui/resources/main_window.qml index da3be17..569b9b5 100644 --- a/src/gui/resources/main_window.qml +++ b/src/gui/resources/main_window.qml @@ -233,4 +233,29 @@ Window { height: 80 } + + /*Item { + id: usb_container + z: 5 + x : 40 + y : 40 + ROSUsbReset { + // @disable-check M16 + objectName: "signal_strength" + id: usb + // @disable-check M16` + anchors.bottom: parent.bottom + // @disable-check M16 + anchors.bottomMargin: 0 + // @disable-check M16 + anchors.top: parent.top + // @disable-check M16 + anchors.left: parent.left + // @disable-check M16 + anchors.right: parent.right + // @disable-check M16 + topic: qsTr("/rover/usb") + } + + }*/ } diff --git a/src/gui/src/main_application.cpp b/src/gui/src/main_application.cpp index 578644c..973a3df 100644 --- a/src/gui/src/main_application.cpp +++ b/src/gui/src/main_application.cpp @@ -8,6 +8,7 @@ #include "ros_video_components/ros_joystick_listener.hpp" #include "ros_video_components/ros_drive_mode.hpp" #include "gui/main_application.hpp" +#include "usb_reset/ros_usb_reset.hpp" Main_Application::Main_Application() {} @@ -19,6 +20,7 @@ void Main_Application::run() { qmlRegisterType("bluesat.owr", 1, 0, "ROSTimer"); qmlRegisterType("bluesat.owr", 1, 0, "ROSJoystickListener"); qmlRegisterType("bluesat.owr", 1, 0, "ROSDriveMode"); + qmlRegisterType("bluesat.owr", 1, 0, "ROSUsbReset"); // this loads the qml file we are about to create this->load(QUrl(QStringLiteral("qrc:/main_window.qml"))); @@ -48,6 +50,10 @@ void Main_Application::run() { Ros_Drive_Mode * drive_mode = this->rootObjects()[0]->findChild(QString("drive_mode")); drive_mode->setup(&nh); + ROS_Usb_Reset * usb_reset = this->rootObjects()[0]->findChild(QString("usb_reset")); + //issue with below line + usb_reset->setup(&nh); + // setup the timer ROSTimer * stopwatch = this->rootObjects()[0]->findChild(QString("timerDisplay")); // the following code section is for debugging diff --git a/src/ros_video_components/package.xml b/src/ros_video_components/package.xml index 0525090..d1fcc57 100644 --- a/src/ros_video_components/package.xml +++ b/src/ros_video_components/package.xml @@ -40,21 +40,21 @@ - catkin - qt_build - roscpp - image_transport - sensor_msgs - libqt4-dev - owr_messages - qt_build - image_transport - sensor_msgs - roscpp - libqt4-dev - owr_messages +catkin +qt_build +roscpp +image_transport +sensor_msgs +libqt4-dev +owr_messages +qt_build +image_transport +sensor_msgs +roscpp +libqt4-dev +owr_messages diff --git a/src/usb_reset/CMakeLists.txt b/src/usb_reset/CMakeLists.txt new file mode 100644 index 0000000..7c8226f --- /dev/null +++ b/src/usb_reset/CMakeLists.txt @@ -0,0 +1,55 @@ +############################################################################## +# CMake +############################################################################## + +cmake_minimum_required(VERSION 2.8.3) +project(usb_reset) + +############################################################################## +# Catkin +############################################################################## + +# qt_build provides the qt cmake glue, roscpp the comms for a default talker +find_package(catkin REQUIRED COMPONENTS qt_build roscpp sensor_msgs image_transport owr_messages) + +include_directories(include ${catkin_INCLUDE_DIRS}) +# Use this to define what the package will export (e.g. libs, headers). +# Since the default here is to produce only a binary, we don't worry about +# exporting anything. +catkin_package( + CATKIN_DEPENDS qt_build roscpp owr_messages std_msgs + INCLUDE_DIRS include + LIBRARIES UsbReset +) + +############################################################################## +# Qt Environment +############################################################################## + +# this comes from qt_build's qt-ros.cmake which is automatically +# included via the dependency ca ll in package.xml +find_package(Qt5 COMPONENTS Core Qml Widgets Quick REQUIRED) + +############################################################################## +# Sections +############################################################################## + +file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/*.qrc) +file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/usb_reset/*.hpp) + +QT5_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES}) +QT5_WRAP_CPP(QT_MOC_HPP ${QT_MOC}) + +############################################################################## +# Sources +############################################################################## + +file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS src/*.cpp) + +############################################################################## +# Binaries +############################################################################## +add_library(UsbReset ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP}) +qt5_use_modules(UsbReset Quick Core Widgets) +target_link_libraries(UsbReset ${QT_LIBRARIES} ${catkin_LIBRARIES}) +target_include_directories(UsbReset PUBLIC include) diff --git a/src/usb_reset/include/usb_reset/owr_ros_components.hpp b/src/usb_reset/include/usb_reset/owr_ros_components.hpp new file mode 100644 index 0000000..fd01ba5 --- /dev/null +++ b/src/usb_reset/include/usb_reset/owr_ros_components.hpp @@ -0,0 +1,22 @@ +/* + * Date Started: 25/07/16 + * Original Author: Harry J.E Day + * Editors: + * Purpose: C++ code representation of the QML package + * This code is released under the MIT License. Copyright BLUEsat UNSW, 2017 + */ +#ifndef OWR_ROS_COMPONENTS_H +#define OWR_ROS_COMPONENTS_H + +#include + + +class OWR_ROS_Components : public QQmlExtensionPlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "bluesat.owr") + + public: + void registerTypes(const char * url); +}; + +#endif // OWR_ROS_COMPONENTS_H diff --git a/src/usb_reset/include/usb_reset/ros_usb_reset.hpp b/src/usb_reset/include/usb_reset/ros_usb_reset.hpp new file mode 100644 index 0000000..3792bc1 --- /dev/null +++ b/src/usb_reset/include/usb_reset/ros_usb_reset.hpp @@ -0,0 +1,58 @@ +/* + * Date Started: 25/12/16 + * Original Author: Harry J.E Day + * Editors: + * Purpose: Widget that renders a video from a ROS sensor_msgs/Image stream. + * This code is released under the MIT License. Copyright BLUEsat UNSW, 2018 + */ +#ifndef ROS_USB_RESET_H +#define ROS_USB_RESET_H + +//QT +#include +#include +#include + +#include + +//ROS +#include +#include "std_msgs/String.h" + +class ROS_Usb_Reset : public QQuickPaintedItem { + //make this a Qt Widget + Q_OBJECT + // defines a qml value for the topic + Q_PROPERTY(QString topic READ get_topic WRITE set_topic NOTIFY topic_changed) + + public: + // Constructor, takes parent widget, which defaults to null + ROS_Usb_Reset(QQuickItem * parent = 0); + + void paint(QPainter *painter); + void setup(ros::NodeHandle * nh); + + protected: + + //getters and setters + void set_topic(const QString &new_value); + QString get_topic() const; + + signals: + void topic_changed(); + + + private: + void receive_msg(const std_msgs::String::ConstPtr & msg); + + // ROS + ros::NodeHandle * nh; + ros::Subscriber usb_sub; + QString topic_value; + bool ros_ready; + + // Used for buffering the image + std::string devices; +}; + +#endif // ROS_USB_RESET_H diff --git a/src/usb_reset/package.xml b/src/usb_reset/package.xml new file mode 100644 index 0000000..a7237f5 --- /dev/null +++ b/src/usb_reset/package.xml @@ -0,0 +1,60 @@ + + + usb_reset + 0.0.0 + The usb_reset package + + + + + ros + + + + + + TODO + + + + + + + + + + + + + + + + + + + + + + + + + + catkin + qt_build + roscpp + libqt4-dev + owr_messages + std_msgs + + qt_build + roscpp + libqt4-dev + owr_messages + std_msgs + + + + + + + diff --git a/src/usb_reset/src/owr_ros_components.cpp b/src/usb_reset/src/owr_ros_components.cpp new file mode 100644 index 0000000..0de60a7 --- /dev/null +++ b/src/usb_reset/src/owr_ros_components.cpp @@ -0,0 +1,13 @@ +/* + * Date Started: 25/07/16 + * Original Author: Harry J.E Day + * Editors: + * Purpose: C++ code representation of the QML package + * This code is released under the MIT License. Copyright BLUEsat UNSW, 2017 + */ +#include "usb_reset/owr_ros_components.hpp" +#include "usb_reset/ros_usb_reset.hpp" + +void OWR_ROS_Components::registerTypes(const char *uri) { + qmlRegisterType("bluesat.owr", 1, 0, "ROSUsbReset"); +} diff --git a/src/usb_reset/src/ros_usb_reset.cpp b/src/usb_reset/src/ros_usb_reset.cpp new file mode 100644 index 0000000..4fe6912 --- /dev/null +++ b/src/usb_reset/src/ros_usb_reset.cpp @@ -0,0 +1,64 @@ +#include "usb_reset/ros_usb_reset.hpp" +#include + +ROS_Usb_Reset::ROS_Usb_Reset(QQuickItem * parent) : + QQuickPaintedItem(parent), + topic_value(), + ros_ready(false), + devices("no devices") { + +} + +void ROS_Usb_Reset::setup(ros::NodeHandle * nh) { + + //TODO: make these parameters of the component + usb_sub = nh->subscribe( + topic_value.toStdString(), + 1, + &ROS_Usb_Reset::receive_msg, + this + ); + + ros_ready = true; + ROS_INFO("Setup of usb component complete"); +} + +void ROS_Usb_Reset::receive_msg(const std_msgs::String::ConstPtr &msg) { + //figure this out + devices = msg->data; + ROS_INFO("Received usb message"); + update(); +} + +void ROS_Usb_Reset::paint(QPainter * painter) { + QLinearGradient linearGradient(0, 0, 100, 100); + linearGradient.setColorAt(0.2, Qt::yellow); + painter->setBrush(linearGradient); + painter->drawRect(10,10,20,20); +} + +void ROS_Usb_Reset::set_topic(const QString & new_value) { + ROS_INFO("new value %s", new_value.toStdString().c_str()); + if(topic_value != new_value) { + topic_value = new_value; + if(!topic_value.isEmpty()) { + if(ros_ready) { + ROS_INFO("new value %s", new_value.toStdString().c_str()); + usb_sub.shutdown(); + usb_sub = nh->subscribe( + topic_value.toStdString(), + 1, + &ROS_Usb_Reset::receive_msg, + this + ); + } + } else { + usb_sub.shutdown(); + } + emit topic_changed(); + } +} + +QString ROS_Usb_Reset::get_topic() const { + return topic_value; +} From 57d67c849c539781cc7bf550dca12c53b1cf0ecd Mon Sep 17 00:00:00 2001 From: Shanil Date: Sat, 2 Mar 2019 15:08:16 +1100 Subject: [PATCH 02/10] still debugging --- qt-gui.workspace.user | 2 +- src/gui/resources/main_window.qml | 56 ++++++++++++++++--- src/gui/src/main_application.cpp | 1 - src/usb_reset/CMakeLists.txt | 4 +- .../include/usb_reset/ros_usb_reset.hpp | 11 +++- src/usb_reset/package.xml | 4 ++ src/usb_reset/src/ros_usb_reset.cpp | 52 ++++++++++++++++- 7 files changed, 116 insertions(+), 14 deletions(-) diff --git a/qt-gui.workspace.user b/qt-gui.workspace.user index 004c26a..eb62751 100644 --- a/qt-gui.workspace.user +++ b/qt-gui.workspace.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/src/gui/resources/main_window.qml b/src/gui/resources/main_window.qml index 569b9b5..30d2d32 100644 --- a/src/gui/resources/main_window.qml +++ b/src/gui/resources/main_window.qml @@ -1,6 +1,7 @@ import QtQuick 2.5 import QtQuick.Window 2.2 import bluesat.owr 1.0 +import QtQuick.Controls 1.4 @@ -234,15 +235,24 @@ Window { } - /*Item { - id: usb_container + + + Item { + id: usb_reset_container z: 5 - x : 40 - y : 40 + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.top: parent.top + anchors.topMargin: 50 + anchors.left: parent.right + anchors.leftMargin: -700 + anchors.bottom: parent.top + anchors.bottomMargin: -100 ROSUsbReset { + signal recieved(int upd) // @disable-check M16 - objectName: "signal_strength" - id: usb + objectName: "usb_reset" + id: usb_reset // @disable-check M16` anchors.bottom: parent.bottom // @disable-check M16 @@ -255,7 +265,39 @@ Window { anchors.right: parent.right // @disable-check M16 topic: qsTr("/rover/usb") + + /*Column { + + id: list + spacing: 10 + Repeater { + model: 1 + id: repeat + Button { + text: "Reset" + onClicked: { + usb_reset.publish(index) + } + + } + } + }*/ + ListView { + model: "myModel" + id: list + width: 50 + height: 1000 + spacing: 10 + delegate: Button {text: "Reset" + onClicked: { + usb_reset.publish(index) + } + } + //count: 5 + } + //list.append(""); + } - }*/ + } } diff --git a/src/gui/src/main_application.cpp b/src/gui/src/main_application.cpp index 973a3df..0731d3b 100644 --- a/src/gui/src/main_application.cpp +++ b/src/gui/src/main_application.cpp @@ -51,7 +51,6 @@ void Main_Application::run() { drive_mode->setup(&nh); ROS_Usb_Reset * usb_reset = this->rootObjects()[0]->findChild(QString("usb_reset")); - //issue with below line usb_reset->setup(&nh); // setup the timer diff --git a/src/usb_reset/CMakeLists.txt b/src/usb_reset/CMakeLists.txt index 7c8226f..0b1f875 100644 --- a/src/usb_reset/CMakeLists.txt +++ b/src/usb_reset/CMakeLists.txt @@ -10,14 +10,14 @@ project(usb_reset) ############################################################################## # qt_build provides the qt cmake glue, roscpp the comms for a default talker -find_package(catkin REQUIRED COMPONENTS qt_build roscpp sensor_msgs image_transport owr_messages) +find_package(catkin REQUIRED COMPONENTS qt_build roscpp sensor_msgs image_transport owr_messages) #sensor_msgs image_transport) include_directories(include ${catkin_INCLUDE_DIRS}) # Use this to define what the package will export (e.g. libs, headers). # Since the default here is to produce only a binary, we don't worry about # exporting anything. catkin_package( - CATKIN_DEPENDS qt_build roscpp owr_messages std_msgs + CATKIN_DEPENDS qt_build roscpp owr_messages std_msgs #sensor_msgs image_transport INCLUDE_DIRS include LIBRARIES UsbReset ) diff --git a/src/usb_reset/include/usb_reset/ros_usb_reset.hpp b/src/usb_reset/include/usb_reset/ros_usb_reset.hpp index 3792bc1..5fd4cbe 100644 --- a/src/usb_reset/include/usb_reset/ros_usb_reset.hpp +++ b/src/usb_reset/include/usb_reset/ros_usb_reset.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -19,18 +20,23 @@ #include #include "std_msgs/String.h" +//other components + class ROS_Usb_Reset : public QQuickPaintedItem { //make this a Qt Widget Q_OBJECT // defines a qml value for the topic Q_PROPERTY(QString topic READ get_topic WRITE set_topic NOTIFY topic_changed) + public: // Constructor, takes parent widget, which defaults to null ROS_Usb_Reset(QQuickItem * parent = 0); void paint(QPainter *painter); void setup(ros::NodeHandle * nh); + Q_INVOKABLE void publish(int num); + Q_INVOKABLE int num_devices(); protected: @@ -40,6 +46,7 @@ class ROS_Usb_Reset : public QQuickPaintedItem { signals: void topic_changed(); + void device_changed(int upd); private: @@ -48,11 +55,13 @@ class ROS_Usb_Reset : public QQuickPaintedItem { // ROS ros::NodeHandle * nh; ros::Subscriber usb_sub; + ros::Publisher usb_pub; QString topic_value; bool ros_ready; - // Used for buffering the image + // Used for storing attached devices std::string devices; + //QStringList buttons; }; #endif // ROS_USB_RESET_H diff --git a/src/usb_reset/package.xml b/src/usb_reset/package.xml index a7237f5..0bcfdb8 100644 --- a/src/usb_reset/package.xml +++ b/src/usb_reset/package.xml @@ -45,12 +45,16 @@ libqt4-dev owr_messages std_msgs + qt_build roscpp libqt4-dev owr_messages std_msgs + diff --git a/src/usb_reset/src/ros_usb_reset.cpp b/src/usb_reset/src/ros_usb_reset.cpp index 4fe6912..9c489f9 100644 --- a/src/usb_reset/src/ros_usb_reset.cpp +++ b/src/usb_reset/src/ros_usb_reset.cpp @@ -1,5 +1,17 @@ #include "usb_reset/ros_usb_reset.hpp" #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int num = 0; ROS_Usb_Reset::ROS_Usb_Reset(QQuickItem * parent) : QQuickPaintedItem(parent), @@ -18,13 +30,17 @@ void ROS_Usb_Reset::setup(ros::NodeHandle * nh) { &ROS_Usb_Reset::receive_msg, this ); + usb_pub = nh->advertise( + "rover/usb/reset", + 1, + false + ); ros_ready = true; ROS_INFO("Setup of usb component complete"); } void ROS_Usb_Reset::receive_msg(const std_msgs::String::ConstPtr &msg) { - //figure this out devices = msg->data; ROS_INFO("Received usb message"); update(); @@ -34,7 +50,29 @@ void ROS_Usb_Reset::paint(QPainter * painter) { QLinearGradient linearGradient(0, 0, 100, 100); linearGradient.setColorAt(0.2, Qt::yellow); painter->setBrush(linearGradient); - painter->drawRect(10,10,20,20); + painter->setPen(Qt::green); + int i = 0; + QString dev = QString::fromStdString(devices); + QStringList list = dev.split("#/#/"); + QQmlEngine engine; + QListView *qlist = this->findChild("list"); + QQuickView view; + view.setSource(QUrl("qrc:main_window.qml")); //says driver mode widget is not registered + QQmlContext *ctxt = view.rootContext(); + int num = list.size(); + ctxt->setContextProperty("myModel", QVariant::fromValue(list)); + for (; i < list.size(); i++) { + painter->drawText(75,(i*35) + 15, list[i]); + } + //ROS_INFO("Got to this point"); + /*int diff = num - i; + int j =0; + if (diff < 0) { + diff = diff * -1; + } else if (diff > 0) { + + }*/ + //view.show(); } void ROS_Usb_Reset::set_topic(const QString & new_value) { @@ -62,3 +100,13 @@ void ROS_Usb_Reset::set_topic(const QString & new_value) { QString ROS_Usb_Reset::get_topic() const { return topic_value; } + +void ROS_Usb_Reset::publish(int num) { + std_msgs::Int16 a; + a.data = num; + usb_pub.publish(a); +} + +int ROS_Usb_Reset::num_devices() { + return num; +} From b28261437660d15f69a24456bb4d76f7f1f456ef Mon Sep 17 00:00:00 2001 From: Shanil Date: Sat, 16 Mar 2019 12:11:38 +1100 Subject: [PATCH 03/10] #OMS-4 Reset Usb devices Got variable buttons working #time 60h --- src/gui/resources/main_window.qml | 22 +----------- src/gui/src/main_application.cpp | 2 +- .../include/usb_reset/ros_usb_reset.hpp | 12 ++++++- src/usb_reset/src/ros_usb_reset.cpp | 34 +++---------------- 4 files changed, 18 insertions(+), 52 deletions(-) diff --git a/src/gui/resources/main_window.qml b/src/gui/resources/main_window.qml index 30d2d32..d2b99cc 100644 --- a/src/gui/resources/main_window.qml +++ b/src/gui/resources/main_window.qml @@ -265,25 +265,8 @@ Window { anchors.right: parent.right // @disable-check M16 topic: qsTr("/rover/usb") - - /*Column { - - id: list - spacing: 10 - Repeater { - model: 1 - id: repeat - Button { - text: "Reset" - onClicked: { - usb_reset.publish(index) - } - - } - } - }*/ ListView { - model: "myModel" + model: myModel id: list width: 50 height: 1000 @@ -293,10 +276,7 @@ Window { usb_reset.publish(index) } } - //count: 5 } - //list.append(""); - } } diff --git a/src/gui/src/main_application.cpp b/src/gui/src/main_application.cpp index 0731d3b..45e1ef0 100644 --- a/src/gui/src/main_application.cpp +++ b/src/gui/src/main_application.cpp @@ -51,7 +51,7 @@ void Main_Application::run() { drive_mode->setup(&nh); ROS_Usb_Reset * usb_reset = this->rootObjects()[0]->findChild(QString("usb_reset")); - usb_reset->setup(&nh); + usb_reset->setup(&nh, this->rootContext()); // setup the timer ROSTimer * stopwatch = this->rootObjects()[0]->findChild(QString("timerDisplay")); diff --git a/src/usb_reset/include/usb_reset/ros_usb_reset.hpp b/src/usb_reset/include/usb_reset/ros_usb_reset.hpp index 5fd4cbe..0cf35a5 100644 --- a/src/usb_reset/include/usb_reset/ros_usb_reset.hpp +++ b/src/usb_reset/include/usb_reset/ros_usb_reset.hpp @@ -15,10 +15,19 @@ #include #include +#include +#include +#include +#include +#include +#include +#include //ROS #include #include "std_msgs/String.h" +#include +#include //other components @@ -34,7 +43,7 @@ class ROS_Usb_Reset : public QQuickPaintedItem { ROS_Usb_Reset(QQuickItem * parent = 0); void paint(QPainter *painter); - void setup(ros::NodeHandle * nh); + void setup(ros::NodeHandle * nh, QQmlContext *ctxt); Q_INVOKABLE void publish(int num); Q_INVOKABLE int num_devices(); @@ -58,6 +67,7 @@ class ROS_Usb_Reset : public QQuickPaintedItem { ros::Publisher usb_pub; QString topic_value; bool ros_ready; + QQmlContext *curr_ctxt; // Used for storing attached devices std::string devices; diff --git a/src/usb_reset/src/ros_usb_reset.cpp b/src/usb_reset/src/ros_usb_reset.cpp index 9c489f9..43e5ad0 100644 --- a/src/usb_reset/src/ros_usb_reset.cpp +++ b/src/usb_reset/src/ros_usb_reset.cpp @@ -1,15 +1,4 @@ #include "usb_reset/ros_usb_reset.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include int num = 0; @@ -21,7 +10,7 @@ ROS_Usb_Reset::ROS_Usb_Reset(QQuickItem * parent) : } -void ROS_Usb_Reset::setup(ros::NodeHandle * nh) { +void ROS_Usb_Reset::setup(ros::NodeHandle * nh, QQmlContext *ctxt) { //TODO: make these parameters of the component usb_sub = nh->subscribe( @@ -37,12 +26,13 @@ void ROS_Usb_Reset::setup(ros::NodeHandle * nh) { ); ros_ready = true; + curr_ctxt = ctxt; ROS_INFO("Setup of usb component complete"); } void ROS_Usb_Reset::receive_msg(const std_msgs::String::ConstPtr &msg) { devices = msg->data; - ROS_INFO("Received usb message"); + //ROS_INFO("Received usb message"); update(); } @@ -54,25 +44,11 @@ void ROS_Usb_Reset::paint(QPainter * painter) { int i = 0; QString dev = QString::fromStdString(devices); QStringList list = dev.split("#/#/"); - QQmlEngine engine; - QListView *qlist = this->findChild("list"); - QQuickView view; - view.setSource(QUrl("qrc:main_window.qml")); //says driver mode widget is not registered - QQmlContext *ctxt = view.rootContext(); - int num = list.size(); - ctxt->setContextProperty("myModel", QVariant::fromValue(list)); + curr_ctxt->setContextProperty("myModel", (list.size() - 1)); for (; i < list.size(); i++) { painter->drawText(75,(i*35) + 15, list[i]); } - //ROS_INFO("Got to this point"); - /*int diff = num - i; - int j =0; - if (diff < 0) { - diff = diff * -1; - } else if (diff > 0) { - - }*/ - //view.show(); + } void ROS_Usb_Reset::set_topic(const QString & new_value) { From cf6c1de09d887c3b02033fa15442cc20e4e49150 Mon Sep 17 00:00:00 2001 From: Shanil Date: Sat, 30 Mar 2019 14:48:35 +1100 Subject: [PATCH 04/10] Program working #time 3h --- src/gui/resources/main_window.qml | 7 ++++--- src/gui/src/main_application.cpp | 1 + src/usb_reset/src/ros_usb_reset.cpp | 7 ++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gui/resources/main_window.qml b/src/gui/resources/main_window.qml index d2b99cc..09b5abf 100644 --- a/src/gui/resources/main_window.qml +++ b/src/gui/resources/main_window.qml @@ -74,6 +74,7 @@ Window { Item { id: signal_strength_container + width: 173 z: 4 anchors.right: parent.right anchors.rightMargin: 0 @@ -243,11 +244,11 @@ Window { anchors.right: parent.right anchors.rightMargin: 0 anchors.top: parent.top - anchors.topMargin: 50 + anchors.topMargin: 150 anchors.left: parent.right anchors.leftMargin: -700 anchors.bottom: parent.top - anchors.bottomMargin: -100 + anchors.bottomMargin: -300 ROSUsbReset { signal recieved(int upd) // @disable-check M16 @@ -268,7 +269,7 @@ Window { ListView { model: myModel id: list - width: 50 + width: 500 height: 1000 spacing: 10 delegate: Button {text: "Reset" diff --git a/src/gui/src/main_application.cpp b/src/gui/src/main_application.cpp index 45e1ef0..32b33f3 100644 --- a/src/gui/src/main_application.cpp +++ b/src/gui/src/main_application.cpp @@ -50,6 +50,7 @@ void Main_Application::run() { Ros_Drive_Mode * drive_mode = this->rootObjects()[0]->findChild(QString("drive_mode")); drive_mode->setup(&nh); + //this->rootContext passes the root context of main_window.qml ROS_Usb_Reset * usb_reset = this->rootObjects()[0]->findChild(QString("usb_reset")); usb_reset->setup(&nh, this->rootContext()); diff --git a/src/usb_reset/src/ros_usb_reset.cpp b/src/usb_reset/src/ros_usb_reset.cpp index 43e5ad0..fcc8e44 100644 --- a/src/usb_reset/src/ros_usb_reset.cpp +++ b/src/usb_reset/src/ros_usb_reset.cpp @@ -44,8 +44,13 @@ void ROS_Usb_Reset::paint(QPainter * painter) { int i = 0; QString dev = QString::fromStdString(devices); QStringList list = dev.split("#/#/"); + /*for (int j = 0; j < list.size(); j++) { + std::cout<setContextProperty("myModel", (list.size() - 1)); - for (; i < list.size(); i++) { + for (; i < list.size() - 1; i++) { + //write the name of the usb device painter->drawText(75,(i*35) + 15, list[i]); } From cd8cd5c229486ed6f55c11db89ea8ad7d40bcfd2 Mon Sep 17 00:00:00 2001 From: Shanil Date: Sat, 6 Apr 2019 11:36:28 +1100 Subject: [PATCH 05/10] Fixed some formatting #time 1h --- qt-gui.workspace.user | 2 +- src/gui/resources/main_window.qml | 2 +- src/usb_reset/include/usb_reset/ros_usb_reset.hpp | 1 - src/usb_reset/src/ros_usb_reset.cpp | 4 ---- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/qt-gui.workspace.user b/qt-gui.workspace.user index eb62751..cb22d95 100644 --- a/qt-gui.workspace.user +++ b/qt-gui.workspace.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/src/gui/resources/main_window.qml b/src/gui/resources/main_window.qml index 09b5abf..bb9b5af 100644 --- a/src/gui/resources/main_window.qml +++ b/src/gui/resources/main_window.qml @@ -244,7 +244,7 @@ Window { anchors.right: parent.right anchors.rightMargin: 0 anchors.top: parent.top - anchors.topMargin: 150 + anchors.topMargin: 80 anchors.left: parent.right anchors.leftMargin: -700 anchors.bottom: parent.top diff --git a/src/usb_reset/include/usb_reset/ros_usb_reset.hpp b/src/usb_reset/include/usb_reset/ros_usb_reset.hpp index 0cf35a5..a225d47 100644 --- a/src/usb_reset/include/usb_reset/ros_usb_reset.hpp +++ b/src/usb_reset/include/usb_reset/ros_usb_reset.hpp @@ -71,7 +71,6 @@ class ROS_Usb_Reset : public QQuickPaintedItem { // Used for storing attached devices std::string devices; - //QStringList buttons; }; #endif // ROS_USB_RESET_H diff --git a/src/usb_reset/src/ros_usb_reset.cpp b/src/usb_reset/src/ros_usb_reset.cpp index fcc8e44..6d6774c 100644 --- a/src/usb_reset/src/ros_usb_reset.cpp +++ b/src/usb_reset/src/ros_usb_reset.cpp @@ -32,7 +32,6 @@ void ROS_Usb_Reset::setup(ros::NodeHandle * nh, QQmlContext *ctxt) { void ROS_Usb_Reset::receive_msg(const std_msgs::String::ConstPtr &msg) { devices = msg->data; - //ROS_INFO("Received usb message"); update(); } @@ -44,9 +43,6 @@ void ROS_Usb_Reset::paint(QPainter * painter) { int i = 0; QString dev = QString::fromStdString(devices); QStringList list = dev.split("#/#/"); - /*for (int j = 0; j < list.size(); j++) { - std::cout<setContextProperty("myModel", (list.size() - 1)); for (; i < list.size() - 1; i++) { From 1eb36d3f602edaf07c1ccb0021ea226441290926 Mon Sep 17 00:00:00 2001 From: Shanil Date: Sat, 13 Apr 2019 13:21:29 +1000 Subject: [PATCH 06/10] #time 1d fixing some pull request things --- qt-gui.workspace.user | 2 +- src/gui/resources/main_window.qml | 2 +- .../include/usb_reset/owr_ros_components.hpp | 4 +-- .../include/usb_reset/ros_usb_reset.hpp | 6 ++-- src/usb_reset/package.xml | 30 +++++++++---------- src/usb_reset/src/ros_usb_reset.cpp | 4 +-- 6 files changed, 23 insertions(+), 25 deletions(-) diff --git a/qt-gui.workspace.user b/qt-gui.workspace.user index cb22d95..7691cc4 100644 --- a/qt-gui.workspace.user +++ b/qt-gui.workspace.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/src/gui/resources/main_window.qml b/src/gui/resources/main_window.qml index bb9b5af..9bde009 100644 --- a/src/gui/resources/main_window.qml +++ b/src/gui/resources/main_window.qml @@ -267,7 +267,7 @@ Window { // @disable-check M16 topic: qsTr("/rover/usb") ListView { - model: myModel + model: usbDevices id: list width: 500 height: 1000 diff --git a/src/usb_reset/include/usb_reset/owr_ros_components.hpp b/src/usb_reset/include/usb_reset/owr_ros_components.hpp index fd01ba5..dd45fc6 100644 --- a/src/usb_reset/include/usb_reset/owr_ros_components.hpp +++ b/src/usb_reset/include/usb_reset/owr_ros_components.hpp @@ -1,6 +1,6 @@ /* - * Date Started: 25/07/16 - * Original Author: Harry J.E Day + * Date Started: 11/08/18 + * Original Author: Lasindu Shanil de Silva * Editors: * Purpose: C++ code representation of the QML package * This code is released under the MIT License. Copyright BLUEsat UNSW, 2017 diff --git a/src/usb_reset/include/usb_reset/ros_usb_reset.hpp b/src/usb_reset/include/usb_reset/ros_usb_reset.hpp index a225d47..eed9796 100644 --- a/src/usb_reset/include/usb_reset/ros_usb_reset.hpp +++ b/src/usb_reset/include/usb_reset/ros_usb_reset.hpp @@ -1,8 +1,8 @@ /* - * Date Started: 25/12/16 - * Original Author: Harry J.E Day + * Date Started: 11/08/18 + * Original Author: Lasindu Shanil de Silva * Editors: - * Purpose: Widget that renders a video from a ROS sensor_msgs/Image stream. + * Purpose: Widget to create buttons to reset usb devices * This code is released under the MIT License. Copyright BLUEsat UNSW, 2018 */ #ifndef ROS_USB_RESET_H diff --git a/src/usb_reset/package.xml b/src/usb_reset/package.xml index 0bcfdb8..0efbac6 100644 --- a/src/usb_reset/package.xml +++ b/src/usb_reset/package.xml @@ -39,22 +39,22 @@ - catkin - qt_build - roscpp - libqt4-dev - owr_messages - std_msgs - +catkin +qt_build +roscpp +libqt4-dev +owr_messages +std_msgs + - qt_build - roscpp - libqt4-dev - owr_messages - std_msgs - +qt_build +roscpp +libqt4-dev +owr_messages +std_msgs + diff --git a/src/usb_reset/src/ros_usb_reset.cpp b/src/usb_reset/src/ros_usb_reset.cpp index 6d6774c..3528c3a 100644 --- a/src/usb_reset/src/ros_usb_reset.cpp +++ b/src/usb_reset/src/ros_usb_reset.cpp @@ -11,8 +11,6 @@ ROS_Usb_Reset::ROS_Usb_Reset(QQuickItem * parent) : } void ROS_Usb_Reset::setup(ros::NodeHandle * nh, QQmlContext *ctxt) { - - //TODO: make these parameters of the component usb_sub = nh->subscribe( topic_value.toStdString(), 1, @@ -44,7 +42,7 @@ void ROS_Usb_Reset::paint(QPainter * painter) { QString dev = QString::fromStdString(devices); QStringList list = dev.split("#/#/"); //create the neccessary number of buttons - curr_ctxt->setContextProperty("myModel", (list.size() - 1)); + curr_ctxt->setContextProperty("usbDevices", (list.size() - 1)); for (; i < list.size() - 1; i++) { //write the name of the usb device painter->drawText(75,(i*35) + 15, list[i]); From 0b7ce115c4d9ca3b4295023aaccbd122a77ee09c Mon Sep 17 00:00:00 2001 From: Shanil Date: Sat, 13 Apr 2019 15:25:16 +1000 Subject: [PATCH 07/10] #time 1d Finished most of the pull request comments --- src/owr_messages/CMakeLists.txt | 12 ++++++++++ src/owr_messages/msg/devices.msg | 1 + .../include/usb_reset/owr_ros_components.hpp | 2 +- .../include/usb_reset/ros_usb_reset.hpp | 13 +++++----- src/usb_reset/package.xml | 4 +--- src/usb_reset/src/owr_ros_components.cpp | 6 ++--- src/usb_reset/src/ros_usb_reset.cpp | 24 ++++++++++--------- 7 files changed, 37 insertions(+), 25 deletions(-) create mode 100644 src/owr_messages/msg/devices.msg diff --git a/src/owr_messages/CMakeLists.txt b/src/owr_messages/CMakeLists.txt index 890c1cf..6f979f1 100644 --- a/src/owr_messages/CMakeLists.txt +++ b/src/owr_messages/CMakeLists.txt @@ -51,7 +51,19 @@ find_package(catkin REQUIRED COMPONENTS add_message_files( FILES activeCameras.msg + camera_angle.msg + motor.msg + status.msg stream.msg + position.msg + voltage.msg + ultrasonic.msg + heading.msg + pwm.msg + board.msg + adc.msg + stop.msg + devices.msg ) ## Generate services in the 'srv' folder diff --git a/src/owr_messages/msg/devices.msg b/src/owr_messages/msg/devices.msg new file mode 100644 index 0000000..c4195ec --- /dev/null +++ b/src/owr_messages/msg/devices.msg @@ -0,0 +1 @@ +string[] devices \ No newline at end of file diff --git a/src/usb_reset/include/usb_reset/owr_ros_components.hpp b/src/usb_reset/include/usb_reset/owr_ros_components.hpp index dd45fc6..7f986b5 100644 --- a/src/usb_reset/include/usb_reset/owr_ros_components.hpp +++ b/src/usb_reset/include/usb_reset/owr_ros_components.hpp @@ -3,7 +3,7 @@ * Original Author: Lasindu Shanil de Silva * Editors: * Purpose: C++ code representation of the QML package - * This code is released under the MIT License. Copyright BLUEsat UNSW, 2017 + * This code is released under the MIT License. Copyright BLUEsat UNSW, 2019 */ #ifndef OWR_ROS_COMPONENTS_H #define OWR_ROS_COMPONENTS_H diff --git a/src/usb_reset/include/usb_reset/ros_usb_reset.hpp b/src/usb_reset/include/usb_reset/ros_usb_reset.hpp index eed9796..0ce2c7f 100644 --- a/src/usb_reset/include/usb_reset/ros_usb_reset.hpp +++ b/src/usb_reset/include/usb_reset/ros_usb_reset.hpp @@ -3,7 +3,7 @@ * Original Author: Lasindu Shanil de Silva * Editors: * Purpose: Widget to create buttons to reset usb devices - * This code is released under the MIT License. Copyright BLUEsat UNSW, 2018 + * This code is released under the MIT License. Copyright BLUEsat UNSW, 2019 */ #ifndef ROS_USB_RESET_H #define ROS_USB_RESET_H @@ -28,8 +28,7 @@ #include "std_msgs/String.h" #include #include - -//other components +#include "owr_messages/devices.h" class ROS_Usb_Reset : public QQuickPaintedItem { //make this a Qt Widget @@ -55,11 +54,9 @@ class ROS_Usb_Reset : public QQuickPaintedItem { signals: void topic_changed(); - void device_changed(int upd); - private: - void receive_msg(const std_msgs::String::ConstPtr & msg); + void receive_msg(const owr_messages::devices::ConstPtr & msg); // ROS ros::NodeHandle * nh; @@ -70,7 +67,9 @@ class ROS_Usb_Reset : public QQuickPaintedItem { QQmlContext *curr_ctxt; // Used for storing attached devices - std::string devices; + std::string devices[100]; + // Holds number of attached devices + int num; }; #endif // ROS_USB_RESET_H diff --git a/src/usb_reset/package.xml b/src/usb_reset/package.xml index 0efbac6..73403d8 100644 --- a/src/usb_reset/package.xml +++ b/src/usb_reset/package.xml @@ -10,9 +10,7 @@ ros - - - + TODO diff --git a/src/usb_reset/src/owr_ros_components.cpp b/src/usb_reset/src/owr_ros_components.cpp index 0de60a7..6022d2a 100644 --- a/src/usb_reset/src/owr_ros_components.cpp +++ b/src/usb_reset/src/owr_ros_components.cpp @@ -1,9 +1,9 @@ /* - * Date Started: 25/07/16 - * Original Author: Harry J.E Day + * Date Started: 11/08/18 + * Original Author: Lasindu Shanil de Silva * Editors: * Purpose: C++ code representation of the QML package - * This code is released under the MIT License. Copyright BLUEsat UNSW, 2017 + * This code is released under the MIT License. Copyright BLUEsat UNSW, 2019 */ #include "usb_reset/owr_ros_components.hpp" #include "usb_reset/ros_usb_reset.hpp" diff --git a/src/usb_reset/src/ros_usb_reset.cpp b/src/usb_reset/src/ros_usb_reset.cpp index 3528c3a..4b14427 100644 --- a/src/usb_reset/src/ros_usb_reset.cpp +++ b/src/usb_reset/src/ros_usb_reset.cpp @@ -6,13 +6,14 @@ ROS_Usb_Reset::ROS_Usb_Reset(QQuickItem * parent) : QQuickPaintedItem(parent), topic_value(), ros_ready(false), - devices("no devices") { + num(0), + devices() { } void ROS_Usb_Reset::setup(ros::NodeHandle * nh, QQmlContext *ctxt) { usb_sub = nh->subscribe( - topic_value.toStdString(), + "rover/usb", 1, &ROS_Usb_Reset::receive_msg, this @@ -28,24 +29,25 @@ void ROS_Usb_Reset::setup(ros::NodeHandle * nh, QQmlContext *ctxt) { ROS_INFO("Setup of usb component complete"); } -void ROS_Usb_Reset::receive_msg(const std_msgs::String::ConstPtr &msg) { - devices = msg->data; +void ROS_Usb_Reset::receive_msg(const owr_messages::devices::ConstPtr & msg) { + int i = 0; + for(; i < msg->devices.size(); i++) { + devices[i] = msg->devices[i]; + } + num = i; update(); } -void ROS_Usb_Reset::paint(QPainter * painter) { - QLinearGradient linearGradient(0, 0, 100, 100); +void ROS_Usb_Reset::paint(QPainter * painter) {QLinearGradient linearGradient(0, 0, 100, 100); linearGradient.setColorAt(0.2, Qt::yellow); painter->setBrush(linearGradient); painter->setPen(Qt::green); int i = 0; - QString dev = QString::fromStdString(devices); - QStringList list = dev.split("#/#/"); //create the neccessary number of buttons - curr_ctxt->setContextProperty("usbDevices", (list.size() - 1)); - for (; i < list.size() - 1; i++) { + curr_ctxt->setContextProperty("usbDevices", (num - 1)); + for (; i < num - 1; i++) { //write the name of the usb device - painter->drawText(75,(i*35) + 15, list[i]); + painter->drawText(75,(i*35) + 15, QString::fromStdString(devices[i])); } } From 2dc71c260cd33a26b52371d3ec5640db9d907509 Mon Sep 17 00:00:00 2001 From: Shanil Date: Sat, 18 May 2019 15:33:22 +1000 Subject: [PATCH 08/10] #time 1h still having build system issues --- src/gui/package.xml | 2 + .../msg/{camera_angle~ => camera_angle.msg} | 4 +- src/usb_reset/CMakeLists.txt | 214 ++++++++++++++---- .../include/usb_reset/owr_ros_components.hpp | 22 -- src/usb_reset/package.xml | 30 +-- src/usb_reset/src/owr_ros_components.cpp | 13 -- 6 files changed, 190 insertions(+), 95 deletions(-) rename src/owr_messages/msg/{camera_angle~ => camera_angle.msg} (67%) delete mode 100644 src/usb_reset/include/usb_reset/owr_ros_components.hpp delete mode 100644 src/usb_reset/src/owr_ros_components.cpp diff --git a/src/gui/package.xml b/src/gui/package.xml index 1510a7e..7912c96 100644 --- a/src/gui/package.xml +++ b/src/gui/package.xml @@ -47,6 +47,8 @@ sensor_msgs libqt4-dev ros_video_components + usb_reset + usb_reset ros_video_components qt_build image_transport diff --git a/src/owr_messages/msg/camera_angle~ b/src/owr_messages/msg/camera_angle.msg similarity index 67% rename from src/owr_messages/msg/camera_angle~ rename to src/owr_messages/msg/camera_angle.msg index 1600bca..d18e1e9 100644 --- a/src/owr_messages/msg/camera_angle~ +++ b/src/owr_messages/msg/camera_angle.msg @@ -1,3 +1,3 @@ -Vector3 angle -Int32 feed_number +geometry_msgs/Vector3 angle +int32 feed_number diff --git a/src/usb_reset/CMakeLists.txt b/src/usb_reset/CMakeLists.txt index 0b1f875..2b9efb4 100644 --- a/src/usb_reset/CMakeLists.txt +++ b/src/usb_reset/CMakeLists.txt @@ -1,55 +1,189 @@ -############################################################################## -# CMake -############################################################################## - cmake_minimum_required(VERSION 2.8.3) project(usb_reset) -############################################################################## -# Catkin -############################################################################## +## Find catkin macros and libraries +## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) +## is used, also find other catkin packages +find_package(catkin REQUIRED COMPONENTS + owr_messages + roscpp + std_msgs +) + +## System dependencies are found with CMake's conventions +# find_package(Boost REQUIRED COMPONENTS system) + + +## Uncomment this if the package has a setup.py. This macro ensures +## modules and global scripts declared therein get installed +## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html +# catkin_python_setup() + +################################################ +## Declare ROS messages, services and actions ## +################################################ + +## To declare and build messages, services or actions from within this +## package, follow these steps: +## * Let MSG_DEP_SET be the set of packages whose message types you use in +## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). +## * In the file package.xml: +## * add a build_depend tag for "message_generation" +## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET +## * If MSG_DEP_SET isn't empty the following dependency has been pulled in +## but can be declared for certainty nonetheless: +## * add a run_depend tag for "message_runtime" +## * In this file (CMakeLists.txt): +## * add "message_generation" and every package in MSG_DEP_SET to +## find_package(catkin REQUIRED COMPONENTS ...) +## * add "message_runtime" and every package in MSG_DEP_SET to +## catkin_package(CATKIN_DEPENDS ...) +## * uncomment the add_*_files sections below as needed +## and list every .msg/.srv/.action file to be processed +## * uncomment the generate_messages entry below +## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) + +## Generate messages in the 'msg' folder +# add_message_files( +# FILES +# Message1.msg +# Message2.msg +# ) + +## Generate services in the 'srv' folder +# add_service_files( +# FILES +# Service1.srv +# Service2.srv +# ) + +## Generate actions in the 'action' folder +# add_action_files( +# FILES +# Action1.action +# Action2.action +# ) + +## Generate added messages and services with any dependencies listed here +# generate_messages( +# DEPENDENCIES +# std_msgs +# ) -# qt_build provides the qt cmake glue, roscpp the comms for a default talker -find_package(catkin REQUIRED COMPONENTS qt_build roscpp sensor_msgs image_transport owr_messages) #sensor_msgs image_transport) +################################################ +## Declare ROS dynamic reconfigure parameters ## +################################################ -include_directories(include ${catkin_INCLUDE_DIRS}) -# Use this to define what the package will export (e.g. libs, headers). -# Since the default here is to produce only a binary, we don't worry about -# exporting anything. +## To declare and build dynamic reconfigure parameters within this +## package, follow these steps: +## * In the file package.xml: +## * add a build_depend and a run_depend tag for "dynamic_reconfigure" +## * In this file (CMakeLists.txt): +## * add "dynamic_reconfigure" to +## find_package(catkin REQUIRED COMPONENTS ...) +## * uncomment the "generate_dynamic_reconfigure_options" section below +## and list every .cfg file to be processed + +## Generate dynamic reconfigure parameters in the 'cfg' folder +# generate_dynamic_reconfigure_options( +# cfg/DynReconf1.cfg +# cfg/DynReconf2.cfg +# ) + +################################### +## catkin specific configuration ## +################################### +## The catkin_package macro generates cmake config files for your package +## Declare things to be passed to dependent projects +## INCLUDE_DIRS: uncomment this if you package contains header files +## LIBRARIES: libraries you create in this project that dependent projects also need +## CATKIN_DEPENDS: catkin_packages dependent projects also need +## DEPENDS: system dependencies of this project that dependent projects also need catkin_package( - CATKIN_DEPENDS qt_build roscpp owr_messages std_msgs #sensor_msgs image_transport - INCLUDE_DIRS include - LIBRARIES UsbReset +# INCLUDE_DIRS include +# LIBRARIES usb_reset +# CATKIN_DEPENDS owr_messages roscpp std_msgs +# DEPENDS system_lib +) + +########### +## Build ## +########### + +## Specify additional locations of header files +## Your package locations should be listed before other locations +# include_directories(include) +include_directories( + ${catkin_INCLUDE_DIRS} + include ) -############################################################################## -# Qt Environment -############################################################################## +## Declare a C++ library +# add_library(usb_reset +# src/${PROJECT_NAME}/usb_reset.cpp +# ) + +## Add cmake target dependencies of the library +## as an example, code may need to be generated before libraries +## either from message generation or dynamic reconfigure +# add_dependencies(usb_reset ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + +## Declare a C++ executable +# add_executable(usb_reset_node src/usb_reset_node.cpp) + +## Add cmake target dependencies of the executable +## same as for the library above +# add_dependencies(usb_reset_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + +## Specify libraries to link a library or executable target against +# target_link_libraries(usb_reset_node +# ${catkin_LIBRARIES} +# ) + +############# +## Install ## +############# + +# all install targets should use catkin DESTINATION variables +# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html -# this comes from qt_build's qt-ros.cmake which is automatically -# included via the dependency ca ll in package.xml -find_package(Qt5 COMPONENTS Core Qml Widgets Quick REQUIRED) +## Mark executable scripts (Python etc.) for installation +## in contrast to setup.py, you can choose the destination +# install(PROGRAMS +# scripts/my_python_script +# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} +# ) -############################################################################## -# Sections -############################################################################## +## Mark executables and/or libraries for installation +# install(TARGETS usb_reset usb_reset_node +# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} +# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} +# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} +# ) -file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/*.qrc) -file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/usb_reset/*.hpp) +## Mark cpp header files for installation +# install(DIRECTORY include/${PROJECT_NAME}/ +# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} +# FILES_MATCHING PATTERN "*.h" +# PATTERN ".svn" EXCLUDE +# ) -QT5_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES}) -QT5_WRAP_CPP(QT_MOC_HPP ${QT_MOC}) +## Mark other files for installation (e.g. launch and bag files, etc.) +# install(FILES +# # myfile1 +# # myfile2 +# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} +# ) -############################################################################## -# Sources -############################################################################## +############# +## Testing ## +############# -file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS src/*.cpp) +## Add gtest based cpp test target and link libraries +# catkin_add_gtest(${PROJECT_NAME}-test test/test_usb_reset.cpp) +# if(TARGET ${PROJECT_NAME}-test) +# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) +# endif() -############################################################################## -# Binaries -############################################################################## -add_library(UsbReset ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP}) -qt5_use_modules(UsbReset Quick Core Widgets) -target_link_libraries(UsbReset ${QT_LIBRARIES} ${catkin_LIBRARIES}) -target_include_directories(UsbReset PUBLIC include) +## Add folders to be run by python nosetests +# catkin_add_nosetests(test) diff --git a/src/usb_reset/include/usb_reset/owr_ros_components.hpp b/src/usb_reset/include/usb_reset/owr_ros_components.hpp deleted file mode 100644 index 7f986b5..0000000 --- a/src/usb_reset/include/usb_reset/owr_ros_components.hpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Date Started: 11/08/18 - * Original Author: Lasindu Shanil de Silva - * Editors: - * Purpose: C++ code representation of the QML package - * This code is released under the MIT License. Copyright BLUEsat UNSW, 2019 - */ -#ifndef OWR_ROS_COMPONENTS_H -#define OWR_ROS_COMPONENTS_H - -#include - - -class OWR_ROS_Components : public QQmlExtensionPlugin { - Q_OBJECT - Q_PLUGIN_METADATA(IID "bluesat.owr") - - public: - void registerTypes(const char * url); -}; - -#endif // OWR_ROS_COMPONENTS_H diff --git a/src/usb_reset/package.xml b/src/usb_reset/package.xml index 73403d8..2a02924 100644 --- a/src/usb_reset/package.xml +++ b/src/usb_reset/package.xml @@ -10,7 +10,9 @@ ros - + + + TODO @@ -37,26 +39,18 @@ -catkin -qt_build -roscpp -libqt4-dev -owr_messages -std_msgs - - -qt_build -roscpp -libqt4-dev -owr_messages -std_msgs - + catkin + owr_messages + roscpp + std_msgs + owr_messages + roscpp + std_msgs + - + \ No newline at end of file diff --git a/src/usb_reset/src/owr_ros_components.cpp b/src/usb_reset/src/owr_ros_components.cpp deleted file mode 100644 index 6022d2a..0000000 --- a/src/usb_reset/src/owr_ros_components.cpp +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Date Started: 11/08/18 - * Original Author: Lasindu Shanil de Silva - * Editors: - * Purpose: C++ code representation of the QML package - * This code is released under the MIT License. Copyright BLUEsat UNSW, 2019 - */ -#include "usb_reset/owr_ros_components.hpp" -#include "usb_reset/ros_usb_reset.hpp" - -void OWR_ROS_Components::registerTypes(const char *uri) { - qmlRegisterType("bluesat.owr", 1, 0, "ROSUsbReset"); -} From b3815daf45d4b60bb0267eeba6f41e20370dedc2 Mon Sep 17 00:00:00 2001 From: Shanil Date: Sat, 18 May 2019 15:39:11 +1000 Subject: [PATCH 09/10] #time 15m added messages --- src/owr_messages/msg/adc.msg | 3 +++ src/owr_messages/msg/board.msg | 2 ++ src/owr_messages/msg/heading.msg | 1 + src/owr_messages/msg/motor.msg | 3 +++ src/owr_messages/msg/position.msg | 35 +++++++++++++++++++++++++++++ src/owr_messages/msg/pwm.msg | 6 +++++ src/owr_messages/msg/status.msg | 2 ++ src/owr_messages/msg/stop.msg | 2 ++ src/owr_messages/msg/ultrasonic.msg | 1 + src/owr_messages/msg/voltage.msg | 1 + 10 files changed, 56 insertions(+) create mode 100644 src/owr_messages/msg/adc.msg create mode 100644 src/owr_messages/msg/board.msg create mode 100644 src/owr_messages/msg/heading.msg create mode 100644 src/owr_messages/msg/motor.msg create mode 100644 src/owr_messages/msg/position.msg create mode 100644 src/owr_messages/msg/pwm.msg create mode 100644 src/owr_messages/msg/status.msg create mode 100644 src/owr_messages/msg/stop.msg create mode 100644 src/owr_messages/msg/ultrasonic.msg create mode 100644 src/owr_messages/msg/voltage.msg diff --git a/src/owr_messages/msg/adc.msg b/src/owr_messages/msg/adc.msg new file mode 100644 index 0000000..f89a760 --- /dev/null +++ b/src/owr_messages/msg/adc.msg @@ -0,0 +1,3 @@ +Header header +float32[] pot +string[] potFrame diff --git a/src/owr_messages/msg/board.msg b/src/owr_messages/msg/board.msg new file mode 100644 index 0000000..add85e6 --- /dev/null +++ b/src/owr_messages/msg/board.msg @@ -0,0 +1,2 @@ +pwm[] joints +Header header \ No newline at end of file diff --git a/src/owr_messages/msg/heading.msg b/src/owr_messages/msg/heading.msg new file mode 100644 index 0000000..45c0beb --- /dev/null +++ b/src/owr_messages/msg/heading.msg @@ -0,0 +1 @@ +float64 heading diff --git a/src/owr_messages/msg/motor.msg b/src/owr_messages/msg/motor.msg new file mode 100644 index 0000000..0501815 --- /dev/null +++ b/src/owr_messages/msg/motor.msg @@ -0,0 +1,3 @@ +float64 angle +int32 motor_number + diff --git a/src/owr_messages/msg/position.msg b/src/owr_messages/msg/position.msg new file mode 100644 index 0000000..90dafb8 --- /dev/null +++ b/src/owr_messages/msg/position.msg @@ -0,0 +1,35 @@ +# Message that reports the position, and orientation of the robot +# Location specified using the WGS 84 reference ellipsoid + +#Based on the NavSatFix message here: http://docs.ros.org/api/sensor_msgs/html/msg/NavSatFix.html + + +# Latitude [degrees]. Positive is north of equator; negative is south. +float64 latitude + +# Longitude [degrees]. Positive is east of prime meridian; negative is west. +float64 longitude + + +# Altitude [m]. Positive is above the WGS 84 ellipsoid +# (quiet NaN if no altitude is available). +float64 altitude + +#The orientation of the front of the rover +#relative to grid North on the WGS 84 datum +#where 0 deg is Grid North +float64 orientation + +#The pitch of the robot (facing forward), in degrees. +#0 being level to the horizon, and positive being facing above the horizon (nose up) +#rotation is around the centre of the robot +float64 pitch + +#The roll of the robot (forward facing) +#0 deg is level with the horizon, Positive is left up +float64 roll + +#The heading relative to the grid north. (WGS 84) +float64 heading + + diff --git a/src/owr_messages/msg/pwm.msg b/src/owr_messages/msg/pwm.msg new file mode 100644 index 0000000..4864efa --- /dev/null +++ b/src/owr_messages/msg/pwm.msg @@ -0,0 +1,6 @@ +string joint +int32 pwm +float64 targetVel +float64 currentVel +float64 currentPos +float64 targetPos \ No newline at end of file diff --git a/src/owr_messages/msg/status.msg b/src/owr_messages/msg/status.msg new file mode 100644 index 0000000..5091dfa --- /dev/null +++ b/src/owr_messages/msg/status.msg @@ -0,0 +1,2 @@ +float32 battery +float32 signal diff --git a/src/owr_messages/msg/stop.msg b/src/owr_messages/msg/stop.msg new file mode 100644 index 0000000..b956b40 --- /dev/null +++ b/src/owr_messages/msg/stop.msg @@ -0,0 +1,2 @@ +bool stopP +bool stopN \ No newline at end of file diff --git a/src/owr_messages/msg/ultrasonic.msg b/src/owr_messages/msg/ultrasonic.msg new file mode 100644 index 0000000..ba2ec77 --- /dev/null +++ b/src/owr_messages/msg/ultrasonic.msg @@ -0,0 +1 @@ +int64[] pulseTime #pulse in microseconds (uS) diff --git a/src/owr_messages/msg/voltage.msg b/src/owr_messages/msg/voltage.msg new file mode 100644 index 0000000..226a8d8 --- /dev/null +++ b/src/owr_messages/msg/voltage.msg @@ -0,0 +1 @@ +float32 voltage From 50fe42059e08fe628636d9581003623ecea8dac7 Mon Sep 17 00:00:00 2001 From: Shanil Date: Sat, 25 May 2019 23:58:48 +1000 Subject: [PATCH 10/10] #time 6h build system issues resolved --- src/gui/CMakeLists.txt | 2 +- src/gui/src/main_application.cpp | 2 +- src/usb_reset/CMakeLists.txt | 81 +++++++++++++------ .../{ros_usb_reset.hpp => usb_reset.hpp} | 18 ++--- src/usb_reset/package.xml | 7 +- src/usb_reset/qmldir | 3 + .../src/{ros_usb_reset.cpp => usb_reset.cpp} | 2 +- 7 files changed, 78 insertions(+), 37 deletions(-) rename src/usb_reset/include/usb_reset/{ros_usb_reset.hpp => usb_reset.hpp} (97%) create mode 100644 src/usb_reset/qmldir rename src/usb_reset/src/{ros_usb_reset.cpp => usb_reset.cpp} (98%) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index e854051..2235ca9 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -13,7 +13,7 @@ project(gui) find_package(catkin REQUIRED COMPONENTS qt_build roscpp sensor_msgs image_transport ros_video_components owr_messages usb_reset) set(QML_IMPORT_PATH "${QML_IMPORT_PATH};${CATKIN_GLOBAL_LIB_DESTINATION}" ) set(QML_IMPORT_PATH2 "${QML_IMPORT_PATH};${CATKIN_GLOBAL_LIB_DESTINATION}" ) -include_directories(${catkin_INCLUDE_DIRS}) +include_directories(${catkin_INCLUDE_DIRS}; usb_reset) # Use this to define what the package will export (e.g. libs, headers). # Since the default here is to produce only a binary, we don't worry about # exporting anything. diff --git a/src/gui/src/main_application.cpp b/src/gui/src/main_application.cpp index 32b33f3..7f9783d 100644 --- a/src/gui/src/main_application.cpp +++ b/src/gui/src/main_application.cpp @@ -8,7 +8,7 @@ #include "ros_video_components/ros_joystick_listener.hpp" #include "ros_video_components/ros_drive_mode.hpp" #include "gui/main_application.hpp" -#include "usb_reset/ros_usb_reset.hpp" +#include "usb_reset/usb_reset.hpp" Main_Application::Main_Application() {} diff --git a/src/usb_reset/CMakeLists.txt b/src/usb_reset/CMakeLists.txt index 2b9efb4..7757a55 100644 --- a/src/usb_reset/CMakeLists.txt +++ b/src/usb_reset/CMakeLists.txt @@ -8,11 +8,28 @@ find_package(catkin REQUIRED COMPONENTS owr_messages roscpp std_msgs + qt_build ) ## System dependencies are found with CMake's conventions # find_package(Boost REQUIRED COMPONENTS system) +################################### +## catkin specific configuration ## +################################### +## The catkin_package macro generates cmake config files for your package +## Declare things to be passed to dependent projects +include_directories(include ${catkin_INCLUDE_DIRS}) +## LIBRARIES: libraries you create in this project that dependent projects also need +## CATKIN_DEPENDS: catkin_packages dependent projects also need +## DEPENDS: system dependencies of this project that dependent projects also need +catkin_package( + INCLUDE_DIRS include + LIBRARIES UsbReset + CATKIN_DEPENDS owr_messages roscpp std_msgs qt_build +# DEPENDS system_lib +) + ## Uncomment this if the package has a setup.py. This macro ensures ## modules and global scripts declared therein get installed @@ -70,6 +87,30 @@ find_package(catkin REQUIRED COMPONENTS # std_msgs # ) +############################################################################## +# Qt Environment +############################################################################## + +# this comes from qt_build's qt-ros.cmake which is automatically +# included via the dependency ca ll in package.xml +find_package(Qt5 COMPONENTS Core Qml Widgets Quick REQUIRED) + +############################################################################## +# Sections +############################################################################## + +file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/*.qrc) +file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/usb_reset/*.hpp) + +QT5_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES}) +QT5_WRAP_CPP(QT_MOC_HPP ${QT_MOC}) + +############################################################################## +# Sources +############################################################################## + +file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS src/*.cpp) + ################################################ ## Declare ROS dynamic reconfigure parameters ## ################################################ @@ -90,22 +131,6 @@ find_package(catkin REQUIRED COMPONENTS # cfg/DynReconf2.cfg # ) -################################### -## catkin specific configuration ## -################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if you package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need -catkin_package( -# INCLUDE_DIRS include -# LIBRARIES usb_reset -# CATKIN_DEPENDS owr_messages roscpp std_msgs -# DEPENDS system_lib -) - ########### ## Build ## ########### @@ -113,20 +138,20 @@ catkin_package( ## Specify additional locations of header files ## Your package locations should be listed before other locations # include_directories(include) -include_directories( - ${catkin_INCLUDE_DIRS} - include -) +#include_directories( +# ${catkin_INCLUDE_DIRS} +# include usb_reset +#) ## Declare a C++ library -# add_library(usb_reset -# src/${PROJECT_NAME}/usb_reset.cpp -# ) +# add_library(usb_reset +# src/${usb_reset}/usb_reset.cpp +# ) ## Add cmake target dependencies of the library ## as an example, code may need to be generated before libraries ## either from message generation or dynamic reconfigure -# add_dependencies(usb_reset ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) +# add_dependencies(usb_reset ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) ## Declare a C++ executable # add_executable(usb_reset_node src/usb_reset_node.cpp) @@ -187,3 +212,11 @@ include_directories( ## Add folders to be run by python nosetests # catkin_add_nosetests(test) + +############################################################################## +# Binaries +############################################################################## +add_library(UsbReset ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP}) +qt5_use_modules(UsbReset Quick Core Widgets) +target_link_libraries(UsbReset ${QT_LIBRARIES} ${catkin_LIBRARIES}) +target_include_directories(UsbReset PUBLIC include) diff --git a/src/usb_reset/include/usb_reset/ros_usb_reset.hpp b/src/usb_reset/include/usb_reset/usb_reset.hpp similarity index 97% rename from src/usb_reset/include/usb_reset/ros_usb_reset.hpp rename to src/usb_reset/include/usb_reset/usb_reset.hpp index 0ce2c7f..a427108 100644 --- a/src/usb_reset/include/usb_reset/ros_usb_reset.hpp +++ b/src/usb_reset/include/usb_reset/usb_reset.hpp @@ -8,9 +8,16 @@ #ifndef ROS_USB_RESET_H #define ROS_USB_RESET_H +//ROS +#include +#include "std_msgs/String.h" +#include +#include +#include "owr_messages/devices.h" + //QT -#include -#include +//#include +//#include #include #include @@ -23,13 +30,6 @@ #include #include -//ROS -#include -#include "std_msgs/String.h" -#include -#include -#include "owr_messages/devices.h" - class ROS_Usb_Reset : public QQuickPaintedItem { //make this a Qt Widget Q_OBJECT diff --git a/src/usb_reset/package.xml b/src/usb_reset/package.xml index 2a02924..f4a8da8 100644 --- a/src/usb_reset/package.xml +++ b/src/usb_reset/package.xml @@ -43,6 +43,11 @@ owr_messages roscpp std_msgs + qt_build + libqt4-dev + + libqt4-dev + qt_build owr_messages roscpp std_msgs @@ -53,4 +58,4 @@ - \ No newline at end of file + diff --git a/src/usb_reset/qmldir b/src/usb_reset/qmldir new file mode 100644 index 0000000..6d86360 --- /dev/null +++ b/src/usb_reset/qmldir @@ -0,0 +1,3 @@ +module bluesat.owr +plugin RosVideoComponents +designersupported diff --git a/src/usb_reset/src/ros_usb_reset.cpp b/src/usb_reset/src/usb_reset.cpp similarity index 98% rename from src/usb_reset/src/ros_usb_reset.cpp rename to src/usb_reset/src/usb_reset.cpp index 4b14427..910153d 100644 --- a/src/usb_reset/src/ros_usb_reset.cpp +++ b/src/usb_reset/src/usb_reset.cpp @@ -1,4 +1,4 @@ -#include "usb_reset/ros_usb_reset.hpp" +#include "usb_reset/usb_reset.hpp" int num = 0;