Files
ros2-assignments/doc/architecture/nodes/DatabaseHandlerNode.md

1.6 KiB

DatabaseHandlerNode (assignments::three::g2_2025_database_node)

The DatabaseHandlerNode subscribes to position and velocity topics and stores the data in a PostgreSQL database via the DatabaseManager.

Implementation Details

Parameters

Parameter Type Default Description
save_position_data bool true Enable storage of position
save_velocity_data bool true Enable storage of velocity

Constructor

DatabaseHandlerNode()
  • Initializes ROS2 node with name database_handler_node
  • Creates subscriptions to estimated_position and/or estimated_velocity based on parameter configuration

Functions

void position_callback(const geometry_msgs::msg::Pose2D::SharedPtr msg)

  • Primary callback invoked whenever a position message is received
  • Forwards: x, y, and theta to DatabaseManager::store_position_data
  • Throttled warning (5 second interval) on storage failures

void velocity_callback(const geometry_msgs::msg::Twist::SharedPtr msg)

  • Primary callback invoked whenever a velocity message is received
  • Forwards: linear velocity (x, y, z) and angular velocity (z) to DatabaseManager::store_velocity_data
  • Throttled warning (5 second interval) on storage failures

ROS2 Interface

Subscriptions

  • estimated_position (geometry_msgs/msg/Pose2D)

    • Receives calculated position estimates (only subscribed if save_position_data=true)
  • estimated_velocity (geometry_msgs/msg/Twist)

    • Receives calculated velocity estimates (only subscribed if save_velocity_data=true)