V2I-V2V / Vehicular-Mininet-WiFi

0 stars 0 forks source link

Harbor: Boosting Collaborative Vehicular Perception on the Edge with Vehicle-to-Vehicle Communication

Scripts to run mininet-wifi experiments on vehicular perception.

Intsall Mininet-WiFi with python3 (Skip if already installed)

git clone https://github.com/intrig-unicamp/mininet-wifi.git ~/mininet-wifi
pip3 install -r requirement.txt
cd ~/mininet-wifi
git checkout 66a20d80063b83111df950762d260774a38d620a
cp ~/Vehicular-Mininet-WiFi/mininet-scripts/install.sh ~/mininet-wifi/util/install.sh # this install.sh has been modified to work with only python3
sudo util/install.sh -Wlnfv

Update Kernel to v5.8

bash update_kernel.sh

After the script, reboot the machine. Check the output of uname -r, it should be 5.8.0-050800-generic.

Install routing dependencies

Install BATMAN (-B) routing and OLSR (-O) routing protocol.

cd ~/mininet-wifi
sudo util/install.sh -B
sudo util/install.sh -O

Important: After installing olsr, please open /etc/olsrd/olsrd.conf and comment out the line LoadPlugin "/usr/lib/olsrd_jsoninfo.so.1.1" if it exists.

As a quick fix, you can copy my config to your olsrd configuration directory by

sudo cp config/olsrd.conf /etc/olsrd/

Use simple custom routing

Static

First, compile the simple-route.c by

cd routing
make

And then start a simple adhoc topogy without routing by

python3 routing/adhoc.py

From mininet CLI, first verify that sta1 cannot ping sta3 (because thery are out of wireless range and require a intermidiate hop sta2 to route):

sta1 ping sta3
PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
From 10.0.0.1 icmp_seq=1 Destination Host Unreachable
From 10.0.0.1 icmp_seq=2 Destination Host Unreachable
From 10.0.0.1 icmp_seq=3 Destination Host Unreachable
From 10.0.0.1 icmp_seq=4 Destination Host Unreachable
From 10.0.0.1 icmp_seq=5 Destination Host Unreachable

Then type xterm sta1 sta3 to open two xterm terminals. Execute below command in the corresponding xtem terminal.

In sta1 terminal, execute

./routing/simple-route add to 10.0.0.3 dev sta1-wlan0 via 10.0.0.2

In sta3 terminal, execute

./routing/simple-route add to 10.0.0.1 dev sta3-wlan0 via 10.0.0.2

Now try sta1 ping sta3 and it should work. You can also verify the routing change by looking at the output of route -n before/after execute the simple-route command.

For more information about the usage of routing/simple-route.c, refer to routing/README.md.

Dynamic Routing

Add the argument -r custom when running vehicular_perception.py. See optional arguments in the next section.

Use the vehicular_perception.py script

Only setup the network:

sudo python3 mininet-scripts/vehicular_adhoc_setup.py -n <num_nodes> -p <pcd_data_location_file> <optional options>

For example, to start a emulated network without running vehicle.py, try

sudo python3 vehicular_perception.py -n 6 -p input/pcds/pcd-data-config.txt -l input/locations/location-multihop.txt --trace input/traces/trace-all-nodes.txt

To start the emulated network with vehicle.py running, try

sudo python3 vehicular_perception.py -n 6 -p input/pcds/pcd-data-config.txt -l input/locations/location-multihop.txt --trace input/traces/trace-all-nodes.txt --run_app -s minDist --collect-traffic

To use fixed scheduler,

sudo python3 vehicular_perception.py -n 6 -p input/pcds/pcd-data-config.txt -l input/locations/location-multihop.txt --trace input/traces/trace-all-nodes.txt --run_app -s fixed ./input/assignments/assignments-sample.txt <index>

Required arguments:

Optional arguments:

Optional arguments:

Run experiments over the emulated network

Prepare dataset. Download the dataset from google drive and unzip it to the parent directory.

unzip DeepGTAV-data.zip && mv DeepGTAV-data ..

Start the application automatically with the script

sudo python3 mininet-scripts/vehicular_adhoc_setup.py -n 6 -p input/pcd-data-config.txt -l input/location-multihop.txt --trace input/traces/trace-all-nodes.txt --run_app

Start the application manually

After starting the python3 mininet-scripts/vehicular_adhoc_setup.py script, run the follwing commands in the mininet CLI.

xterm server sta1 sta2 sta3 sta4 sta5 sta6

Then at the server terminal, run

python3 server.py 

In each station terminal, run

python3 vehicle/vehicle.py <node_num> <dir_to_pointcloud_data> # the last argument is optional

where node_num = station number - 1 (e.g. python3 vehicle/vehicle.py 1 ../DeepGTAV-data/object-0227-1/alt_perspective/0022786/ at sta2).

Note: for the main vehicle (refered as vehicle 0 here), you only need to run python3 vehicle/vehicle 0 because the the default point cloud dir is set to vehicle 0. For others, you can find the point cloud dirs at ../DeepGTAV-data/object-0227-1/alt_perspective/ (e.g. 0022786/, 0037122/, etc).

Useful utilities/Troubleshooting

sudo service network-manager stop

Adding or deleting nodes (on the fly)

Adding a host

py net.addHost('h3')
py net.addLink(s1, net.get('h3'))
py s1.attach('s1-eth3')
py net.get('h3').cmd('ifconfig h3-eth0 10.3')

Add hosts in adhoc mode

py net.addStation('sta4', ip6='fe80::3', position='120,10,0')
py sta4.setAdhocMode(intf='sta4-wlan0')

Try a simple exmaple

sudo python3 sta_ap_mode.py

This script setup 2 APs and 2STAs (each one associated with one ap). A wired connection is created between the 2APs.