Rust: Pushing Limits with 100 Hz Accelerometer Control

Поділитися
Вставка
  • Опубліковано 29 гру 2024

КОМЕНТАРІ • 14

  • @majorrawdawg
    @majorrawdawg 8 місяців тому +2

    Thanks for the shout out brother! Excited to build.

    • @dario.lencina
      @dario.lencina  8 місяців тому

      Your project is next, I am ramping up production for the season bro

  • @mattcraftien974
    @mattcraftien974 7 місяців тому +1

    I think the ADXL 345 can handly reach 4kHz sampling rate in FIFO mode.

    • @dario.lencina
      @dario.lencina  7 місяців тому

      Nice! I thought that you could get 3200Hz max, would you mind sharing the rest of your config?

  • @cagedgandalf3472
    @cagedgandalf3472 7 місяців тому +1

    I am quite new to Rust and have only used ready made libraries for MPU6050 in arduino using C. I'm having a hard time understanding how fast this is, compared to the libraries that I have mentioned. Also, how different is the ADXL compared to the MPU. I apologize if I'm missing context here but can you inform me? I'm planning to use an IMU for a wheeled biped project and this info might be useful.

    • @dario.lencina
      @dario.lencina  7 місяців тому

      I am shopping with my mom but I’ll get back to you asap!!

    • @dario.lencina
      @dario.lencina  7 місяців тому

      Hello,
      It's great that you're exploring different sensors for your wheeled biped project! I'd be happy to help clarify the differences and the performance aspects.
      MPU6050 vs. ADXL Sensors:
      Regarding the sensors, the MPU6050 and ADXL series (like ADXL345) are somewhat different in their capabilities. The MPU6050 is a 6-axis IMU, which includes a 3-axis accelerometer and a 3-axis gyroscope. This allows it to measure both acceleration and rotational motion, which is particularly useful for balancing applications in robotics.
      On the other hand, the ADXL series typically includes accelerometers only. For instance, the ADXL345 is a 3-axis accelerometer, which means it does not provide gyroscope data. It measures linear acceleration but won’t be able to measure rotation on its own.
      Performance and Libraries:
      In terms of speed, Rust's performance is generally comparable to C, owing to its ability to operate at a low level with efficient memory use. This means that if you're switching from C to Rust, you should expect similar execution speeds. However, the actual performance can also depend on the specific libraries and how they're implemented.
      I hope this helps, and feel free to ask more questions as you progress with your project!

  • @martinpalsson490
    @martinpalsson490 8 місяців тому +1

    In Rust, accelerometer controls you!
    Btw, SPI is Serial Peripheral Interface. If you say Serial Port, most embedded guys would thing you're reffering to U(S)ART / RS232

    • @dario.lencina
      @dario.lencina  8 місяців тому +1

      Thank you for pointing out the distinction! I appreciate the clarification about SPI (Serial Peripheral Interface) and its differentiation from serial ports typically associated with UART or RS232. It's crucial to use precise terminology, especially in technical discussions like these, to avoid any confusion. Thanks for keeping the details sharp!

  • @ninjasploit
    @ninjasploit 8 місяців тому +1

    Hey! I'm not that familiar with Rust but in the code I see you have a 10ms sleep in your main loop which would limit you to the 100hz sample rate you're getting, would be interesting to know if you'd be able to get even faster results if you lower the sleep duration? And also, in your video you're logging the results (can't seem to find the logging in your code though so might be a log-breakpoint you set?), from previous experience with C# logging would limit the processing speed quite a bit when ran on the same thread as whatever code was running since it would be blocking
    Anyways, pretty cool!

    • @dario.lencina
      @dario.lencina  8 місяців тому +1

      Yes! I was throttling myself I removed that code and instead o am streaming the data over udp 🤷‍♂️🤷‍♂️🤷‍♂️

    • @ninjasploit
      @ninjasploit 8 місяців тому +1

      @@dario.lencina Yeah I noticed the UDP communication code, that makes sense then! Really curious to see what the upper limits would be without any delay hehe

    • @dario.lencina
      @dario.lencina  7 місяців тому +1

      Heck yeah, I am putting together a serious benchmark for the long form video

  • @dario.lencina
    @dario.lencina  8 місяців тому

    Here's the code: github.com/security-union/rust-projects-to-inspire-you