fiducials icon indicating copy to clipboard operation
fiducials copied to clipboard

Port to ROS2 foxy

Open agutenkunst opened this issue 3 years ago • 16 comments

I started porting this a while ago. Builds and runs with foxy.

Remarks for supporters:

Here are some remarks to get starting supporting this port

Create markers

Still a bit fuzzy with the correct deps

ros2 run aruco_detect create_markers.py 101 102 fiducials.pdf

Or use fiducials.pdf

Perform fiducial detection using USB camera

I am using a fork from https://github.com/klintan/ros2_usb_camera with this patch to deal with https://github.com/ros-perception/image_common/issues/156

With git clone -b bad_patch_do_not_merge [email protected]:agutenkunst/ros2_usb_camera.git

(check that corrected calibration file is attached)

ros2 launch usb_camera_driver usb_camera_node.launch.py

Note: Just using some "valid" calibration data should be fine.

Probably https://github.com/ros-drivers/usb_cam/tree/ros2 works as well.

Start detection with

ros2 launch aruco_detect aruco_detect.launch.py

Check images in rviz with

ros2 run rviz2 rviz2 -d src/fiducials/aruco_detect/cfg/fiducials.rviz2.rviz

Should look like: image

Perform Fiducials SLAM

  • Start detection like above

  • In addition:

Publish static transforms

ros2 run tf2_ros static_transform_publisher 0 0 0 0 0 0 base_link camera
ros2 run tf2_ros static_transform_publisher 0 0 0 0 0 0 odom base_link
ros2 launch fiducial_slam fiducial_slam.launch.py

