Skip to content
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

[WIP] ROS2 Port #101

Closed
wants to merge 25 commits into from
Closed

[WIP] ROS2 Port #101

wants to merge 25 commits into from

Conversation

Abishalini
Copy link

@Abishalini Abishalini commented Aug 4, 2021

Taking over Andy's work #100
I had to clone rviz_visual_tools, moveit_visual_tools, moveit_resources and graph_msgs from source. The rest can be installed using rosdep

How to use moveit_calibration

@AndyZe
Copy link
Member

AndyZe commented Aug 4, 2021

Nice. It should target the foxy branch

@Abishalini Abishalini changed the base branch from master to foxy August 4, 2021 19:58
@Abishalini Abishalini changed the title ROS2 Port [WIP] ROS2 Port Aug 4, 2021
Copy link
Member

@henningkayser henningkayser left a comment

Choose a reason for hiding this comment

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

I will finish reviewing the rest later today

moveit_calibration_gui/CMakeLists.txt Outdated Show resolved Hide resolved
find_package(rviz_common REQUIRED)
find_package(rviz_default_plugins REQUIRED)
find_package(rviz_rendering REQUIRED)
find_package(rviz_visual_tools REQUIRED)

find_package(Eigen3 REQUIRED)
Copy link
Member

Choose a reason for hiding this comment

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

Not entirely sure if this is still required (I think it is), but we used to depend on eigen3_cmake_module for Eigen3 to work. See https://github.com/ros2/eigen3_cmake_module


find_package(Eigen3 REQUIRED)
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
Copy link
Member

Choose a reason for hiding this comment

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

Are we directly depending on GLUT or is this only added because of moveit_ros_perception not exporting it correctly? If so, please add a comment + issue link

moveit_calibration_gui/CMakeLists.txt Outdated Show resolved Hide resolved
DEPENDS
EIGEN3
rviz_rendering
tf2_eigen
Copy link
Member

Choose a reason for hiding this comment

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

Eigen3 and eigen3_cmake_module should be included as well.

moveit_calibration_gui/CMakeLists.txt Outdated Show resolved Hide resolved
add_library(${MOVEIT_LIB_NAME}_core ${SOURCE_FILES} ${HEADERS})
set_target_properties(${MOVEIT_LIB_NAME}_core PROPERTIES VERSION "${${PROJECT_NAME}_VERSION}")
target_link_libraries(${MOVEIT_LIB_NAME}_core
${catkin_LIBRARIES} ${OpenCV_LIBS} ${rviz_DEFAULT_PLUGIN_LIBRARIES} ${OGRE_LIBRARIES} ${QT_LIBRARIES} ${Boost_LIBRARIES})
${OpenCV_LIBS} ${rviz_DEFAULT_PLUGIN_LIBRARIES} ${OGRE_LIBRARIES} ${QT_LIBRARIES} ${Boost_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_LIBRARY})
Copy link
Member

Choose a reason for hiding this comment

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

Is rviz_DEFAULT_PLUGIN_LIBRARIES still a thing in ROS 2?
Also, all targets providing _LIBRARIES and _INCLUDE_DIRS can just be passed to ament_target_dependencies() which also supports the SYSTEM keyword. For readability, I would opt for using it, possibly even in combination with a SYSTEM_DEPENDS variable or similar.

@@ -83,7 +83,7 @@ class HandEyeCalibrationFrame : public QWidget
ControlTabWidget* tab_control_;

private:
rviz::DisplayContext* context_;
rviz_common::DisplayContext* context_;
Copy link
Member

Choose a reason for hiding this comment

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

not a high priority until things are working, but I would strongly advocate replacing all unnecessary raw pointers with smart pointers if possible

