Log timestamped data

Hi guys!

Is it possible to log data (i.e. estimated velocity) with an accurate timestamp, so I know exactly at which point in time the data was recorded? And if so, what is the maximum frequency I can log data with?

So far I have found this topic Export data to CSV file with which help I was able to write the data to a CSV file, but I did not find a way to get the timestamp of the data.

My goal would be to log data with a fixed period of one microsecond or less.

Thanks for your help

I’m not sure we even have a timer module running in the background.

Maximum logging frequency is about 4kHz, or 250 microseconds, via USB, but that’s not particularly consistent. You can use UART or CAN to get a more consistent rate but 1 microsecond is going to be a tall order, especially since our control loop runs every 125 microseconds :slight_smile:

There is an “oscilloscope” that you can use to log data on the ODrive at 8kHz and then dump to Python, but it’s not timestamped.

1 Like

Oh my bad I meant 1 millisecond, not microsecond. One microsecond would be really great though. :slight_smile:

So I will try to log data at 8 kHz with the oscilloscope. Those measures are equally spaced in time, right? Is there somewhere an instruction on how to use the oscilloscope?

In my tests, the 8khz update rate appears very consistent. I wasn’t specifically testing for that, though.

I seem to recall there’s a counter property on the top level odrv0 object that appears to be incremented with every controller loop. It’s not a timer per se, in that it starts whenever the odrive is powered up, but it probably increases at a rate close to wall clock. That might be worth experimenting, depending on your requirements.

What kind of timeframe are you dealing with? What motor speed? How soon/often do you need the feedback? The system I might design to monitor, say, releases of a motor-powered trebuchet would be different than an autonomous vehicle. Perhaps you could put an encoder on some other part of your system, and observe the relationship you care about directly, rather than reading it out of log files post-hoc?

Sorry for my sporadic replies, I am having exams at the moment and therefore I have only very limited time to work on this project.

Do you mean the odrv0.system_stats.uptime? I have been thinking about using this one, but then I though that between the read of the velocity and the timer there is a delay. So I would never get a very accurate timestamp.

Final application will be a drone like UAV. But right now I am just testing different motors with different propellers on them regarding their acceleration, respectively how fast they can build up thrust. Because the application demands a fast change in thrust I am trying to reach the maximum possible, so right now I’d say the faster the better.