DONE

  • [x] Rebase/Reintegrate everything from 1afc4b918f057c079df3c5d336b8a9443afa2311 and later
  • [x] Port tests
    • [x] aruco_detect_images test (see https://github.com/UbiquityRobotics/fiducials/pull/248/commits/a5b3c59b1020d84943fc03abc6e33e18ccb69ffa)
    • [x] fiducial_slam test
  • [x] Implement the handling of parameter updates
    • Port ROS1 FiducialsNode::configCallback functionality into FiducialsNode::param_change_callback (more info)[http://design.ros2.org/articles/ros_parameters.html]

IN PROGRESS

TODOs

  • [ ] Port aruco_gazebo(?)
  • [ ] Check that fiducial_slam is working as expected (help wanted)
  • [ ] Check that aruco_gazebo is working
  • [ ] Add CI

NOT TODO

  • Fix formatting
    • To keep the diff somehow readable I suggest postponing a (really needed) fix of the formating with clang-format
  • Increase testablility
    • Would be really helpful and maybe the first thing to start once this is upstream. Especially some unittests for the detection shouldn't hurt.

I hope this is a helpful starting point and I will try to get to the first three points in the next two weeks.

Anyone interested in supporting is welcome!

agutenkunst avatar Apr 08 '21 18:04 agutenkunst

This closes #247

agutenkunst avatar Apr 08 '21 18:04 agutenkunst

Nice work, we definitely wouldn't merge this into kinetic-devel though as that would break ROS 1, there'd have to be a separate foxy branch. I can make one if you want to fork from it for ease of merging later on. Edit: Moved to foxy-devel.

Right now though I think just about nobody on the dev team actually uses ROS 2 yet, nor can our robot run it because it's a 32 bit system, so we have no practical way of testing the whole thing.

MoffKalast avatar Apr 09 '21 14:04 MoffKalast

Actually that was meant to target this branch. Force of habit. Thanks for fixing.

I can try to provide some demo videos of the current state for you to decide on the readiness.

agutenkunst avatar Apr 09 '21 17:04 agutenkunst

I am interested in helping port this to Foxy. I have it compiled, but not successfully detecting any markers. Please advise on how I can best assist.

einstine909 avatar Apr 17 '21 00:04 einstine909

Update

  • Added "Remarks for supporters" to the description to help others contribute
  • Fixed an issue of aruco_detect crashing on first detection

agutenkunst avatar Apr 17 '21 09:04 agutenkunst

@einstine909 Help of any kind is welcome!

First of try I would recoomend to get the basic detection running and move on the fiducial_slam after this.

To gain confidence in the porting I consider the tests the be of high piority. Yet I also have no experience in ROS2 testing and especially ROS2/rclcpp/launch testing seems to be a bit more challenging than launch-testing in ROS1.

Depending on your experience you could see if the first TODO "Implement the handling of parameter updates" is suitable for you?

Otherwise just pointing out stuff I missed etc and testing the ported functionality also really helps!

I suggest opening a PR to https://github.com/agutenkunst/fiducials/tree/ros2 if you have changes contributing to this PR

agutenkunst avatar Apr 17 '21 09:04 agutenkunst

@rohbotics @MoffKalast @JanezCim

I still will have play around with this. Also I am not sure about aruco_gazebo but I will try to have a look at it.

What do you think how we should preceed? Is there more information / demos you need?

agutenkunst avatar Jul 02 '21 20:07 agutenkunst

Thanks for porting this! My build fails unfortunately:

--- stderr: fiducial_slam                           
CMake Error at CMakeLists.txt:91 (find_package):
  By not providing "Findament_cmake_nose.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "ament_cmake_nose", but CMake did not find one.

  Could not find a package configuration file provided by "ament_cmake_nose"
  with any of the following names:

    ament_cmake_noseConfig.cmake
    ament_cmake_nose-config.cmake

  Add the installation prefix of "ament_cmake_nose" to CMAKE_PREFIX_PATH or
  set "ament_cmake_nose_DIR" to a directory containing one of the above
  files.  If "ament_cmake_nose" provides a separate development package or
  SDK, be sure it has been installed.


---
Failed   <<< fiducial_slam [1.16s, exited with code 1]

Summary: 12 packages finished [2.27s]
  1 package failed: fiducial_slam
  1 package had stderr output: fiducial_slam

I sidestepped, assuming this is just used for testing.

jdekarske avatar Aug 14 '21 23:08 jdekarske

Related, I think this is a typo (rosdep fails)

https://github.com/agutenkunst/fiducials/blob/88198605b53f5d21f43ae1f6c5c47a24074fffbb/fiducial_slam/package.xml#L33

and should be rclcpp for ROS2

https://github.com/agutenkunst/fiducials/blob/88198605b53f5d21f43ae1f6c5c47a24074fffbb/fiducial_slam/package.xml#L17

jdekarske avatar Aug 16 '21 01:08 jdekarske

Hello!

It might have been some time since this was last active, but I am also interested in using, porting the fiducial system to ROS 2.

I'm an newbie on Github contributions/open source work, but have some experience in ROS2. Is the work still being carried on this repo or on the fork?

enunezs avatar Aug 15 '22 11:08 enunezs

Good luck. I would think working with humble and OpenCv to get fiducials to work might be an easier path for you. Also, stag markers appear to work better than the Aruco markers we formerly used.

Also note Raspicam support is being deprecated in the future, so libcamera support will presumably be used, though fiducials should work with any ROS camera stream.

On Mon, Aug 15, 2022, 4:07 AM Emanuel Nunez @.***> wrote:

Hello!

It might have been some time since this was last active, but I am also interested in using, porting the fiducial system to ROS 2.

I'm an newbie on Github contributions/open source work, but have some experience in ROS2. Is the work still being carried on this repo or on the fork?

— Reply to this email directly, view it on GitHub https://github.com/UbiquityRobotics/fiducials/pull/248#issuecomment-1214892580, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHZ3752H7EY2YFIBK5V6B3VZIQG7ANCNFSM42TNCSPA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

anfederman avatar Aug 15 '22 15:08 anfederman

Thanks for the quick reply!

I have previously used Ros2bridge to connect a webcam to detect fiducials, but the bridge compilation times made it unfeasible on my system. I ended making a basic python wrapper of the cv2 library for the detection functionality, which ended working quite alright.

Were the previous porting attempts based on this guide? ROS1-to-ROS2-porting

Im currently working in Foxy. Are the differences between versions too great?

enunezs avatar Aug 15 '22 16:08 enunezs

Due to a change in field I won't be able to continue that and it probably is hugely outdated. Feel free to take whatever is still useful and open own PR.

agutenkunst avatar Aug 15 '22 17:08 agutenkunst

Great! Thank you for your support.

I have asked vid rijavec to perhaps give you a few pointers.

@Vid Rijavec @.***> can you help here?

David

=================================================== Ubiquity Robotics, Inc. is honored to win the Silicon Valley Robotics good robot industry award in the commercialization category. Ubiquity Robotics wins SVR good robot industry award https://svrobo.org/ubiquity-robotics-wins-commercialization-award-in-svr-good-robot-industry-awards/

On Mon, Aug 15, 2022 at 1:07 PM Emanuel Nunez @.***> wrote:

Hello!

It might have been some time since this was last active, but I am also interested in using, porting the fiducial system to ROS 2.

I'm an newbie on Github contributions/open source work, but have some experience in ROS2. Is the work still being carried on this repo or on the fork?

— Reply to this email directly, view it on GitHub https://github.com/UbiquityRobotics/fiducials/pull/248#issuecomment-1214892580, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYN4VXKDIQF7P4JU7AOUSTVZIQHBANCNFSM42TNCSPA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

davecrawley avatar Aug 15 '22 19:08 davecrawley

Thanks David, very appreciated

enunezs avatar Aug 23 '22 11:08 enunezs

Please pay attention to how the camera is mounted relative to the robot.

On Tue, Aug 23, 2022, 4:16 AM Emanuel Nunez @.***> wrote:

Thanks David, very appreciated

— Reply to this email directly, view it on GitHub https://github.com/UbiquityRobotics/fiducials/pull/248#issuecomment-1223921561, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHZ372R4NMJYV3SWO6VYPLV2SXJFANCNFSM42TNCSPA . You are receiving this because you commented.Message ID: @.***>

anfederman avatar Aug 23 '22 18:08 anfederman