Localization Subteam
Goal
The localization subteam's goal this week was to run the AMCL particle filter on a map we created.
Creating a Map - Improvements
We created a map using ROS's SLAM toolbox. We did this last milestone, but this one is nicer and doesn't have any loop closure issues.
The generated map (outside of MAC 306). This map has only a few small holes and no double walls.
Particle Filter
We ran the particle filter from ROS's AMCL package using the map we created and successfully localized a Neato as it drives around the map.
Challenges
Multiple setup issues. Loading a map into rviz was challenging for the following reasons:
- After exporting, the map says (result=0), implying that the yaml file is broken with no way to fix it.
- Fix: although (result=0) implies that the yaml file is broken, this output is completely fine.
- The created map refused to load into Rviz
- Fix: We used special configurations for the map to load: rviz2 -d ~/ros2_ws/src/robot_localization/rviz/amcl.rviz
Next Steps
Our next step is to implement the AMCL particle filter to two Neatos which both share the same map. This will require meeting with the Multi-Neato subteam to learn how to run programs that control two Neatos. We will then have to adapt their methods to run a separate particle filter for each of the two Neatos and publish both locations to rviz. After successfully tracking the positions of both Neatos through the particle filter, we can as a stretch goal for the next milestone work towards building the logic for the chasing Neato to tag the other Neato using the shared locations.
Multi-Neato Subteam
Goal
Going into milestone 2, our goals were to run our multi-Neato teleop code on two Neatos and to create a plan for the final project’s file structure, which will combine learnings from all three subteams.
Teleop
We spent some time tidying our ros2 directories before we were able to successfully build packages and run the code, but once we were able to run it, there were just a few small bugs to fix before it was working.
Once the code was running successfully, we discussed progress with the other subteams and decided to make an improved teleop file, adapted from Brenna’s project 1 code, which would have more intuitive controls for each Neato.
Writing the teleop files has given us good practice writing nodes that communicate to multiple Neatos. This will be very important for our final project, which will require communicating different instructions to the chaser Neato and the escaper Neato.
Project Structure
The diagram below shows our plan for the file setup and publishers of the final project.
Both Neato1 and Neato2 have their own particle filter node since the locations of both on the world map are needed for the chase. Both particle filters send location data of their respective Neato to the chase_logic node which calculates what direction and speed is needed for Neato1 to follow Neato2, then sends those velocity instructions to Neato1. Neato2 gets its velocity instructions from teleop, so the user can play as Neato 2 in the game of tag.
One important mystery of this set up is that we currently don’t know how to specify which Neato a particle filter is running on using ros2’s particle filter package. This will be a very important question to solve, as we will need to specify which particle filter is running on which neato.
Next Steps
Now that we have a plan for project structure, we will need to tag up with the whole team again and start writing and testing these files. We will also need to answer our question regarding multiple particle filters.
We are planning how to integrate our existing work into the final project structure. Our chase_logic node can use the neato’s locations on the world map (from the particle filter) to send Neato1 in the approximate direction of Neato 2, and use machine vision tracking to narrow in on Neato2 and improve chasing accuracy. The localization subteam is currently learning Bash scripting to be able to create a script that can run all nodes with one command. The multi-Neato subteam will probably spend a good part of the next milestone figuring out our multiple particle filter question, and ironing out other wrinkles that come from using multiple neatos.
Machine Vision Subteam
Goal
Our goal for milestone 2 was to complete our machine vision pipeline.
Machine Vision Pipeline
Our machine vision pipeline goal is to be able extract and return the bounding box of a specified color in an image, in our case neon pink.
- Convert to HSV: Transform the input image from BGR to HSV for better object detection
- Make Color Threshold: Convert the target color
RGB(221,101,121) to HSV and define a small range around it for detection
- Create a Color Mask: Use
cv2.inRange to isolate pixels within the target pink range
- Edge Detection: Apply Canny edge detection to highlight boundaries of the detected regions
- Morphological Closing: Close small gaps in edges to improve contour stability
- Find and Filter Contours: Extract contours and discard small noisy ones (area < 50 pixels)
- Merge Contours: Combine all detected contours into a single bounding rectangle
- Return Bounding Box: Output the coordinates
[X1, Y1, X2, Y2], or None if nothing is detected
Machine Neato Tag Pipeline
After we finished our machine vision pipeline, we made our initial chaser robot logic. This does not yet have the bump sensor logic implemented.
- Gets image: Subscribes to the camera topic (
camera/image_raw) and stores the latest image in self.cv_image.
- Color Detection: Runs
color_detection on each image to find the neon-pink object and get a bounding box
- Bounding Box Processing:
- Computes the center of the bounding box
- Converts the bounding box to approximate angles using
convert_to_lidar_angles
- Determines the turn direction for the robot to face the target
- Send Velocity Commands to Neato
- If the Neato is detected, the Neato moves forward and turns proportionally to the target angle
- If not detected, the Neato slowly rotates in the last known turn direction to search for the other Neato
This pipeline loops over and over again to make the chaser Neato track and follow the chasee Neato
Next Steps
Our next steps are to add in the bump detection logic and run a full game of Neato tag with our autonomous chaser Neato and teleop-ed chasee Neato. We have also done some work on using the SORT algorithm and hope to implement that into our code. We may investigate some of our other stretch goals like creating an autonomous chasee Neato. This will require us to integrate with the other subteams and we plan to coordinate with them.