Views
No views yet
| Property | Value |
|---|---|
| Algorithm | Soft Actor-Critic (SAC) |
| Policy | MultiInputPolicy |
| Observation | Dict — image (64×64×3) + sensor vector (184,) |
| Action Space | Box([-1, -1], [1, 1]) — speed & steering |
| Simulator | Gazebo (Ignition/Harmonic) via ROS 2 |
| Framework | Stable-Baselines3 |
RcCarTargetEnvRcCarComplexEnv1spaces.Dict({
2 "image": spaces.Box(low=0, high=255, shape=(64, 64, 3), dtype=np.uint8),
3 "sensor": spaces.Box(low=0.0, high=1.0, shape=(184,), dtype=np.float32)
4})sensor vector contains:spaces.Box(low=[-1.0, -1.0], high=[1.0, 1.0], dtype=np.float32)| Index | Meaning | Scale |
|---|---|---|
action[0] | Linear speed | × 1.0 m/s |
action[1] | Steering angle | × 0.6 rad/s |
steer = 0.6 × prev + 0.4 × target.RcCarTargetEnv| Event | Reward |
|---|---|
| Progress toward target | Δdistance × 40.0 |
| Reached target (< 0.6 m) | +100.0 |
| Collision (LiDAR < 0.22 m) | −50.0 |
| Per-step penalty | −0.05 |
RcCarComplexEnv| Event | Reward |
|---|---|
| Progress toward target | Δdistance × 40.0 |
| Forward speed bonus (on progress) | +speed × 0.5 |
| Proximity warning (LiDAR < 0.5 m) | −0.5 |
| Collision | −50.0 |
| Reached target | +100.0 |
| Per-step penalty | −0.1 |
1model = SAC(
2 "MultiInputPolicy",
3 env,
4 learning_rate=3e-4,
5 buffer_size=50000,
6 policy_kwargs=dict(
7 net_arch=dict(pi=[256, 256], qf=[256, 256])
8 ),
9 device="auto"
10)n_stack)DummyVecEnv + VecFrameStack (channels_order="last")| Component | Requirement |
|---|---|
| ROS 2 | Humble or newer |
| Gazebo | Ignition Fortress / Harmonic |
| Python | 3.10+ |
| PyTorch | 2.0+ |
| stable-baselines3 | ≥ 2.0 |
| gymnasium | ≥ 0.29 |
| opencv-python | any recent |
| cv_bridge | ROS 2 package |
pip install stable-baselines3 wandb hydra-core gymnasium opencv-pythonros2 launch my_bot_pkg sim.launch.pypython train.py experiment.mode=target experiment.total_timesteps=5000001from stable_baselines3 import SAC
2from rc_car_envs_camera import RcCarTargetEnv
3
4env = RcCarTargetEnv()
5model = SAC.load("sac_target_camera_final", env=env)
6
7obs, _ = env.reset()
8while True:
9 action, _ = model.predict(obs, deterministic=True)
10 obs, reward, terminated, truncated, info = env.step(action)
11 if terminated or truncated:
12 obs, _ = env.reset()├── rc_car_envs_camera.py # Gym environments (Base, Target, Complex)
├── train.py # Hydra-based training entry point
├── configs/
│ └── config.yaml # Hydra config (mode, timesteps, wandb, etc.)
└── models/ # Saved checkpoints (W&B)DummyVecEnv runs a single environment — parallelisation would require SubprocVecEnv with careful ROS node naming.scan_received / cam_received wait loop to time out, potentially delivering stale observations.1@misc{rccar_sac_nav,
2 title = {RC Car Autonomous Navigation with SAC (Camera + LiDAR)},
3 year = {2025},
4 url = {https://huggingface.co/Hajorda/SAC_Complex_Camera}
5}