Lap timer

Support for creating custom user applications on the VESC.
Posts: 10
Joined: 08 Mar 2016, 16:58

Lap timer

Postby RSR » 10 Jun 2017, 22:36

I have been using RaceChrono on Android phone as GPS laptimer during practice on a racetrack, but not with VESC.
I would like to use the laptimer to display and record data from VESC.

Is it done before?: Have you connected VESC to a lap timer? If so, can you please help me set it up correctly?
If not; can someone please point me in the right direction or help me write a VESC app for the lap timer.
It could be more ideal to use an open source lap timer (instead of RaceChrono), but I do not yet know about any good ones...

My status/starting point:
  • Hardware is connected: I have my VESC 4.12 connected via Bluetooth (HC06 module at 115200bps) to the Android phone, and the VESC-monitor app is able to display values
  • RaceChrono uses a text string format with keys $RC1, $RC2 and $RC3 ... iy-loggers
  • I have not written C/C++ code since years, but at least I am able to compile and load VESC firmware (via my Linux PC)

Posts: 10
Joined: 08 Mar 2016, 16:58

Re: Lap timer

Postby RSR » 11 Jun 2017, 17:37

I made a program to check the formatting, it is probably still not correct, but it compiles and runs in terminal (not on VESC).
Plan: Follow instruction on ... lications/ and make "app_rc2.c" based on this and app_uartcomm.c

Code: Select all

#include <stdio.h>
#include <string.h>
#include <stdint.h>

int checksum(const char *s) { // from
  int c = 0;
  while(*s)  c ^= *s++;
  return c;

int main()
   char buffer[1024];
   uint16_t count = 0;
   int rpm = 35000; //value for testing
   float ubat=45.2;  //value for testing
   float temp_fet=77.32;  //value for testing
   float iq=130.1111;  //value for testing

   for (;;)
       sprintf(buffer,"$RC2,,%05u,,,%i,,%4.1f,%4.1f,%4.1f,,,,,,", count++, rpm, ubat, temp_fet, iq);
       sprintf(buffer+strlen(buffer),"*%02X\n\r", checksum(buffer) );

Return to “Custom Applications”

Who is online

Users browsing this forum: No registered users and 1 guest