Skip to content

Message filters rework port in progress for review#5

Merged
tfoote merged 25 commits intomasterfrom
refactor7
Aug 15, 2018
Merged

Message filters rework port in progress for review#5
tfoote merged 25 commits intomasterfrom
refactor7

Conversation

@tfoote
Copy link
Copy Markdown
Contributor

@tfoote tfoote commented Jul 30, 2018

This is a rework of #4 for better traceability of code origin as well as some cleanup.

I've been splitting it into many different commits for easier auditing. I've separated out copying in files from different locations from converting them to the new syntax.

After that restructuring I've then gone through and been doing reviews of the changes.

There's now more commits in the history than I plan to have at the end. Several of the later ones are reverting non-essential changes earlier. I plan to find where they were changed and squash the revert of the changes down.

Outstanding TODOs

implement correct solutions for

  • ROS_WARN -> cout
  • ROS_ASSERT -> assert
  • ROS_BREAK -> std::abort
  • Commented asserts such as in test_subscriber.cpp
  • time_sequencer_unittest.cpp:135
    ros::Time::setNow(ros::Time::now() + ros::Duration(2));
    removed from test.

@j-rivero @mjcarroll @gaoethan If you could take a look and give any feedback/comments suggestions I'll pull them in as i finish my audit and cleanup before a final review.

@mjcarroll Please look closely at c7f8d24 and abe143a It's a slight change in the API that I made based on talking with @wjwwood

@tfoote tfoote requested review from j-rivero and mjcarroll July 30, 2018 21:46
@dirk-thomas
Copy link
Copy Markdown
Member

Should ROS 1 specific concepts like connection headers, caller id, etc. be removed?

Copy link
Copy Markdown

@j-rivero j-rivero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small comments on building and python tests, I was not able to find any more errors. Build and tests are fine on my Ubuntu Bionic system.

CMakeLists.txt Outdated
find_package(rclcpp REQUIRED)
find_package(rcutils)
find_package(builtin_interfaces REQUIRED)
find_package(std_msgs REQUIRED)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can only find std_mgs in test/test_message_filters_cache.py. If this is the case, I think that we can apply this patch:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 81fcb1e..c982b47 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,6 @@ find_package(ament_cmake REQUIRED)
 find_package(rclcpp REQUIRED)
 find_package(rcutils)
 find_package(builtin_interfaces REQUIRED)
-find_package(std_msgs REQUIRED)
 find_package(sensor_msgs REQUIRED)
 
 include_directories(include)
@@ -24,7 +23,6 @@ add_library(${PROJECT_NAME} SHARED src/connection.cpp)
 ament_target_dependencies(${PROJECT_NAME}
   "rclcpp"
   "rcutils"
-  "std_msgs"
   "builtin_interfaces"
   "sensor_msgs")
 
@@ -53,6 +51,8 @@ ament_export_include_directories(include)
 ament_export_libraries(${PROJECT_NAME})
 
 if(BUILD_TESTING)
+  find_package(std_msgs REQUIRED)
+
   find_package(ament_lint_auto REQUIRED)
   ament_lint_auto_find_test_dependencies()
 
diff --git a/package.xml b/package.xml
index 0d159d1..fc490be 100644
--- a/package.xml
+++ b/package.xml
@@ -19,9 +19,9 @@
   <build_depend>builtin_interfaces</build_depend>
   <build_depend>rclcpp</build_depend>
   <build_depend>rclpy</build_depend>
-  <build_depend>std_msgs</build_depend>
   <build_depend>sensor_msgs</build_depend>
 
+  <test_depend>std_msgs</test_depend>
   <test_depend>ament_lint_auto</test_depend>
   <test_depend>ament_cmake_gtest</test_depend>
   <test_depend>ament_cmake_pytest</test_depend>

target_link_libraries(${PROJECT_NAME}-test_fuzz ${PROJECT_NAME})
endif()

# Unit test of the approximate synchronizer
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the python tests were not ported or I can not find them. Not sure if this was on propose.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, @tfoote focuses on the CPP part now, the python part hasn't been involved in this PR.

