mirror of
https://github.com/okalachev/flix.git
synced 2025-07-29 04:19:00 +00:00
Keep the t variable monotonic in the simulation
Otherwise it causes stopping sending MAVLink and other bugs
This commit is contained in:
parent
abcc9b96de
commit
a94687bd56
@ -134,7 +134,8 @@ void delay(uint32_t ms) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned long __micros;
|
unsigned long __micros;
|
||||||
|
unsigned long __resetTime = 0;
|
||||||
|
|
||||||
unsigned long micros() {
|
unsigned long micros() {
|
||||||
return __micros;
|
return __micros + __resetTime; // keep the time monotonic
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ public:
|
|||||||
|
|
||||||
void OnReset() {
|
void OnReset() {
|
||||||
attitude = Quaternion(); // reset estimated attitude
|
attitude = Quaternion(); // reset estimated attitude
|
||||||
|
__resetTime += __micros;
|
||||||
gzmsg << "Flix plugin reset" << endl;
|
gzmsg << "Flix plugin reset" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user