-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port collision_detection to ROS2 #40
Port collision_detection to ROS2 #40
Conversation
moveit_core/collision_detection/include/moveit/collision_detection/collision_log.h
Outdated
Show resolved
Hide resolved
Co-Authored-By: anasarrak <anasarrak@gmail.com>
moveit_core/collision_detection/include/moveit/collision_detection/collision_matrix.h
Show resolved
Hide resolved
moveit_core/collision_detection/include/moveit/collision_detection/collision_matrix.h
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address comments regarding 1) const, 2) logger, and 3) clang-format
Remove also dedicated log.h file.
/Users/victor/ros2_moveit_ws/src/moveit2/moveit_core/collision_detection/src/collision_tools.cpp:281:14: error: no viable overloaded '='
msg.normal = tf2::toMsg(contact.normal);
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/victor/ros2_ws/install/geometry_msgs/include/geometry_msgs/msg/vector3__struct.hpp:37:8: note: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'geometry_msgs::msg::Point' (aka 'Point_<std::allocator<void> >') to 'const geometry_msgs::msg::Vector3_<std::__1::allocator<void> >' for 1st argument
struct Vector3_
^
/Users/victor/ros2_ws/install/geometry_msgs/include/geometry_msgs/msg/vector3__struct.hpp:37:8: note: candidate function (the implicit move assignment operator) not viable: no known conversion from 'geometry_msgs::msg::Point' (aka 'Point_<std::allocator<void> >') to 'geometry_msgs::msg::Vector3_<std::__1::allocator<void> >' for 1st argument
2 warnings and 1 error generated. Looking at the messages: victor:~/ros2_ws/src/ros2/common_interfaces/geometry_msgs/msg ((HEAD detached at 0.6.1))$
| => cat Point.msg
# This contains the position of a point in free space
float64 x
float64 y
float64 z
________________________________________________________________________________
| victor:~/ros2_ws/src/ros2/common_interfaces/geometry_msgs/msg ((HEAD detached at 0.6.1))$
| => cat Vector3.msg
# This represents a vector in free space.
float64 x
float64 y
float64 z Addressed with AcutronicRobotics/geometry2@a5dfb74. @wjwwood please advise if this is the desired way. Probably creating a toMsg2 isn't what you've got in mind? With the changes above in geometry2, submodule now compiles. Ready for your review @mlautman. |
Convert a Eigen::Vector3d type to a geometry_msgs::msg::Vector3
I have no idea, it would be a better question for @tfoote maybe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I would just replace the clock references by static rclcpp::Time::now()
calls.
Co-Authored-By: vmayoral <victor@erlerobotics.com>
Point and Vector are definitely different types and shouldn't have implicit conversions. Can you specify which template arguments to use for the |
@tfoote it's been a few days since I last looked at this so let me see if I remember everything:
Not sure if this answers your question though. Let me know if you require further changes on this PR or if you're fine with them and we can proceed here. |
Reworked the module according to the discussions held regarding logging. Unit tests are disabled due to linking issues, similar than the ones described at AcutronicRobotics#13 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reworked the module according to the discussions held regarding logging. Unit tests are disabled due to linking issues, similar than the ones described at AcutronicRobotics#13
Looks good in general. I would just suggest using const loggers and fixing the rclcpp::Duration
constructors.
moveit_core/collision_detection/src/allvalid/collision_robot_allvalid.cpp
Outdated
Show resolved
Hide resolved
moveit_core/collision_detection/src/allvalid/collision_world_allvalid.cpp
Outdated
Show resolved
Hide resolved
moveit_core/collision_detection/src/collision_octomap_filter.cpp
Outdated
Show resolved
Hide resolved
color.r = 1.0f; | ||
color.g = 0.5f; | ||
color.b = 0.0f; | ||
color.a = 0.4f; | ||
getCostMarkers(arr, frame_id, cost_sources, color, ros::Duration(60.0)); | ||
getCostMarkers(arr, frame_id, cost_sources, color, rclcpp::Duration(60.0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getCostMarkers(arr, frame_id, cost_sources, color, rclcpp::Duration(60.0)); | |
getCostMarkers(arr, frame_id, cost_sources, color, rclcpp::Duration(60, 0)); |
rclcpp::Duration
doesn't support the seconds constructor anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
color.r = 1.0f; | ||
color.g = 0.0f; | ||
color.b = 0.0f; | ||
color.a = 0.8f; | ||
getCollisionMarkersFromContacts(arr, frame_id, con, color, ros::Duration(60.0)); | ||
getCollisionMarkersFromContacts(arr, frame_id, con, color, rclcpp::Duration(60.0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
{ | ||
int id = 0; | ||
for (const auto& cost_source : cost_sources) | ||
{ | ||
visualization_msgs::Marker mk; | ||
mk.header.stamp = ros::Time::now(); | ||
rclcpp::Clock ros_clock(RCL_ROS_TIME); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For what do we need ros_clock here? It could probably be used to initialize mk.header.stamp
below by calling ros_clock.now()
like already implemented in the changes below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
if(BUILD_TESTING) | ||
find_package(resource_retriever REQUIRED) | ||
if(WIN32) | ||
# set(append_library_dirs "$<TARGET_FILE_DIR:${PROJECT_NAME}>;$<TARGET_FILE_DIR:${PROJECT_NAME}_TestPlugins1>") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add TODO comment about why this is not working, or remove
moveit_core/collision_detection/src/allvalid/collision_robot_allvalid.cpp
Outdated
Show resolved
Hide resolved
Fixed indentation in the CMakeLists.txt and removed duplicate |
if(WIN32) | ||
# TODO add window paths | ||
else() | ||
set(append_library_dirs "${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_BINARY_DIR}/../robot_model;${CMAKE_CURRENT_BINARY_DIR}/../utils") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoding relative paths is a bad idea.
I would recommend that for every library in this package that is used else ware you set a <lib_name>_lib_dir
environment variable that can then be used by the tests
A good example is the rcl_lib_dir
I have taken the time to show how it is used below:
/home/mike/ws_ros2/src/ros2/rcl/rcl/CMakeLists.txt:
78
79: # rcl_lib_dir is passed as APPEND_LIBRARY_DIRS for each ament_add_gtest call so
80 # the librcl that they link against is on the library path.
81 # This is especially important on Windows.
82 # This is overwritten each loop, but which one it points to doesn't really matter.
83: set(rcl_lib_dir "$<TARGET_FILE_DIR:${PROJECT_NAME}>")
84
/home/mike/ws_ros2/src/ros2/rcl/rcl/test/CMakeLists.txt:
16
17: set(extra_lib_dirs "${rcl_lib_dir}")
18
/home/mike/ws_ros2/src/ros2/rcl/rcl/test/CMakeLists.txt:
34 rcl_add_custom_gtest(test_client${target_suffix}
35 SRCS rcl/test_client.cpp
36: INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
37 ENV ${rmw_implementation_env_var}
38 APPEND_LIBRARY_DIRS ${extra_lib_dirs}
The example uses rcl_add_custom_gtest but it works just as well with ament_add_gtest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't mind I prefer to merge this. And then I will fix them all together. Because we have other merged that use this style. I can open an issue to avoid forgetting it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please open an issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened one #91
@ahcorde See remaining comments from Henning, Dave and myself |
@mlautman @henningkayser @davetcoleman Ready to merge |
…_acu Port Planning pipeline
No description provided.