Adafruit Clue BLE + Sparkfun NBlox GPS + GoPro + Chrono DIY

2»

Comments

  • Hey @aol I'm having some odd issues with my diy payload, I cant seem to use the full 20 bytes, since the first 4 bytes are used for the id the remaining 16 bytes are not all addressable an are actually only 12 bytes?

    so when I view the source data in the app the first 4 bytes are pretty much always

    0x00 00 00 00

    then I'm missing my last 4 data bytes. I had assumed that when you said 20 bytes, that the id was 4 bytes which indicates these first 4 bytes, then that would give me 16 bytes of data.
  • currently its not blocking me I don't need the magnetos
  • edited July 2020
    Are you sure your data is aligned correctly? The first 4 bytes being always zeros tell me that you are reserving extra 4 bytes erroneously on top of the 4 bytes that goes for the ID.

    The payload maximum length should be 16. The maximum Bluetooth LE message payload is 20, and this protocol uses 4 first ones for the ID.
  • typedef struct
    {
    uint32_t id;
    uint64_t data;
    uint64_t data2;
    } diyRCMSG;
  • motoMessage.data |= ((uint64_t)(humi & 0xFF)) & 0x00000000000000FF;
    motoMessage.data |= ((uint64_t)(temp & 0xFF) << 8) & 0x000000000000FF00;
    motoMessage.data |= ((uint64_t)(brakePos & 0xFF) << 16) & 0x0000000000FF0000;
    motoMessage.data |= ((uint64_t)(throttlePos & 0xFF) << 24) & 0x00000000FF000000;
    motoMessage.data |= ((uint64_t)(rpm & 0xFF) << 32) & 0x000000FF00000000;
    motoMessage.data |= ((uint64_t)(pres & 0xFF) << 40) & 0x0000FF0000000000;
    motoMessage.data |= ((uint64_t)(accelx & 0xFF) << 48) & 0x00FF000000000000;
    motoMessage.data |= ((uint64_t)(accely & 0xFF) << 56) & 0xFF00000000000000;
    motoMessage.data2 |= ((uint64_t)(accelz & 0xFF)) & 0x00000000000000FF;
    motoMessage.data2 |= ((uint64_t)(gyrox & 0xFF) << 8) & 0x000000000000FF00;
    motoMessage.data2 |= ((uint64_t)(gyroy & 0xFF) << 16) & 0x0000000000FF0000;
    motoMessage.data2 |= ((uint64_t)(gyroz & 0xFF) << 24) & 0x00000000FF000000;
  • now I did have


    motoMessage.data2 |= ((uint64_t)(magx & 0xFF) << 32) & 0x000000FF00000000;
    motoMessage.data2 |= ((uint64_t)(magy & 0xFF) << 40) & 0x0000FF0000000000;
    motoMessage.data2 |= ((uint64_t)(magz & 0xFF) << 48) & 0x00FF000000000000;
  • but that doesn't actually make it to the app.
  • I'll try setting my structure alignment to be 4 bytes explicitly, I wonder if its packing it to 8 bytes and adding 4 bytes of padding after my id... good call will let you know if that is the problem, I hope so.
  • Just do sizeof(diyRCMSG) and you'll see if its 24 or 20...
  • I have no problems to use the full 16 bytes of payload. I am very happy that this was implemented so fast after my request :)
    The only trouble I have is when I send a CAN message before at least one GPS message has been sent. It is just not considering any GPS message afterwards... I always need to wait for my GPS which means I cannot start sending data when I am in the garage. There is some data I´d like see on the phone even when preparing before going out on the track :)
  • this was totally it, I set an explicit packing around my structure to 4 bytes and it resolved it.
  • I noticed while testing with my gopro that I have to manually hit record on the camera feed each time I start a session is that normal?
  • Hi @aol , I try to develop my DIY project and I just have a HM-11 BLE module, but unfortunately it is only support one char to notify (It simplify BLE GATT protocol via AT-command to control it, so it is limited).
    So, if I want to update my GPS information, can I just notify UUID3 without UUID4??
    Thanks for your project, it is so much fun.
  • @Iak For some reason I left it undocumented, but UUID4 is read only, RaceChrono does not expect it to be notified. This is to save bandwidth on the nRF platform.
  • @aol really!! Oh my... It is good news for me!!

    I almost to buy a new BLE module. Thanks.

    So, if I want to update GPS data with 10hz, I just continue notify the GPS data (coming from sensor) without precise scheduling (like a timer interrupt, etc.), am I right?

  • UUID3 need to be notified and UUID4 is polled when needed. The update rate is figured out from the timestamps. You can notify when ever, irregular or regular.
  • Got it, thanks for the information~

  • laklak
    edited February 2021
    Hi, @aol there is another question. On your document, you indicate the unit of speed is in km/h. But your sample code (https://github.com/aollin/racechrono-ble-diy-device/blob/master/main/main.ino, rely on Adafruit_GPS.speed) is pass through the knot.

    Have I misunderstood anything? Which one is correct?

    reference, https://github.com/adafruit/Adafruit_GPS/blob/master/src/Adafruit_GPS.h#L184
    line 184, "nmea_float_t speed; ///< Current speed over ground in knots"
  • edited February 2021
    @lak it should be in km/h. I might have a bug in my example device code.
  • Got it, thanks.
  • excuse me, let me double confirm that.
    If I only reference to RMC, I need to convert the speed to km/H, but if I also reference to VTG, that I can just update the speed without convert ($GPVTG,<1>,T,<2>,M,<3>,N,<4>,K,<5>*hh // Index <4>), is it right?
  • Ok, I try it .. XD. Thanks.
  • Finally got out and got really good data and video

  • A couple of things I noticed,

    Lean Angle
    Heading
    Speed

    I have a 9 axis IMU as well as a GPS, I should be able to get lean angle, heading and speed, however, there doesn't appear to be an easy way to extrapolate these although I haven't fully investigated it yet.

  • Also is there a way to do the video and datalog processing on the pc, rather than on the android device, to produce the video overlay export? Not sure if there is a pc ( x64 windows ) version of the application or that's something I would have to run in a virtual machine hosting a mac or android device?
  • @JmQ Some people run RaceChrono on emulators, but I'd just get a powerful tablet. The hardware power required by the video export is mostly video encoding, and the mobile devices tend to do that better than PCs...
  • yeah my mobile device just kept crashing when copying the video files around - got frustrating I think a chromebook would probably do it no problem or an apple macbook or something.
Sign In or Register to comment.