How ardev1161/rc_agent works
Purpose and entry points
rc_agent is a ROS 2 C++ robot-side agent that bridges remote gRPC control/telemetry with ROS topics and Nav2 actions. The executable starts from main.cpp; ROS launch integration is provided by launch/rc_agent.launch.py. Build/package boundaries are defined by CMakeLists.txt and package.xml.
Process composition and orchestration
The application appears to assemble subsystem controllers around a ROS 2 runtime: networking, robot controls, telemetry adapters, navigation, and system operations. network/networkcontroller.cpp is the likely coordination boundary between transport and robot-facing modules, while system/system.cpp and config/configprocessor.cpp provide host/system and configuration concerns.
Remote-control transport boundary
gRPC is the external API boundary for a control station. Protocol schemas define control inputs and sensor/map/navigation responses in network/protobuf/robot.proto, with domain contracts split into network/protobuf/base.proto, network/protobuf/navigation.proto, network/protobuf/power.proto, and related schemas. network/server.cpp implements robot-side serving; network/client.cpp supports outbound client behavior. Generated protobuf/gRPC build integration resides in network/protobuf/CMakeLists.txt.
Control flow is remote Controls RPC payloads → network controller/server → ROS-facing handlers; telemetry flows in the reverse direction and is serialized as protobuf Sensors or map data.
ROS base-control and feedback adapter
The base-control module translates remote velocity commands into robot motion and monitors odometry for return telemetry. Its primary boundary is modules/basecontrol/basecontrol.cpp, with its interface in modules/basecontrol/basecontrol.h. This is the actuator-facing ROS integration point for linear/angular movement, isolating gRPC message semantics from ROS publishers/subscribers.
Battery and map telemetry pipelines
Battery state is consumed from ROS battery topics, adapted, and exposed to the network/protobuf layer through modules/battery/battery_state_node.cpp, modules/battery/battery_state_handler.cpp, and modules/battery/battery_state_adapter.h. Map handling similarly receives ROS map data and converts it for remote retrieval in modules/map/map_node.cpp and modules/map/map_node.h.
There is a parallel topics/battery/ implementation (topics/battery/battery_state_node.cpp), suggesting a second or legacy topic-oriented boundary that should be reconciled when modifying battery ownership.
Nav2 command execution
Remote navigation requests are represented internally and dispatched through Nav2 action clients. modules/nav2/nav_command.cpp models commands; modules/nav2/robot_navigator.cpp owns navigation execution; and modules/nav2/robot_navigator_handler.cpp bridges command handling/status reporting. Conversion isolation is explicit in modules/nav2/robot_navigator_conversions.h. This stage handles goals such as pose navigation, waypoints, and spinning, returning status to the gRPC sensor/control exchange.
Discovery and host operations
LAN control-station discovery uses ARP functionality in network/arper.cpp and network/arper.h, separate from gRPC transport. Host-level operations such as shell/system commands and system information are bounded in system/shell.cpp, system/system.cpp, and system/systeminfo.cpp; these likely support remote halt/restart and uptime-style controls.
Runtime and infrastructure
The material runtime is Linux with ROS 2 (Humble+ recommended), C++17, CMake/colcon, rclcpp, Nav2, and gRPC/protobuf. ROS topic/action interfaces connect to robot hardware, sensors, battery publishers, mapping, and Nav2; gRPC and ARP connect the robot to a LAN-based remote control station. Runtime camera configuration is present in params/gscam2.yaml and params/gst_pipeline.yaml.
Main entry points: networkcontroller.cpp Network controller · robot_navigator_handler.cpp Navigation handler · main.cpp rc_agent executable · system.cpp System operations
Components 19
Remote transport
LAN-facing control and telemetry boundary.
- Network controller · Coordinates transport with robot-facing controllers.
network/networkcontroller.cpp - gRPC server · Serves remote control and telemetry requests.
network/server.cpp - gRPC client · Supports outbound remote communication.
network/client.cpp - Control protocol · Defines Controls, Sensors, map, navigation, and power messages.
network/protobuf/robot.proto - Protobuf build
network/protobuf/CMakeLists.txt - ARP discovery · Finds control stations on the local network.
network/arper.cpp
ROS robot adapters
ROS topics and Nav2 action integration.
- Base control · Converts remote velocity commands and odometry feedback.
modules/basecontrol/basecontrol.cpp - Battery telemetry · Adapts ROS battery state for protobuf telemetry.
modules/battery/battery_state_handler.cpp - Battery state node
modules/battery/battery_state_node.cpp - Map telemetry · Converts ROS map data for remote retrieval.
modules/map/map_node.cpp - Navigation handler · Bridges remote navigation commands and status.
modules/nav2/robot_navigator_handler.cpp - Navigation commands · Represents pose, waypoint, and spin requests.
modules/nav2/nav_command.cpp - Nav2 navigator · Executes navigation goals through Nav2.
modules/nav2/robot_navigator.cpp - ROS 2 topics & actions · Connects hardware, sensors, mapping, and Nav2.
Host operations
Robot host configuration and system controls.
- Configuration processor
config/configprocessor.cpp - System operations · Provides remote host and system-information operations.
system/system.cpp - Shell commands
system/shell.cpp
Other components
- rc_agent executable · Initializes the ROS 2 robot-side agent.
main.cpp - ROS launch · Launches the agent in a ROS deployment.
launch/rc_agent.launch.py
Connections 24
- ROS launch → rc_agent executable: starts
- rc_agent executable → Network controller: initializes
- rc_agent executable → Configuration processor: loads
- rc_agent executable → System operations: initializes
- Network controller → gRPC server: serves through
- Network controller → gRPC client: uses
- gRPC server → Control protocol: implements
- gRPC client → Control protocol: uses
- Protobuf build → Control protocol: generates
- ARP discovery → Network controller: discovers peers for
- Network controller → Base control: control commands
- Base control → ROS 2 topics & actions: velocity and odometry
- ROS 2 topics & actions → Battery state node: battery topic
- Battery state node → Battery telemetry: state
- Battery telemetry → Network controller: Sensors telemetry
- ROS 2 topics & actions → Map telemetry: map data
- Map telemetry → Network controller: map telemetry
- Network controller → Navigation handler: navigation requests
- Navigation handler → Navigation commands: creates
- Navigation handler → Nav2 navigator: dispatches
- Nav2 navigator → ROS 2 topics & actions: Nav2 actions
- Navigation handler → Network controller: goal status
- System operations → Shell commands: executes
- Network controller → System operations: host operations