A dictionary stores markers' types.
Displays detected ArUco markers on the image with some new additions. Green lines between the corners, red dot on the center of the marker and marker id on the top left corner.
Creating form of the ROS 2 node for ArUco marker detection.
-
Setting the ArUco type, loading the dictionary and parameters, creating publishers and starting the video capturing via camera.
-
Process a single frame for ArUco marker detection. It detects the ArUco markers and checks if the marker ID has already been processed. If not, it publishes the 2D points of corners and the marker id.
I made it like this in order to make output more readable. Codes can be changed under any request of receiving continuous feedbacks about marker.
-
Run the detection loop.
Main function to initialize and run the node.
Creating form of the ROS 2 node for the listener.
- Creating subscription for the topics of detected_marker_id and detected_marker_corners.
- Callback for received marker IDs. It writes received marker id.
- Callback for received marker corners. It writes how many corners reccieved and the positions of each corner.
Main function to initialize and run the node.
- From the ARUCO_DICT part, select the type of ArUco will be used.
- Copy that name and paste it to self.aruco_type variable, which can be found in the init part.
- In setup.py, go to entry_points part. Between the brackets of console_scripts, write this 2 files in this format:
- "[the name you want] = [package name].[the name used in super().init]:main,"
!Do not use "[" and "]".
- Go to package.xml and set up the dependencies.
- After completion of these steps, open 2 terminal and go to workshop where these files created.
- Build them with the line "colcon build" and after that wrote the line "source install/setup.bash".
- After that, in one terminal, open the aruco detection file by writing the line "ros2 run [package name] [the name you want (in setup.py)]"
Again do not use "[" and "]".
- And, open the listener node from the other terminal.
- integrated_aruco_detection.py recognizes the markers and prepares its id to publish.
- And from the camera, it calculates 2D corner positions of the marker in the image plane.
- Then, it publish ids in Int32 format and corner positions in PoseArray format.
- Our listener_node is subscriber of their topics. It listens and gathers informations.
- With these informations, it writes marker id, how many corners captured and the positions of the corners into the terminal.