# Line Following Robot Dashboard

This folder contains all the source files to validly run the
Python dashboard for visualizing the Line Following Robot (LFR)
Digital Shadow (DS).

It is important that `ROS2` is enabled in the environment that
runs the main code. This will also enable the `rclpy` module.

### Properties
This dashboard does the following things:

1. It reads a depth image from ROS2 and displays it using the 
   bone colormap.
2. It analyzes the depth image in order to identify the robot's
   state (position and heading). This information is transferred
   to another ROS2 connection.
3. The sensor data is read and visualized in a history plot.
4. The robot states (both the system under study and the model)
   are read from ROS2 and visualized in the plot (if they exist).

### How to Compile
For the dashboard to work, it is required that the `lfr_msgs`
package for ROS2 communication is compiled. This package is
located inside the `ros2` folder. In order to compile, execute
the following steps.

1. Open a clean environment (i.e., terminal, powershell...). For
   _Windows_, this must be a _Visual Studio Command Prompt_ to
   allow  for compilation.
2. Make sure ROS2 is enabled by sourcing the global `setup` or
   `local_setup` script. This is presumably located in the
   `/opt/` folder.
3. Execute one of the following commands in the `ros2` folder
   (choose which one applies):
   <br/>**Windows:** `colcon build --merge-install --packages-select lfr_msgs`
   <br/>**Linux/Mac OS:** `colcon build --packages-select lfr_msgs`

### How to Run
1. Open a clean environment (i.e., terminal, powershell...).
   This may be the same environment as used for the compilation.
2. Enable ROS2 (and the `lfr_msgs` package) by sourcing the
   `setup` or `local_setup` script from `ros2/install`.
   _You may need to compile this package in the `ros2` directory
   first (see above)._
3. Launch the `main.py` script from the environment.