{
robot_model_loader_.reset(new robot_model_loader::RobotModelLoader("robot_description"));
frame_manager_.reset(new rviz::FrameManager());
robot_model_loader_.reset(new robot_model_loader::RobotModelLoader(node_, "robot_description"));
Copy link
Member

Choose a reason for hiding this comment

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

imo, it's a general best practice to replace the new operator with std::make_shared() or std::make_unique()

camerainfo_sub_.shutdown();
camerainfo_sub_ = nh_.subscribe(topic_name.toStdString(), 1, &TargetTabWidget::cameraInfoCallback, this);
// camerainfo_sub_.shutdown();
camerainfo_sub_.reset();
Copy link
Member

Choose a reason for hiding this comment

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

reset() is redundant if the pointer is reassigned in the next line

@tylerjw
Copy link
Member

tylerjw commented Aug 9, 2021

Please don't port without tests

@AndyZe
Copy link
Member

AndyZe commented Aug 10, 2021

Please don't port without tests

Disagree. Some port is better than no port at all. The first PR probably won't be perfect. I mean, it's 650 lines already.

We will test this eventually because it's needed on a project.

Copy link

@sjahr sjahr left a comment

Choose a reason for hiding this comment

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

Thanks for your work! I had issues with building this PR (Code did not compile). Maybe I did something wrong when I've tried to install this. Could you add some instructions in the PR description (or even the README)? Nonetheless, I've added a couple of comments with suggestions that I've received recently :)


install(
TARGETS ${THIS_PACKAGE_LIBRARIES}
EXPORT export_${PROJECT_NAME}
Copy link

Choose a reason for hiding this comment

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

I was recently advised by @tylerjw that this is more standard cmake than the export_ prefix

Suggested change
EXPORT export_${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets

@@ -21,17 +19,26 @@ set(SOURCE_FILES
)
Copy link

Choose a reason for hiding this comment

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

I think you can remove the comment above that is related to catkin_lint

@@ -21,17 +19,26 @@ set(SOURCE_FILES
)

set(MOVEIT_LIB_NAME moveit_handeye_calibration_rviz_plugin)
add_library(${MOVEIT_LIB_NAME}_core ${SOURCE_FILES} ${HEADERS})
Copy link

Choose a reason for hiding this comment

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

Nit: Do you know why this is built with headers and source files instead of using only the source files and including + exporting the headers?

@@ -48,21 +48,25 @@
#include <QRadioButton>

Copy link

Choose a reason for hiding this comment

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

Can you add a description?

#include <cmath>

namespace moveit_rviz_plugin
{
HandEyeCalibrationFrame::HandEyeCalibrationFrame(HandEyeCalibrationDisplay* pdisplay, rviz::DisplayContext* context,
static const rclcpp::Logger LOGGER = rclcpp::get_logger("handeye_calibration_frame");
Copy link

Choose a reason for hiding this comment

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

Nit: Another way to do this would be to use an anonymous namespace instead

Suggested change
static const rclcpp::Logger LOGGER = rclcpp::get_logger("handeye_calibration_frame");
namespace {
const rclcpp::Logger LOGGER = rclcpp::get_logger("handeye_calibration_frame");
}

You can find the related discussion here

geometry_msgs::TransformStamped transform_stamped;
transform_stamped.header.stamp = ros::Time::now();
geometry_msgs::msg::TransformStamped transform_stamped;
transform_stamped.header.stamp = rclcpp::Clock(RCL_ROS_TIME).now(); //Not sure if this is the right approach
Copy link

Choose a reason for hiding this comment

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

@@ -412,6 +420,7 @@ class HandEyeTargetBase
}

protected:
static const rclcpp::Logger LOGGER;
Copy link

Choose a reason for hiding this comment

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

Does this need to be a member of this class? I think it would be better to just have one per source file like in the rest of this PR

@@ -39,6 +39,9 @@
namespace moveit_handeye_calibration
{
const std::string LOGNAME = "handeye_aruco_target";
static const rclcpp::Logger LOGGER = rclcpp::get_logger(LOGNAME);
Copy link

Choose a reason for hiding this comment

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

You could merge line 41 and 42 as LOGNAME is only used here

@@ -38,7 +38,10 @@

namespace moveit_handeye_calibration
{
const std::string LOGNAME = "handeye_charuco_target";
const std::string LOGNAME = "moveit_calibration.plugins.handeye_charuco_target";
static const rclcpp::Logger LOGGER = rclcpp::get_logger(LOGNAME);
Copy link

Choose a reason for hiding this comment

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

Same as above

<license>BSD</license>

<url type="website">http://moveit.ros.org</url>
<url type="bugtracker">https://github.com/ros-planning/moveit_calibration/issues</url>
<url type="repository">https://github.com/ros-planning/moveit_calibration</url>

<buildtool_depend>catkin</buildtool_depend>
<buildtool_depend>ament_cmake</buildtool_depend>
Copy link

Choose a reason for hiding this comment

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

Add moveit_common as build_depend

@henningkayser henningkayser mentioned this pull request Nov 2, 2021
@henningkayser henningkayser linked an issue Nov 2, 2021 that may be closed by this pull request
Vatan Aksoy Tezer and others added 3 commits December 1, 2021 23:26
@hamsadatta
Copy link

@Abishalini @AndyZe
Hello, any updates on this? I am interested in using this package in one of our projects.

@mcres
Copy link

mcres commented Aug 9, 2024

Same as @hamsadatta here, it would be great if this was available in ROS2. We'd like to use this in one of our projects as well.

@rhaschke rhaschke deleted the branch moveit:foxy August 29, 2024 20:31
@rhaschke rhaschke closed this Aug 29, 2024
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.

Port to ROS 2
9 participants