!!!danger Out of Date
This page is out of date and is currently being reworked. For any questions, reach out to club leadership.
!!!

!!!danger Approved Drivers
_Drivers_ of the vehicle need to be preapproved by the ECE department prior to operating the vehicle.
Do not seek out approval yourself, ask a lead.

_Passengers_ do not need to be preapproved. As a passenger, make sure your driver is preapproved.
!!!

1. Follow the steps [here](<~/vehicle/power-delivery#Battery Power>) to initialize the server for battery power.

!!!info Drive Log
Make sure to fill out the [drive log](https://forms.gle/mpmua719Sb4GPZUN9) before you operate the vehicle.
!!!

2. Connnect to the server via SSH over the ethernet cable in the front passenger seat and initialize the docker:

   ```bash
   # ssh connection to the vehicle
   ssh autodrive@192.168.1.1

   # start the docker
   cd docker/
   ./run.sh
   ```

   You should then see a modified prompt for the docker: `[DOCKER]`

3. Start a `tmux` session inside the docker container. The [default keybinds](https://man7.org/linux/man-pages/man1/tmux.1.html#:~:text=DEFAULT%20KEY%20BINDINGS%20top,in%20the%20current%20window%20forwards.)
   are configured.
   For quick reference:

   ```Keybinds
   CTRL-B + " : Split window horizontally
   CTRL-B + % : Split window vertical
   CTRL-B + C : Create a new window
   CTRL-B + N : Move to next window
   CTRL-B + index : Move to window at index, ex: CTRL-B + 0 will move to the first created window
   ```

4. Use roslaunch to launch the system for data collection in one window/pane:

   ```bash
   roslaunch bolt_launch data_collection.launch
   ```

5. Using the topic analyzer TUI from a separate tmux window/pane:

   1. Load the data collection configuration file
   2. Ensure that all topics listed are publishing at the target rate (besides CAN topics and Piksi, those are published when outside/moving)
   3. If you see a topic struggling, or want to verify the topic data, focus that topic

6. If you have ensured the integrity of topics, move the car outside.

7. Start up the data collection script in a separate tmux window/pane:

   ```bash
    ./tools/data_collection.sh bag_name
   ```

   - `bag_name` should be descriptive relative to whats happening with the weather. Examples:
     1. `campus_snow` for snowy weather
     2. `campus_rain` for rainy weather
     3. `campus_sunny` for sunny weather

8. Drive the planned route.

<figure align="middle">
    <img src="~/static/vehicle/data_collection_route.png"
         alt="Route for Data Collection" height="1500" width="700">
    <figcaption>Data Collection Route</figcaption>
</figure>

9. Park the vehicle in the marked area, and **DO NOT TURN OFF THE CAR**.

!!!danger Turning off the Car
If you turn off the vehicle prior to turning off the dev server, the batteries will drain.
!!!

10. Plug the vehicle into lab ethernet, and rsync the bags with our campus storage:
    ```bash
    ssh -L 9922:davinci.egr.msu.edu:22 {username}@compute01.egr.msu.edu
    rsync --progress -av -e "ssh -p 9922" /mnt/internal-datasets/{bag_name}*.bag \
      {username}@localhost:/egr/research-canvas/raw_datasets/campus/
    ```
