GOHAN means Guided Optimization for High-speed Autonomous Navigation.
This repository is now the GOHAN project root. It contains a telemetry-only reinforcement learning autonomy stack for Autonoma Labs AWSIM Racing Simulator and the Dallara AV-21R. AWSIM runs separately and publishes ROS2 telemetry; GOHAN converts that telemetry into a normalized vector observation, runs a Stable-Baselines3 policy, and publishes steering/throttle/brake commands back through ROS2.
GOHAN does not include AWSIM, clone AWSIM, modify simulator source, use camera perception, or assume CUDA.
AWSIM Racing Simulator
-> ROS2 telemetry
GOHAN Ros2Bridge
-> telemetry feature extractor
Stable-Baselines3 PPO/SAC-ready policy
-> action mapper and safety filter
GOHAN Ros2Bridge
-> ROS2 vehicle command
AWSIM Dallara AV-21R
-> logging, reward, and training loop
AG26/
README.md
pyproject.toml
requirements.txt
configs/
awsim.yaml
reward.yaml
training.yaml
tracks/default_track.yaml
scripts/
src/gohan/
tests/
runs/
ros2_ws/
src/sim-msgs/
build/
install/
log/
ros2_ws is only for external ROS2 message packages such as autonoma_msgs. The Python package lives directly in this root under src/gohan.
- Linux Mint 22.x or another ROS2 Jazzy-compatible Linux system.
- ROS2 installed externally, for example
/opt/ros/jazzy. - Python 3.10+.
- AWSIM Racing Simulator installed separately and running in a ROS2-controlled racing scene.
- Autonoma message packages built in
ros2_ws. - CPU-first training. CUDA is not required.
rclpy is intentionally not in requirements.txt; it comes from the sourced ROS2 installation.
Run this once from the project root. Use system Python, not Anaconda, so ROS2 CMake finds the right Python packages.
cd /home/osama/Documents/RL/AG26
mkdir -p ros2_ws/src
cd ros2_ws/src
git clone https://github.com/autonomalabs/sim-msgs.git
cd /home/osama/Documents/RL/AG26/ros2_ws
conda deactivate
source /opt/ros/jazzy/setup.bash
colcon build --symlink-install --cmake-args -DPython3_EXECUTABLE=/usr/bin/python3If a previous configure was polluted by Anaconda, rebuild with:
cd /home/osama/Documents/RL/AG26/ros2_ws
conda deactivate
source /opt/ros/jazzy/setup.bash
colcon build --symlink-install --cmake-clean-cache --cmake-args -DPython3_EXECUTABLE=/usr/bin/python3Create the Python environment in the root:
cd /home/osama/Documents/RL/AG26
conda deactivate
/usr/bin/python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .Run this before any ROS-facing script:
cd /home/osama/Documents/RL/AG26
conda deactivate
source /opt/ros/jazzy/setup.bash
source /home/osama/Documents/RL/AG26/ros2_ws/install/setup.bash
source .venv/bin/activate
export ROS_DOMAIN_ID=0AWSIM does not need to live in this repository. Start it however you installed it, then enter the racing Drive scene with ROS2 control enabled.
export ROS_DOMAIN_ID=0
# launch AWSIM using your installed executable, launcher, or desktop shortcutTopics will not appear while AWSIM is closed or still outside the running Drive scenario. If GOHAN sees only /parameter_events and /rosout, ROS2 is alive but AWSIM is not visible on that ROS graph.
Manual reset is the default. Automatic reset needs an AWSIM-side reset service or simulator integration; add that later in AWSIMRacingEnv.reset() when a reset API is available.
ros2 topic list -t
python scripts/inspect_ros_topics.py --config configs/awsim.yamlExpected high-level racing topics include:
/novatel_top/inspva or /novatel_bottom/inspva
/novatel_top/rawimux or /novatel_bottom/rawimux
/vehicle_data
/powertrain_data
/race_control
/vehicle_inputs
/to_raptor
If a command topic type is unsupported, inspect it:
ros2 topic info /vehicle_inputsThen update:
src/gohan/ros/message_adapters.py
GOHAN fails clearly instead of publishing an unknown command shape.
python scripts/record_telemetry.py --config configs/awsim.yaml --run-name telemetry_testThis verifies that AWSIM telemetry is visible and that the adapters can build GOHAN telemetry rows.
python scripts/drive_manual_test.py --config configs/awsim.yaml --mode slow_forwardSupported modes:
neutralbrakeslow_forwardsine_steer_low_speed
Run this before training.
python scripts/check_awsim_env.py --config configs/awsim.yamlThis waits for telemetry, creates one observation vector, publishes one neutral command, and exits.
Train only after topic inspection, telemetry recording, environment check, and manual command publishing work.
python scripts/train_ppo.py \
--config configs/awsim.yaml \
--training-config configs/training.yaml \
--reward-config configs/reward.yaml \
--run-name awsim_ppo_v1 \
--total-timesteps 100000Models and logs are written under:
runs/awsim_ppo_v1/
python scripts/evaluate_policy.py \
--config configs/awsim.yaml \
--model runs/awsim_ppo_v1/models/final_model.zip \
--episodes 3python scripts/run_inference_controller.py \
--config configs/awsim.yaml \
--model runs/awsim_ppo_v1/models/final_model.zipCtrl+C sends a brake command before shutdown.
python scripts/plot_telemetry.py --input runs/awsim_ppo_v1/telemetry.csv --output runs/awsim_ppo_v1/plotsGOHAN uses a 20D np.float32 vector clipped to [-1, 1]:
[
lateral_error_norm,
heading_error_sin,
heading_error_cos,
speed_norm,
longitudinal_velocity_norm,
lateral_velocity_norm,
yaw_rate_norm,
track_curvature_norm,
distance_to_left_boundary_norm,
distance_to_right_boundary_norm,
lookahead_1_dx_norm,
lookahead_1_dy_norm,
lookahead_2_dx_norm,
lookahead_2_dy_norm,
lookahead_3_dx_norm,
lookahead_3_dy_norm,
previous_steering,
previous_throttle_brake,
lap_progress_sin,
lap_progress_cos
]
The observation is built from ROS2 telemetry and track-relative features, not images.
The action space is:
gymnasium.spaces.Box(low=-1.0, high=1.0, shape=(2,), dtype=np.float32)action[0] is steering. action[1] is combined throttle/brake:
if action[1] >= 0:
throttle = action[1]
brake = 0
else:
throttle = 0
brake = abs(action[1])
RacingReward combines progress, speed, line tracking, heading alignment, yaw stability, action smoothness, off-track, collision, reverse-progress, and stuck penalties.
cd /home/osama/Documents/RL/AG26
source .venv/bin/activate
pytestUnit tests do not require AWSIM or ROS2.
- Automatic reset requires AWSIM-side reset support or manual reset.
- Command message types may need adapter updates if AWSIM changes the ROS2 interface.
- The first training goal is stable lap completion, not optimal lap time.
- The default track file is a placeholder; replace it with AWSIM track waypoints or a racing line before serious training.
- v1 direct telemetry-to-control PPO.
- v1.5 reward and curriculum refinement.
- v2 telemetry-guided racing target correction.
- v3 hybrid controller plus RL target optimizer.