Skip to content

Codebase Walkthrough

Yashas Ambati edited this page Sep 14, 2024 · 10 revisions

This page will serve as an interactive "lab" that will help familiarize you with the codebase.

Control

We use the ROS 2 Control framework for real-time control of our rover. As a primer, please review this page first, which outlines the architecture of the framework.

Hardware Interfaces

  • Our collection of hardware interface implementations can be found in urc_hw/src/hardware_interfaces. In each of the .cpp files you will find some sort of implementation for the hardware interface template class, such as decode() and read().
  • For each of the hardware interfaces, you will find them plugged into to the rover model at urc_hw_description/urdf/ros2_control.xacro. When the model is pulled as part of a launch invocation, each of the hardware interfaces is read and available for use.

Controllers

  • Our custom controllers are written in urc_controllers. The most important of these would be the status_light_controller.
  • One of our controllers, the rover_drivetrain_controller, is a copy of the previously implemented DiffDriveController from the ros2_controllers packages. It is specified at urc_bringup/config/controller_config.yaml.

Navigation

  • Our navigation stack is split up into two key components, path_planning and trajectory_following.
  • path_planning: this package is responsible for allowing creating paths through the current cost map using a simple A* implementation. astar.cpp is responsible for the A* implementation, while planner_server.cpp is a ROS2 server implementation which a client may request for a new version of the path.
  • trajectory_following: this package is responsible for enabling the rover to follow through a path that was generated by the planner_server node. geometry_util.cpp is a set of functions which may be called for geometric calculations. pure_pursuit.cpp is responsible for looking up the next pose to be followed within the current path and manipulating the drivetrain commands to move to that pose. follower_action_server.cpp is a ROS2 action server node implementation which is given a goal (pose) to be reached, and provides feedback for the distance remaining to the goal. It also re-plans by making a request to the planner_server if an obstacle is detected.

Bringup

Clone this wiki locally