UbiquityRobotics / fiducials

Simultaneous localization and mapping using fiducial markers.
BSD 3-Clause "New" or "Revised" License
265 stars 135 forks source link

Port to ROS2 foxy #248

Open agutenkunst opened 3 years ago

agutenkunst commented 3 years ago

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 git@github.com: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

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

TODOs

NOT TODO

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 commented 3 years ago

This closes #247

MoffKalast commented 3 years ago

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.

agutenkunst commented 3 years ago

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.

einstine909 commented 3 years ago

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.

agutenkunst commented 3 years ago

Update

agutenkunst commented 3 years ago

@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 commented 3 years ago

@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?

jdekarske commented 3 years ago

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 commented 3 years ago

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

enunezs commented 2 years ago

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?

anfederman commented 2 years ago

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: @.***>

enunezs commented 2 years ago

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?

agutenkunst commented 2 years ago

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.

davecrawley commented 2 years ago

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: @.***>

enunezs commented 2 years ago

Thanks David, very appreciated

anfederman commented 2 years ago

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: @.***>