generated from wessel/boilerplate
2.2 KiB
2.2 KiB
WheelDataSimulator (assignments::three::wheel_data_simulator_node)
The WheelDataSimulator node generates simulated wheel encoder/velocity data (std_msgs/msg/Float64MultiArray) based on configurable time-varying intervals. It publishes wheel values for a 4-wheel robot configuration that can follow constant, linear, or quadratic trajectories over time.
Implementation Details
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
publish_rate |
double | 10.0 | Publishing frequency in Hz |
max_intervals |
int | 4 | Maximum number of intervals per wheel |
<wheel>.num_intervals |
int | 0 | Number of intervals for each wheel |
<wheel>.interval_<n>.* |
various | - | Interval configuration (see Simulator) |
Wheels Configured:
wheel_fl- Front Left wheelwheel_fr- Front Right wheelwheel_rl- Rear Left wheelwheel_rr- Rear Right wheel
Constructor
DataSimulator()
- Initializes ROS2 node with name
wheel_data_simulator - Creates
Simulatorinstance for value generation - Creates publisher for
simulated_wheel_datatopic - Sets up timer for periodic publishing
Core Functionality
void publish_wheel_data()
- Timer callback invoked at the configured publish rate
- Calculates elapsed time since node start
- Queries
Simulatorfor current values of all 4 wheels - Populates Float64MultiArray message with wheel values in order: [FL, FR, RL, RR]
- Publishes message to topic
ROS2 Interface
Publications
simulated_wheel_data(std_msgs/msg/Float64MultiArray)- Publishes simulated wheel data at configured rate
- Array contains 4 values: [front_left, front_right, rear_left, rear_right]
Usage Example
ros2 run g2_2025_odometry_pkg wheel_data_simulator_node --ros-args \
-p publish_rate:=50.0 \
-p wheel_fl.num_intervals:=1 \
-p wheel_fl.interval_0.type:=linear \
-p wheel_fl.interval_0.t_start:=0.0 \
-p wheel_fl.interval_0.t_end:=10.0 \
-p wheel_fl.interval_0.y_start:=0.0 \
-p wheel_fl.interval_0.y_end:=5.0
Dependencies
rclcpp- ROS2 C++ client librarystd_msgs- Standard message typesSimulator- Internal simulation engine