Examples

In order to help test and experiment with Hermes some command line example have been created and published on the git repository. This has multiple goals:

The first goal is to help with the protocol adoption. With the credentials and information you are given by Bestmile, you can use those tools to try the connection, information and understanding of the protocol first. For example a first step would be to publish some telemetry data for a vehicle to ensure that everything is fine: connectivity, api token, vehicle id, etc

The second goal is that those tools can serve as examples on how to start using the protocol. Even though we wrote some tutorials to get developers started, having some concrete example is often welcome.

How to build the tools

The tools are available under the examples folder of the hermes repository. You will need to fetch the code first:

git clone git@github.com:Bestmile/hermes.git

You will then need to install g++, grpc and protobuf on your machine. Please refer to your distribution documentation or to those pages:

Once your system requirements are ready, just use the Makefile to build the tools:

cd examples/cpp/
make

Publish vehicle telemetry (telemetry_client)

This example allows you to publish telemetry data for a given vehicle. It will use the Telemetry/PostTelemetry endpoint of HermesV2.

Example of use:

./telemetry_client  -s server:port -k API_TOKEN -v vehicle -c 7 -p 46.51576,6.60821

This will post telemetry on server for vehicle vehicle with a speed of 7 meters per seconds and a position of 46.51576,6.60821.

For more details see Post vehicle telemetry with Hermes using C++

Simulate a vehicle (vehicle)

This tool simulates a vehicle. It will connect to a management stream, wait for commands, execute them and report the status back.

The vehicle behavior is very simple: for a travel command, the vehicle moves to the destination following a straight line from its current position to the destination. Any other command will immediately be reported as done.

Example of use:

./vehicle -s localhost:9050 -k API_TOKEN -v VEHICLEID -p 46.51576,6.60821

This will start a vehicle at the given position and execute the commands sent by the orchestrator.

For more details see Get a vehicle managed with HermesV2 using C++