## Setup network
Switch on power supply and all nucs, including the one near can
On nuc-planner
```bash!
roscore # do not let this shutdown till you shutdown car
# <new-terminal>
cd alive-dev
# perform necessary git commands
./top_level_build.bash # this uses ssh -X and gives terminal windows to monitor all systems
```
| IP | Hostname | Password | Used For |
|:--------------------:|:------------:|:--------- |:-------------------------------- |
| nuc@192.168.1.101 | nuc-planner | nuc | ROS Master, Localization, Estimation, P&C |
| nuc3@192.168.1.201 | nuc3-yolo | nuc3-yolo | RoadPlane estimation |
| nuc2@192.168.1.200 | nuc2-desktop | nuc3456 | Connected to CAN, runs Ubuntu 18 |
| ~~nuc@192.168.1.202~~ | ~~nuc-pc~~ | ~~nuc~~ | ~~Pointcloud processing~~ |
| nvidia@192.168.1.203 | ubuntu | orin@agx | GPU - AGX runs yolop model |
## Setting up CAN
Go to nuc2-desktop
```bash!
sudo ip link add can0 type can
sudo -S ip link set can0 type can bitrate 500000
sudo -S ip link set can0 up # green light should blink on the usb can interface connected in the front of the car
```
IF ANY OF THE ABOVE STEPS ERRORS:
1. Plugin the USB properly and retry from top
2. Load systec_can as shown below and retry from top
```bash!
cd systeccan # from https://www.systec-electronic.com/en/company/support/driver
make -j4
sudo make firmwareinstall
sudo make modulesinstall
sudo modprobe systeccan
```
## Running CAN
```bash!
cd alive-dev
rosrun can can_node # dumps a lot of stuff to terminal
# open new terminal
python src/e2o/scripts/e2o_odom.py
rostopic hz /odom_can #to check
```
## Running LIDAR and camera
On nuc-planner
```bash!
cd alive-dev/sensor_setup
roslaunch all_sensors.launch platform:=car
```
## Running MAVROS for GPS and IMU
On nuc-planner
```bash!
./home/nuc/Downloads/QGroundControl.AppImage # (or double click), this setups tty to get mavlink data and lets you check gps lock
# ctrl c or exit q ground control
roslaunch mavros apm.launch
# new terminal to check
rostopic hz /mavros/imu/data #to check, should be above 20 hz
# if data rate slow rosrun mavros mavsys rate --all 100
```
## Starting Localisation, Estimation and Planning
```bash!
# new terminal
roslaunch floam floam_velodyne.launch use_sim_time:=False
# new terminal
roslaunch localisation_fusion ekf.launch use_sim_time:=False
# new terminal
roslaunch top_level.launch simulation_state:=False use_sim_time:=False platform:=e2o three_lidar:=True remote_launch:=True
```
GUI Instructions
1. Use the floam velodyne rviz window (loads the full map) and set the green 2D pose where the vehicle currently is
2. Wait for localisation to stabilise
3. Set purple goal pose to set goal
4. Observe /trajectory_rollout and /trajectory_rollout_vis to view debug messages
## Starting autonomous run
### ALL STEPS MUST BE DONE AGAIN IN THE SAME ORDER FOR EACH RUN
1. On a new terminal in the nuc2-desktop / nuc-can
```bash!
# if you want to do autonomous testing, to be reset on each run
rosrun e2o e2o_node_auto # this has an internal pid control, initially it forces the steering wheel to neutral
# wait atleast 10 seconds before starting pid control
# kill this to force stop the car
```
2. Press the green button to go into auto mode on the can dashboard near passenger seat
3. Give a verbal warning to the driver before pressing enter on the following command on the planner-nuc because in some cases it can respond badly
```bash!
# wait till the window in 1. has no warnings
roslaunch cascaded_pid pi_controller.launch teb:=False simulation_state:=False
# teb = false is to use the default planner, teb = True means use reverse planner
```
## Record bagfile
Option -b 0 ensures that we maintain an infinite size buffer and messages are not dropped
```bash!
rosbag record -b 0 /tf /lidar103/velodyne_packets /lidar102/velodyne_packets /lidar104/velodyne_packets /mavros/imu/data /mavros/global_position/global /odom_can /odom /odometry/filtered/global /pose /velodyne_obstacles /trajectory_rollout /pid_info /details /can_node/e2o_info /info_to_e2o_debug /realsense_cam/color/image_raw -o "name"
```
To record all topics (**use only when required**)
```
rosbag record -a -b 0 -o "name"
```