From ebd59f81fbd11ce3b46d5fb8266b976d705c344d Mon Sep 17 00:00:00 2001 From: Howard Cochran Date: Tue, 24 Jan 2017 23:15:02 -0500 Subject: [PATCH 1/2] CMakeLists & package.xml: Fix missing dependencies --- roboteq_driver/CMakeLists.txt | 2 +- roboteq_driver/package.xml | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/roboteq_driver/CMakeLists.txt b/roboteq_driver/CMakeLists.txt index e2579cf..714ca11 100644 --- a/roboteq_driver/CMakeLists.txt +++ b/roboteq_driver/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.8.3) project(roboteq_driver) -find_package(catkin REQUIRED COMPONENTS roboteq_msgs roscpp serial) +find_package(catkin REQUIRED COMPONENTS roscpp serial message_generation std_msgs roboteq_msgs) catkin_package() diff --git a/roboteq_driver/package.xml b/roboteq_driver/package.xml index c6ced7f..57c61cb 100644 --- a/roboteq_driver/package.xml +++ b/roboteq_driver/package.xml @@ -9,12 +9,17 @@ BSD catkin - roboteq_msgs + message_generation + std_msgs roscpp serial - roboteq_msgs + roboteq_msgs + message_generation + std_msgs + message_runtime roscpp serial + roboteq_msgs From cd4fc02dc0628e8c1888da60c9bc1bb7f3904f6e Mon Sep 17 00:00:00 2001 From: Howard Cochran Date: Tue, 24 Jan 2017 23:18:09 -0500 Subject: [PATCH 2/2] Fix warnings and enable -Wall and -Wextra Newest compilers complain about constructor initialization order. --- roboteq_driver/src/CMakeLists.txt | 1 + roboteq_driver/src/channel.cpp | 2 +- roboteq_driver/src/controller.cpp | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/roboteq_driver/src/CMakeLists.txt b/roboteq_driver/src/CMakeLists.txt index 34e1bc1..9450e4d 100644 --- a/roboteq_driver/src/CMakeLists.txt +++ b/roboteq_driver/src/CMakeLists.txt @@ -3,6 +3,7 @@ add_executable(${PROJECT_NAME}_node driver controller channel) add_dependencies(${PROJECT_NAME}_node ${PROJECT_NAME}_script roboteq_msgs_generate_messages_cpp) target_link_libraries(${PROJECT_NAME}_node ${PROJECT_NAME}_script ${catkin_LIBRARIES}) set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME driver_node PREFIX "") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter") # Mark executables and/or libraries for installation install(TARGETS ${PROJECT_NAME}_node diff --git a/roboteq_driver/src/channel.cpp b/roboteq_driver/src/channel.cpp index 9746637..9da2ca3 100644 --- a/roboteq_driver/src/channel.cpp +++ b/roboteq_driver/src/channel.cpp @@ -34,7 +34,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace roboteq { Channel::Channel(int channel_num, std::string ns, Controller* controller) : - channel_num_(channel_num), nh_(ns), controller_(controller), max_rpm_(3500), + nh_(ns), controller_(controller), channel_num_(channel_num), max_rpm_(3500), last_mode_(255) { sub_cmd_ = nh_.subscribe("cmd", 1, &Channel::cmdCallback, this); diff --git a/roboteq_driver/src/controller.cpp b/roboteq_driver/src/controller.cpp index b4f77e1..302e8b8 100644 --- a/roboteq_driver/src/controller.cpp +++ b/roboteq_driver/src/controller.cpp @@ -48,8 +48,8 @@ const std::string eol("\r"); const size_t max_line_length(128); Controller::Controller(const char *port, int baud) - : nh_("~"), port_(port), baud_(baud), connected_(false), receiving_script_messages_(false), - version_(""), start_script_attempts_(0), serial_(NULL), + : port_(port), baud_(baud), connected_(false), receiving_script_messages_(false), + version_(""), serial_(NULL), nh_("~"), start_script_attempts_(0), command("!", this), query("?", this), param("^", this) { pub_status_ = nh_.advertise("status", 1); @@ -198,7 +198,7 @@ void Controller::processFeedback(std::string msg) { ROS_WARN("Failure parsing feedback channel number. Dropping message."); return; } - if (channel_num >= 1 && channel_num <= channels_.size()) { + if (channel_num >= 1 && channel_num <= (int)channels_.size()) { channels_[channel_num - 1]->feedbackCallback(fields); } else { ROS_WARN("Bad channel number. Dropping message.");