mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-14 15:23:34 +08:00
chore(uxrce_dds_client): merge SYNCC and SYNCT into CTRL
Signed-off-by: Beniamino Pozzan <beniamino.pozzan@gmail.com>
This commit is contained in:
@@ -85,26 +85,17 @@ parameters:
|
||||
max: 2
|
||||
default: 0
|
||||
|
||||
UXRCE_DDS_SYNCT:
|
||||
UXRCE_DDS_CTRL:
|
||||
description:
|
||||
short: Enable uXRCE-DDS timestamp synchronization
|
||||
long: When enabled, uxrce_dds_client will synchronize the timestamps
|
||||
of the incoming and outgoing messages measuring the offset
|
||||
between the Agent OS time and the PX4 time.
|
||||
type: boolean
|
||||
category: System
|
||||
reboot_required: true
|
||||
short: UXRCE_DDS_CLIENT control flags
|
||||
long: 'Set bits in the following positions to enable: 0 : timestamp sync 1 : system time sync'
|
||||
type: bitmask
|
||||
bit:
|
||||
0: Timestamp Synchronization
|
||||
1: System Clock Synchronization
|
||||
default: 1
|
||||
|
||||
UXRCE_DDS_SYNCC:
|
||||
description:
|
||||
short: Enable uXRCE-DDS system clock synchronization
|
||||
long: When enabled along with UXRCE_DDS_SYNCT, uxrce_dds_client will
|
||||
set the system clock using the agents UTC timestamp.
|
||||
type: boolean
|
||||
category: System
|
||||
reboot_required: true
|
||||
default: 0
|
||||
min: 0
|
||||
max: 3
|
||||
|
||||
UXRCE_DDS_TX_TO:
|
||||
description:
|
||||
|
||||
@@ -203,7 +203,7 @@ void UxrceddsClient::deinit()
|
||||
bool UxrceddsClient::setupSession(uxrSession *session)
|
||||
{
|
||||
_participant_config = static_cast<ParticipantConfig>(_param_uxrce_dds_ptcfg.get());
|
||||
_synchronize_timestamps = (_param_uxrce_dds_synct.get() > 0);
|
||||
_synchronize_timestamps = (_param_uxrce_dds_ctrl.get() & static_cast<int32_t>(Ctrl::kTimestampSync));
|
||||
|
||||
bool got_response = false;
|
||||
|
||||
@@ -331,7 +331,7 @@ bool UxrceddsClient::setupSession(uxrSession *session)
|
||||
if (_timesync.sync_converged()) {
|
||||
PX4_INFO("synchronized with time offset %-5" PRId64 "us", session->time_offset / 1000);
|
||||
|
||||
if (_param_uxrce_dds_syncc.get() > 0) {
|
||||
if (_param_uxrce_dds_ctrl.get() & static_cast<int32_t>(Ctrl::kSystemClockSync)) {
|
||||
syncSystemClock(session);
|
||||
}
|
||||
|
||||
@@ -686,7 +686,7 @@ void UxrceddsClient::run()
|
||||
if (uxr_sync_session(&session, 10) && _timesync.sync_converged()) {
|
||||
last_sync_session = hrt_absolute_time();
|
||||
|
||||
if (_param_uxrce_dds_syncc.get() > 0) {
|
||||
if (_param_uxrce_dds_ctrl.get() & static_cast<int32_t>(Ctrl::kSystemClockSync)) {
|
||||
syncSystemClock(&session);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,12 +203,16 @@ private:
|
||||
perf_counter_t _loop_perf{perf_alloc(PC_ELAPSED, MODULE_NAME": cycle")};
|
||||
perf_counter_t _loop_interval_perf{perf_alloc(PC_INTERVAL, MODULE_NAME": cycle interval")};
|
||||
|
||||
enum class Ctrl : uint8_t {
|
||||
kTimestampSync = (1 << 0),
|
||||
kSystemClockSync = (1 << 1)
|
||||
};
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
(ParamInt<px4::params::UXRCE_DDS_DOM_ID>) _param_uxrce_dds_dom_id,
|
||||
(ParamInt<px4::params::UXRCE_DDS_KEY>) _param_uxrce_key,
|
||||
(ParamInt<px4::params::UXRCE_DDS_PTCFG>) _param_uxrce_dds_ptcfg,
|
||||
(ParamInt<px4::params::UXRCE_DDS_SYNCC>) _param_uxrce_dds_syncc,
|
||||
(ParamInt<px4::params::UXRCE_DDS_SYNCT>) _param_uxrce_dds_synct,
|
||||
(ParamInt<px4::params::UXRCE_DDS_CTRL>) _param_uxrce_dds_ctrl,
|
||||
(ParamInt<px4::params::UXRCE_DDS_TX_TO>) _param_uxrce_dds_tx_to,
|
||||
(ParamInt<px4::params::UXRCE_DDS_RX_TO>) _param_uxrce_dds_rx_to
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user