Copy link
Copy Markdown
Contributor

@gaoethan gaoethan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my simple checking, the following remains to do:

  • missing python refactoring, maybe it's another PR.
  • readme update
  • The rest APIs doc update accordingly with ros2

* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef ROSLIB_MESSAGE_TRAITS_H
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the prefix of ROSLIB is not very suitable now in ROS2

* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef ROSCPP_PARAMETER_ADAPTER_H
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ROSCPP needs to be replaced accordingly now.

ROS_DEPRECATED inline std::shared_ptr<M> defaultMessageCreateFunction()
{
return DefaultMessageCreator<M>()();
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already been marked as ROS_DEPRECATED and better clean it if no use now.

@@ -88,30 +84,27 @@ typedef boost::shared_ptr<SubscriberBase> SubscriberBasePtr;
*
* The output connection for the Subscriber object is the same signature as for roscpp subscription callbacks, ie.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc update to rclcpp

}

/**
* \brief Returns the internal ros::Subscriber object
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc update

@@ -67,31 +68,31 @@ namespace message_filters
*
* TimeSequencer's input and output connections are both of the same signature as roscpp subscription callbacks, ie.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc update like ros::Duration, roscpp ...

* \param update_rate The rate at which to check for messages which have passed "delay"
* \param queue_size The number of messages to store
* \param nh (optional) The NodeHandle to use to create the ros::SteadyTimer that runs at update_rate
* \param node The Node to use to create the ros::SteadyTimer that runs at update_rate
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc update for ros::SteadyTimer

* \param update_rate The rate at which to check for messages which have passed "delay"
* \param queue_size The number of messages to store
* \param nh (optional) The NodeHandle to use to create the ros::SteadyTimer that runs at update_rate
* \param node The Node to use to create the ros::SteadyTimer that runs at update_rate
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc update for ros::SteadyTimer

@@ -59,15 +60,15 @@ namespace message_filters
*
* Cache's input and output connections are both of the same signature as roscpp subscription callbacks, ie.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc update for roscpp

@@ -127,11 +128,11 @@ class Cache : public SimpleFilter<M>
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better clean it for ROS_ERROR like //ROS_ERROR("Cannot set max_size to 0") ; at line 109

@gaoethan
Copy link
Copy Markdown
Contributor

@tfoote it works within my Ubuntu bionic, thanks for your effort 👍

@tfoote
Copy link
Copy Markdown
Contributor Author

tfoote commented Aug 6, 2018

Thanks for the reviews. I believe I've addressed all comments and have now finished cleaning up all items I flagged as well. It's ready for a review.

@sloretz sloretz added the in review Waiting for review (Kanban column) label Aug 9, 2018
@@ -0,0 +1,73 @@
/*
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the past when we copied code from other repos (without the file's history) we place a comment in the file pointing to where the file was copied from (e.g. https://github.com/ros2/turtlebot2_demo/blob/2017ddd2c5781434d9dbcb0c172d553e28f7ab02/depthimage_to_pointcloud2/include/depthimage_to_pointcloud2/depth_traits.hpp#L34)

Then adapting the header guards (as mentioned in https://github.com/ros2/message_filters/diffs#r206407588) to match the name of the new hosting package is IMO preferred but not a blocker for merging

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tfoote did you see this comment ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I did, but I wanted to get this in since it was blocking our other steps. I'll open a new PR with the sources.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I did, but I wanted to get this in since it was blocking our other steps. I'll open a new PR with the sources.

👍 sounds good, just wanted to make sure it didnt get lost in the process.
Thanks for opening the follow-up PR!

Copy link
Copy Markdown
Contributor

@gaoethan gaoethan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tfoote tfoote merged commit 567ad41 into master Aug 15, 2018
@tfoote tfoote deleted the refactor7 branch August 15, 2018 03:50
@tfoote tfoote removed the in review Waiting for review (Kanban column) label Aug 15, 2018
@dirk-thomas dirk-thomas mentioned this pull request Sep 4, 2018
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants