-
Notifications
You must be signed in to change notification settings - Fork 558
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 occupancy_map_monitor to ROS2 #148
Port occupancy_map_monitor to ROS2 #148
Conversation
ea8e8bb
to
955e367
Compare
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.
Thank you @RoboticsYY for porting occupancy_map_monitor
src/occupancy_map_monitor.cpp | ||
src/occupancy_map_updater.cpp | ||
) | ||
set_target_properties(${MOVEIT_LIB_NAME} PROPERTIES VERSION "${${PROJECT_NAME}_VERSION}") | ||
target_link_libraries(${MOVEIT_LIB_NAME} ${catkin_LIBRARIES} ${Boost_LIBRARIES}) | ||
ament_target_dependencies(${MOVEIT_LIB_NAME} rclcpp moveit_core moveit_msgs pluginlib octomap geometric_shapes) | ||
target_link_libraries(${MOVEIT_LIB_NAME} ${Boost_LIBRARIES}) |
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.
target_link_libraries(${MOVEIT_LIB_NAME} ${Boost_LIBRARIES}) |
Please add Boost
in ament_target_dependencies
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 as suggested.
src/occupancy_map_monitor.cpp | ||
src/occupancy_map_updater.cpp | ||
) | ||
set_target_properties(${MOVEIT_LIB_NAME} PROPERTIES VERSION "${${PROJECT_NAME}_VERSION}") | ||
target_link_libraries(${MOVEIT_LIB_NAME} ${catkin_LIBRARIES} ${Boost_LIBRARIES}) | ||
ament_target_dependencies(${MOVEIT_LIB_NAME} rclcpp moveit_core moveit_msgs pluginlib octomap geometric_shapes) |
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.
ament_target_dependencies(${MOVEIT_LIB_NAME} rclcpp moveit_core moveit_msgs pluginlib octomap geometric_shapes) | |
ament_target_dependencies(${MOVEIT_LIB_NAME} | |
rclcpp | |
moveit_core | |
moveit_msgs | |
pluginlib | |
octomap | |
geometric_shapes | |
Boost) |
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 as suggested.
|
||
add_executable(moveit_ros_occupancy_map_server src/occupancy_map_server.cpp) | ||
target_link_libraries(moveit_ros_occupancy_map_server ${MOVEIT_LIB_NAME} ${catkin_LIBRARIES} ${Boost_LIBRARIES}) | ||
ament_target_dependencies(moveit_ros_occupancy_map_server rclcpp moveit_core moveit_msgs pluginlib octomap geometric_shapes) | ||
target_link_libraries(moveit_ros_occupancy_map_server ${MOVEIT_LIB_NAME} ${Boost_LIBRARIES}) |
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.
target_link_libraries(moveit_ros_occupancy_map_server ${MOVEIT_LIB_NAME} ${Boost_LIBRARIES}) | |
target_link_libraries(moveit_ros_occupancy_map_server ${MOVEIT_LIB_NAME}) |
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 adding Boost
to ament_target_dependencies
.
ament_export_dependencies(pluginlib) | ||
ament_export_dependencies(octomap) | ||
ament_export_dependencies(geometric_shapes) | ||
|
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 add ament_export_dependencies(Boost)
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.
Added Boost
to ament_export_dependencies
.
) | ||
|
||
install(TARGETS moveit_ros_occupancy_map_server | ||
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} | ||
RUNTIME DESTINATION share/${PROJECT_NAME}/ |
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.
Shouldn't this be lib/${PROJECT_NAME}
.?
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.
This has been corrected.
double map_resolution = 0.0); | ||
OccupancyMapMonitor(double map_resolution = 0.0); | ||
OccupancyMapMonitor(const std::shared_ptr<tf2_ros::Buffer>& tf_buffer, ros::NodeHandle& nh, | ||
OccupancyMapMonitor(const std::shared_ptr<tf2_ros::Buffer>& tf_buffer, const rclcpp::Node::SharedPtr& node, |
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 consistency node
should be the first parameter
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 as suggested.
{ | ||
initialize(); | ||
} | ||
static const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_ros.occupancy_map_monitor"); |
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.
static const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_ros.occupancy_map_monitor"); | |
static const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_ros_occupancy_map_monitor"); |
Nit: @henningkayser Which one should we use .?
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.
Both are fine, I would stick with the full lib name as we decided to do so and follow this rule in other packages.
My general concern is that this won't scale with added files and also the namespaces are less explicit (i.e. for scoping moveit, moveit_ros, etc).
|
||
static void publishOctomap(ros::Publisher* octree_binary_pub, occupancy_map_monitor::OccupancyMapMonitor* server) | ||
static const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_ros.occupancy_map_server"); |
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.
static const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_ros.occupancy_map_server"); | |
static const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_ros_occupancy_map_server"); |
Nit: @henningkayser Which one should we use .?
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.
Ok, now that we have multiple files in this package I would strongly prefer lib_name.file_name
for all files. It's better to be more explicit about this and makes scoping logger levels easier
@@ -39,6 +39,8 @@ | |||
|
|||
namespace occupancy_map_monitor | |||
{ | |||
static const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_ros.occupancy_map_updater"); |
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.
static const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_ros.occupancy_map_updater"); | |
static const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_ros_occupancy_map_updater"); |
Nit: @henningkayser Which one should we use .?
{ | ||
transform_cache_.clear(); | ||
if (transform_provider_callback_) | ||
return transform_provider_callback_(target_frame, target_time, transform_cache_); | ||
else | ||
{ | ||
ROS_WARN_THROTTLE(1, "No callback provided for updating the transform cache for octomap updaters"); | ||
RCUTILS_LOG_ERROR_THROTTLE(rcutils_steady_time_now, 1, |
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.
Should we use RCUTILS*
directly .?
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.
No, we should use RCLCPP_WARN_THROTTLE
which becomes available with Eloquent. So this is on me ;)
project(moveit_ros_occupancy_map_monitor) | ||
set(MOVEIT_LIB_NAME ${PROJECT_NAME}) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
# Default to C++14 |
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.
I think we should keep the original cmake flags and warnings and modify them globally if necessary
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.
Changed back to the original setting.
|
||
include_directories(include | ||
${Boost_INCLUDE_DIRS} | ||
${catkin_INCLUDE_DIRS} | ||
${rclcpp_INCLUDE_DIRS} |
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.
This shouldn't be necessary with ament_target_dependencies
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.
Removed ${rclcpp_INCLUDE_DIRS}
from include_directories
.
{ | ||
initialize(); | ||
} | ||
static const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_ros.occupancy_map_monitor"); |
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.
Both are fine, I would stick with the full lib name as we decided to do so and follow this rule in other packages.
My general concern is that this won't scale with added files and also the namespaces are less explicit (i.e. for scoping moveit, moveit_ros, etc).
} | ||
} | ||
// TODO rework this in ROS2 | ||
// XmlRpc::XmlRpcValue sensor_list; |
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.
@JafarAbdi Didn't you have a code snippet where you already replaced XmlRPC ?
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.
It's a work-around the way we specify the current parameters, for example for sensor_3d.yaml it'll be
/**:
ros__parameters:
sensors: ["sensor1", "sensor2"]
sensor1:
sensor_plugin: occupancy_map_monitor/PointCloudOctomapUpdater
point_cloud_topic: /head_mount_kinect/depth_registered/points
max_range: 5.0
point_subsample: 1
padding_offset: 0.1
padding_scale: 1.0
max_update_rate: 1.0
filtered_cloud_topic: filtered_cloud
sensor2:
sensor_plugin: occupancy_map_monitor/DepthImageOctomapUpdater
image_topic: /head_mount_kinect/depth_registered/image_raw
queue_size: 5
near_clipping_plane_distance: 0.3
far_clipping_plane_distance: 5.0
shadow_threshold: 0.2
padding_scale: 4.0
padding_offset: 0.03
max_update_rate: 1.0
filtered_cloud_topic: filtered_cloud
This link inspired me to do so
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.
@henningkayser Does this method makes sense .? if you agree with this method I'll open PR fixes it targeting this branch
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.
I think it seems a little redundant to have the sensor names extra, but if it makes things easier I agree with this approach.
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.
However, I think this belongs to a system wide launch/parameter refactoring, so I would suggest we merge this right away to continue with PSM
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.
Yes, I agree with the codebase wide refactoring for XmlRpc
|
||
static void publishOctomap(ros::Publisher* octree_binary_pub, occupancy_map_monitor::OccupancyMapMonitor* server) | ||
static const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_ros.occupancy_map_server"); |
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.
Ok, now that we have multiple files in this package I would strongly prefer lib_name.file_name
for all files. It's better to be more explicit about this and makes scoping logger levels easier
{ | ||
transform_cache_.clear(); | ||
if (transform_provider_callback_) | ||
return transform_provider_callback_(target_frame, target_time, transform_cache_); | ||
else | ||
{ | ||
ROS_WARN_THROTTLE(1, "No callback provided for updating the transform cache for octomap updaters"); | ||
RCUTILS_LOG_ERROR_THROTTLE(rcutils_steady_time_now, 1, |
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.
No, we should use RCLCPP_WARN_THROTTLE
which becomes available with Eloquent. So this is on me ;)
14b53c1
to
6aed2b3
Compare
@JafarAbdi @henningkayser All the issues are addressed except replacing |
6aed2b3
to
c4a7c93
Compare
c4a7c93
to
982ece5
Compare
352e4b7
to
1ff5ead
Compare
} | ||
} | ||
// TODO rework this in ROS2 | ||
// XmlRpc::XmlRpcValue sensor_list; |
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.
However, I think this belongs to a system wide launch/parameter refactoring, so I would suggest we merge this right away to continue with PSM
#112 is blocked by
occupancy_map_monitor
, please see https://github.com/ros-planning/moveit2/blob/fa81678b965eafcb1e8c72018ba4d99ab2593255/moveit_ros/planning/planning_scene_monitor/include/moveit/planning_scene_monitor/planning_scene_monitor.h#L45This work followed AcutronicRobotics' porting, but didn't use the original commits. Because
occupancy_map_monitor
was moved frommoveit_ros
tomoveit_ros_perception
(ref), the original commits are very difficult to directly use.