Apollo Cyber Integration Example¶
Note
Example directory: [SimOne installation directory]\SimOneAPI\Cyber
For the SimOneAPI direct call layer (
InitSimOneAPI/GetGps/SetDrive, etc.), refer to Technical Architecture.
Integration Approaches¶
SimOne provides two Apollo integration approaches:
Approach 1: ApolloCybertronBridge
The bridge program TransNodeCyber establishes communication between SimOne and Apollo without modifying Apollo's internal code.
Approach 2: Direct Apollo API Integration
Call SimOneAPI directly to retrieve data and implement data forwarding logic independently.
Build¶
Must be built inside an Apollo Docker container:
# 1. Set library path (replace with the actual lib directory path)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<SimOneAPI lib path>
# 2. Run the build script
cd [SimOne installation directory]\SimOneAPI\Cyber
./gen_make_release.sh
After a successful build, the executable TransNodeCyber is generated in the run/ directory.
Configuration¶
Edit config.ini in the same directory before running:
[BridgeIO]
BridgeIO_IP = 127.0.0.1 # SimOne BridgeIO service IP
[HostVehicle]
Vehicle_ID = 0 # Ego vehicle ID (must match the SimOne configuration)
[Sensor]
ENABLED = 0 # Enable physical sensor data (Camera/Lidar): 1 = enabled
IMG_IP = 127.0.0.1 # Camera UDP service IP
IMG_PORT = 0 # Camera UDP port
PCD_IP = 127.0.0.1 # Lidar UDP service IP
PCD_PORT = 0 # Lidar UDP data port
PCD_PORT_INFO = 0 # Lidar UDP info port
PCD_FRAMEID = velodyne128 # Point cloud frame_id (must match the Apollo map configuration)
PCD_CHANNEL = /apollo/sensor/lidar128/compensator/PointCloud2 # Point cloud publish channel (configurable)
Runtime Flow¶
main()
├── config_ini() Read config.ini
└── run()
├── init() Initialize SimOneAPI + configure sensor parameters
├── pub_thread Publish data to Apollo every 16 ms ──────────────────┐
│ ├── Chassis / IMU (chassis status, inertial data) │
│ ├── GPS / INS Stat (pose, velocity, INS status) │
│ ├── Obstacles (ground-truth obstacles) │ Async callbacks
│ ├── TrafficLight (traffic light status) │ Image / PointCloud
│ ├── ContiRadar (millimeter-wave radar targets) │
│ └── RoutingReq (global routing waypoints, every 32 ms) ───────────┘
└── rcv_thread Receive Apollo control commands every 16 ms
├── Control (throttle/brake/steering) → SetDrive
└── Trajectory (planned trajectory points) → SetDriveTrajectory
Communication Interface¶
Apollo–SimOne simulation communication interface:
| Module | Interface Function | Data Direction | Message Channel | Proto Message Structure |
|---|---|---|---|---|
| Control | Longitudinal control (throttle/brake/steering) | Apollo → SimOne | /apollo/control | apollo/modules/control/proto/control_cmd.proto |
| Planning | Navigation request (global routing waypoints) | SimOne → Apollo | /apollo/routing_request | apollo/modules/routing/proto/routing.proto |
| Navigation response | Apollo → SimOne | /apollo/routing_response | apollo/modules/routing/proto/routing.proto | |
| Planned trajectory | Apollo → SimOne | /apollo/planning | apollo/modules/planning/proto/planning.proto | |
| Canbus | Chassis message (ego vehicle chassis status) | SimOne → Apollo | /apollo/canbus/chassis | apollo/modules/canbus/proto/chassis.proto |
| Localization | IMU (angular velocity, acceleration) | SimOne → Apollo | /apollo/sensor/gnss/corrected_imu | apollo/modules/localization/proto/imu.proto |
| GPS (vehicle pose, velocity) | SimOne → Apollo | /apollo/sensor/gnss/odometry | apollo/modules/localization/proto/gps.proto | |
| Driver | INS status | SimOne → Apollo | /apollo/sensor/gnss/ins_stat | apollo/modules/drivers/gnss/proto/ins.proto |
| Perception | Obstacle perception (ground truth) | SimOne → Apollo | /apollo/perception/obstacles | apollo/modules/perception/proto/perception_obstacle.proto |
| Traffic light perception | SimOne → Apollo | /apollo/perception/traffic_light | apollo/modules/perception/proto/traffic_light_detection.proto | |
| Millimeter-wave radar (Continental) | SimOne → Apollo | /apollo/sensor/conti_radar | apollo/modules/drivers/proto/conti_radar.proto | |
| Sensor | Lidar point cloud | SimOne → Apollo | /apollo/sensor/lidar128/compensator/PointCloud2 (configurable via PCD_CHANNEL) |
sensor_msgs/PointCloud2 |
| Camera image | SimOne → Apollo | /apollo/sensor/camera/... | sensor_msgs/Image |
Data Conversion Notes¶
Note
The bridge program applies the following coordinate system conversions and enum mappings when forwarding data. Implementations that bypass the bridge must maintain these conversions.
1. GPS heading (oriZ) coordinate offset
SimOne uses the OpenDRIVE coordinate system while Apollo uses ENU. The heading angles differ by 90°:
// SimOne oriZ → Apollo quaternion (offset by π/2)
cybertron::quat q(cybertron::vec3(oriX, oriY, oriZ - (M_PI / 2)));
2. Obstacle type mapping
| SimOne Type | Apollo proto type | Description |
|---|---|---|
| Truck / Bus / SpecialVehicle | 5 | VEHICLE |
| Pedestrian | 3 | PEDESTRIAN |
| Bicycle | 4 | BICYCLE |
| Others | 0 | UNKNOWN |
3. Traffic light color mapping
| SimOne Status | Apollo color value | Description |
|---|---|---|
| Red | 1 | Red light |
| Yellow | 2 | Yellow light |
| Green | 3 | Green light |
| Black | 4 | Light off |
| Unknown | 0 | UNKNOWN |
4. Control command scaling
Apollo control values are percentages (0–100) and must be scaled before passing to SimOneAPI:
pData->throttle = mCyberControl.mThrottle * 0.01; // percentage → [0, 1]
pData->brake = mCyberControl.mBrake * 0.01;
pData->steering = -mCyberControl.mSteering * 0.01; // sign reversed (coordinate system difference)

