This project acts as a bridge between a VEX robot and an mqtt broker. The output from this broker can then be sent to listened to by a Grafana instance.
You can find more information about those services here:
Currently cargo install is the only supported method for installation. This may change once there is a stable release.
cargo install --git https://github.com/BattleCh1cken/loginator
Make sure that $HOME/.cargo
is added to $PATH
.
You can then run it like so:
loginator --help
Once you've installed, generate a new config by running the program once.
loginator
The configuration file can be found at:
- Linux:
/home/USERNAME/.config/loginator/
- Windows:
%appdata%\loginator\config\
Once you have your config you'll need to configure it to match your brain. The first thing you'll need to do is make your V5 brain bluetooth capable. Follow these steps to enable bluetooth.
Once you've done that, connect your radio and turn your brain on. Then run:
loginator list-brains
This will print out all of the available brains. Change the brain name in your config file to match your brain's name. The name can be changed by changing your robot name.
# config.toml
brain_name = 'VEX_V5'
Then run:
loginator display-code
This will display the brain's bluetooth 4 digit authentication code on it's LCD screen. Change the code in the config to match.
# config.toml
brain_code = '0000'
Now you'll need to configure your routes. These are the MQTT topics and labels for the data that the brain will be emitting.
You'll then need to set your brain up to emit telemetry data. Install the LemLib template.
You can log telemetry like so:
#define TEMPERATURE_ROUTE 0
lemlib::telemetrySink()->debug("{},{},{}", TEMPERATURE_ROUTE, motor1.get_temperature(), motor2.get_temperature());
// Currently the loginator will only work with debug messages
The loginator expects data in the form of numbers separated by commas. The first digit corresponds with the route, and the rest are the actual data. In order to use this data we'd have to define the following route in our config.toml:
#config.toml
routes = [
[
'motors/temperature',
[
'First motor',
'Second motor',
],
]
In this case we specified 0 as our route, meaning that the loginator will use the first route in the array of routes.
Instructions to install Mosquitto can be found here.
You can verify that its working by running:
mosquitto_sub -h localhost -t motors/temperature
Instructions to install Grafana can be found here.
Once it's installed, you'll need to configure your dashboard. Add MQTT as a datasource and create a new visualization.
Click apply and you're good to go!
Run:
loginator connect
The loginator will now connect to the brain with your configured name. All messages sent via LemLib telemetry will now be sent to MQTT!