-
Notifications
You must be signed in to change notification settings - Fork 986
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
PixHawk timestamp instead of ROS time #185
Comments
Hi, |
@mhkabir timesync would be ideal, I agree. What sort of accuracies can you achieve with it? |
We get microsecond precision. Most message timestamps are milliseconds since boot. |
ahh, excellent. would you be able to comment on when this will be available? |
Pretty soon hopefully. Synchronisation works already (check system_time.cpp ) The plugins just need to be updated. |
@mhkabir I'm still reading through system_time.cpp (actually it's sys_time.cpp right?) but as a preliminary question, is the idea to maintain the difference between ros time and PixHawk time and then use that offset in other plugins to set the correct timestamp? |
Yes On Wed, Jan 7, 2015 at 1:40 PM, Dinuka notifications@github.com wrote:
|
I testing PR #186. Setup:
Results: /mavros/imu/data ---
header:
seq: 4316
stamp:
secs: 4294967295
nsecs: 4294967295
frame_id: fcu
orientation:
x: -0.0430093572484
y: 0.00982332692738
z: -0.307822874007
w: 0.950420315269
orientation_covariance: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
angular_velocity:
x: 0.0105894114822
y: -0.0485693067312
z: -0.010234859772
angular_velocity_covariance: [1.2184696791468346e-07, 0.0, 0.0, 0.0, 1.2184696791468346e-07, 0.0, 0.0, 0.0, 1.2184696791468346e-07]
linear_acceleration:
x: 0.0641356706619
y: -0.864281475544
z: 10.0234670639
linear_acceleration_covariance: [8.999999999999999e-08, 0.0, 0.0, 0.0, 8.999999999999999e-08, 0.0, 0.0, 0.0, 8.999999999999999e-08]
---
header:
seq: 4317
stamp:
secs: 4294967295
nsecs: 4294967295
frame_id: fcu
orientation:
x: -0.0430188834137
y: 0.00986130963341
z: -0.307839425409
w: 0.950414129948
orientation_covariance: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
angular_velocity:
x: 0.00931540410966
y: -0.0476437397301
z: -0.00976792909205
angular_velocity_covariance: [1.2184696791468346e-07, 0.0, 0.0, 0.0, 1.2184696791468346e-07, 0.0, 0.0, 0.0, 1.2184696791468346e-07]
linear_acceleration:
x: 0.0641356706619
y: -0.864281475544
z: 10.0234670639
linear_acceleration_covariance: [8.999999999999999e-08, 0.0, 0.0, 0.0, 8.999999999999999e-08, 0.0, 0.0, 0.0, 8.999999999999999e-08]
---
/diagnostics -
level: 0
name: mavros: Time Sync
message: Normal
hardware_id: Mavlink
values:
-
key: Events in window
value: 100
-
key: Events since startup
value: 1361
-
key: Duration of window (s)
value: 10.007385
-
key: Actual frequency (Hz)
value: 9.992621
-
key: Last dt (ms)
value: 0.550172
-
key: Mean dt (ms)
value: -0.000695
-
key: Last system time (s)
value: 204.922809000
-
key: Time offset (s)
value: 1421389669.363838673 |
I placed this to /fs/microsd/etc/extras.txt: #!nsh
#
# USB MAVLink start
#
mavlink start -r 20000 -d /dev/ttyACM0 -x -m onboard
# Enable a number of interesting streams we want via USB
mavlink stream -d /dev/ttyACM0 -s PARAM_VALUE -r 200
usleep 100000
mavlink stream -d /dev/ttyACM0 -s MISSION_ITEM -r 50
usleep 100000
mavlink stream -d /dev/ttyACM0 -s NAMED_VALUE_FLOAT -r 10
usleep 100000
mavlink stream -d /dev/ttyACM0 -s OPTICAL_FLOW -r 10
usleep 100000
mavlink stream -d /dev/ttyACM0 -s VFR_HUD -r 20
usleep 100000
mavlink stream -d /dev/ttyACM0 -s ATTITUDE -r 20
usleep 100000
mavlink stream -d /dev/ttyACM0 -s ATTITUDE_CONTROLS -r 30
usleep 100000
mavlink stream -d /dev/ttyACM0 -s RC_CHANNELS_RAW -r 5
usleep 100000
mavlink stream -d /dev/ttyACM0 -s SERVO_OUTPUT_RAW_0 -r 20
usleep 100000
mavlink stream -d /dev/ttyACM0 -s POSITION_TARGET_GLOBAL_INT -r 10
usleep 100000
mavlink stream -d /dev/ttyACM0 -s LOCAL_POSITION_NED -r 30
usleep 100000
mavlink stream -d /dev/ttyACM0 -s MANUAL_CONTROL -r 5
# Exit shell to make it available to MAVLink
exit And checked that mavlink starts from fcu bootup (px4 quirk not needed, but enabled). Also strange operation errors:
|
Bug in |
common.xml tells that GPS_RAW_INT have time_usec stamps.
@mhkabir pull request closed, your patch rebased in master. Time is close to ros wall time in range ±5 ms by my quick test. |
Awesome.
|
* master: (52 commits) travis: update coverity scan plugin: sts_time: Code cleanup and codestyle fix. plugin: command: Quirk for older FCU's (component_id) plugin: rc_io: #185 Use synchronized timestamp. plugin: gps: #185 use synchronized timestamp uas: Fix ros timestamp calculation. plugin: add synchronisation to most plugins (fixed) readme: Add notes about coordinate frame conversions #49 travis: add gitter notification Added Gitter badge mocap_pose_estimate: Switched from pose to poseStamped. 0.9.4 Prepare correction release 0.9.4 plugin: sys_time: enable EMA 0.9.3 Prepare minor release 0.9.3 #182 Initiliser fix plugin: visualisation - Fixes CI build plugin: visualisation plugin: visualization minor patch ...
I think we may close this. |
I was looking at imu_pub.cpp and realized that imu/data_raw topic is published with the header timestamp set to ROS::Time::now()
(https://github.com/mavlink/mavros/blob/master/mavros/src/plugins/imu_pub.cpp#L250)
The MAVLINK_MSG_ID_HIGHRES_IMU message from PixHawk does contain a time_usec filed which actually represent the time at which the imu data was captured. For certain applications like for synchronizing a camera and IMU, it maybe useful to have that as the timestamp instead of the ros time.
I'm wondering whether this would qualify as a new feature request? I could do a PR for this, but the change in the code is really simple anyway.
The text was updated successfully, but these errors were encountered: