Code Overview for AIM 2024 software stack

A line follower project for NXP MR-B3RB (Mobile Robotics Buggy 3 Rev B) for participants of AIM 2024.

HARDWARE

This software can run on the B3RB and Gazebo Simulator.

  1. Gazebo Simulator: Development and testing environment used for B3RB.

    • It's used to simulate the B3RB with it's various sensors and capabilities.

    • It's used to simulate the track with it's various challenges and obstacles.

SOFTWARE

This project is based on the autopilot project - CogniPilot (AIRY Release for B3RB).

  • Refer the CogniPilot AIRY Dev Guide for information about it's various components.

  • Cranium: A ROS workspace that performs higher level computation for CogniPilot.

    • On the hardware B3RB, it runs on NavQPlus board (Mission Computer).

    • On the Gazebo Simulator, it runs on the Ubuntu Linux machine.

  • This project includes a ROS2 Python package that integrates into the Cranium workspace.

    • This project (b3rb_ros_line_follower) should be moved to ~/cognipilot/cranium/src.

    • This is the only folder that participants would modify and submit for the regional finale.

Understanding the B3RB ROS LINE FOLLOWER

_**~/congnipilot/cranium/src/b3rb_ros_line_follower**_ is the only folder that the participants have to modify an submit for the Regional Finale

This project contains three python scripts which provide a framework for a line follower application.

  • b3rb_ros_edge_vectors: It creates vectors on the edges of the road in front of the rover.

    • The image captured from the front camera is used for detecting edges of the road.

    • Cases based on number of vectors created:

      • 0: When neither left or right edge of the road is detected.

      • 1: When only 1 out of left or right edge of the road is detected.

      • 2: When both left and right edge of the road are detected.

        • Both the vectors's mid-point can't lie in either the left or right half.

        • One vector must lie in the left half and the other must lie in the right half.

    • The vectors are published to the topic "/edge_vectors".

      • Message type: "~/cognipilot/cranium/src/synapse_msgs/msg/EdgeVectors.msg".

    • We assume the part of road that is very close to the rover is relevant for decision making.

      • Hence, only the bottom 40% of the image is analyzed for edges of the road.

        • This threshold could be modified by changing the value of lower_image_height.

      • Hence, the y-coordinates of the vectors ∈ [40% of image height, image height].

    • Please feel free to modify this file if you feel that would improve the vector creation.

  • b3rb_ros_line_follower: Contains framework for running the rover using edge vectors.

    • Write your code in the "edge_vectors_callback" function for line follower application.

      • This callback is called whenever a new set of vectors are published on "/edge_vectors".

    • Utilize "rover_move_manual_mode" for moving the rover. Refer its docstring for explanation.

    • Write your code in the "lidar_callback" function for obstacle avoidance and ramp detection.

      • This callback is called whenever a new set of data is published on "/scan".

    • Please note that this file contains a generic implementation of line follower functionality.

      • You are allowed to modify or implement a different method to improve performance.

  • b3rb_ros_object_recog: Contains framework for recognizing objects on the track.

    • Write your code in the "camera_image_callback" function.

Communication between ROS-2 nodes

The below diagram depicts how various essential ROS-2 nodes are communicating with each other:

In above graph:

  • The ovals are the nodes.

  • The rectangles are the topics.

  • The outer rectangles are namespaces of the topics.

  • The arrows represent publishers and subscriptions of nodes.

Last updated