Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/timestamps on sd cards #100

Merged
merged 6 commits into from
Dec 13, 2023

Conversation

JWillegers
Copy link
Contributor

Updating REM packets to version 5.
Adding code on how timestamps are set for REMFeedback and REMStateInfo

DarioC02 and others added 4 commits November 9, 2023 15:22
…on the recieved packet and write it to the transmitting packets which we are sending. In the control loop, to avoid the problem where we write multiple times to sd card with the same time stamp we increament at the end of the control loop byy 10
@JWillegers JWillegers linked an issue Dec 7, 2023 that may be closed by this pull request
Core/Src/robot.c Outdated
@@ -831,6 +833,11 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
if(htim->Instance == TIM_CONTROL->Instance) {
if(!ROBOT_INITIALIZED) return;

if (!unix_initalized & activeRobotCommand.timestamp != 0){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be && ? I guess technically it works

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also. why is not always the timestamp used from the latest RobotCommand? Would that not be more accurate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also. why is not always the timestamp used from the latest RobotCommand? Would that not be more accurate?

A request from the control subteam.
For analyzing the acceleration of the robot the difference between 2 timestamps of 2 consecutive packets should align with the real world. So if in real time 10ms has passed, that should be reflected in the timestamp. But if you always take the most recent timestamp from robotCommand you will see from time to time that 20ms has passed. This is due to the fact that the incoming timestamp is rounded to the nearest 10. Even if you would not round it will be a problem, as the incoming packets come at 60Hz, whilst the robotFeedback runs at 100Hz. Meaning that there will still be some misalignment between time stored in the packet and real time passed.

Copy link
Member

@emielsteerneman emielsteerneman Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand what you are saying. However, a timestamp should not be needed between consecutive packets stored on the SDCard because we know they are 10ms apart. However, if the clock between a robot and the computer are running at different speeds, then at some point, data on the SDCard and data from the vision system can become misaligned, which might make it useless.

If the latest timestamp is used, SDCard data will always be able to be overlayed with other data such as vision, while also being able to accurately measure acceleration because we know packets are 10ms apart.

@JWillegers JWillegers merged commit 27a9d90 into development Dec 13, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Timestamps on SD card
2 participants