MORAI SIM UDP Example Code Tutorial
Simulator Network Settings
Network Settings
Ports for Host IP and Ego Ctrl, Object Info, Ego Vehicle Status are configured as follows.
For running Simulator in local environment, use Bridge IP 127.0.0.1.
Enter default port numbers.
ego ctrl cmd : 7601, 7600
get traffic : 7701, 7700
set traffic : 7801,7800
vehicle status : 8001, 8000
object info : 8101, 8100
For running the Simulator in virtual environments, change settings as shown in the figure below.
Host IP 192.168.56.1
DST IP 192.168.56.101
Parameter Settings
Parameter Setup
Edit param values for user IP and Port numbers
Edit file: gen_udp/scripts/lib/params.json
Edit params.json file to enter user inputs
For running in local environments, input user_ip, host_ip 127.0.0.1.

Sensor Code Test
LiDAR
Chagne directory to gen_udp/scripts
Check IP address in params.json file
For running Simulator in local environment, use sensor IP DST IP 127.0.0.1
python lidar.py
Check outputs
Lidar Port number: unchanged
<params.json file setup>

<Simulator sensor settings>

<Output displayed in console window>
Camera
Change directory to gen_udp/scripts
Check IP address in params.json file
For running Simulator in local environment, use Bridge IP 127.0.0.1
python camera.py
Check outputs
Port number for cam : 1231,1232
<params.json file setup>

<Simulator sensor setting>

<Generation of output image>
GPS
Change directory to gen_udp/scripts
Check IP address in params.json file
For running Simulator in local environment, use Bridge IP 127.0.0.1
python gps.py
Check results
Port number for gps : 1233,1234
<params.json file setup>

<Simulator sensor settings>

<Output displayed in console window>
IMU
Change directory to gen_udp/scripts
Check IP address in params.json file
Lor running Simulator in local environment use, Bridge IP 127.0.0.1
python imu.py
Check results
Port number for imu : 1235,1236
<params.json file setup>

<Simulator sensor setting>

<Output displayed in console window>
Driving Path Design
UDP: Design Driving Path
gen_udp/scripts/path_maker.py
(Enter filename and directory for save file) (Ser User_ip)
python path_maker.py
Drives in designated path
Check files in folder gen_udp/path
Check that test_path.txt file has been generated properly

<params.json setup>

<Generated path file>
Testing Driving Code
Testing Driving Code
Change directory to gen_udp/scripts/lib
Check IP address and Port number in params.json file
(user_ip host_ip settings) (Name of driving path) (Traffic GreenLight settings)
Changing (Traffic Greenlight setting) to True changes status of all traffic lights to green within the vehicle’s driving path.
Change directory to gen_udp/scripts
python gen_planner.py
Change to auto mode (Change mode using q in keyboard)
Vehicle drives within pre-planned path



<Vehicle driving>

<Output displayed in console window>