Skip to content

Commit 98aa99f

Browse files
committed
ArduPilotPlugin: fix initial value and import
1 parent b7f2af5 commit 98aa99f

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/ArduPilotPlugin.cc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424

2525
#include <chrono>
2626
#include <functional>
27+
#include <memory>
2728
#include <mutex>
2829
#include <string>
2930
#include <sstream>
31+
#include <utility>
3032
#include <vector>
3133

3234
#include <gz/common/SignalHandler.hh>
@@ -121,7 +123,7 @@ class Control
121123
public: std::string cmdTopic;
122124

123125
/// \brief The joint being controlled
124-
public: gz::sim::Entity joint;
126+
public: gz::sim::Entity joint{gz::sim::kNullEntity};
125127

126128
/// \brief A multiplier to scale the raw input command
127129
public: double multiplier = 1.0;
@@ -231,7 +233,7 @@ class gz::sim::systems::ArduPilotPluginPrivate
231233
public: uint16_t fdm_port_in{9002};
232234

233235
/// \brief The port for the SITL flight controller - auto detected
234-
public: uint16_t fcu_port_out;
236+
public: uint16_t fcu_port_out{0};
235237

236238
/// \brief The name of the IMU sensor
237239
public: std::string imuName;
@@ -343,7 +345,7 @@ class gz::sim::systems::ArduPilotPluginPrivate
343345

344346
/// \brief Max number of consecutive missed ArduPilot controller
345347
/// messages before timeout
346-
public: int connectionTimeoutMaxCount;
348+
public: int connectionTimeoutMaxCount{};
347349

348350
/// \brief Transform from model orientation to x-forward and z-up
349351
public: gz::math::Pose3d modelXYZToAirplaneXForwardZDown;
@@ -352,7 +354,7 @@ class gz::sim::systems::ArduPilotPluginPrivate
352354
public: gz::math::Pose3d gazeboXYZToNED;
353355

354356
/// \brief Last received frame rate from the ArduPilot controller
355-
public: uint16_t fcu_frame_rate;
357+
public: uint16_t fcu_frame_rate{};
356358

357359
/// \brief Last received frame count from the ArduPilot controller
358360
public: uint32_t fcu_frame_count = UINT32_MAX;
@@ -1453,9 +1455,9 @@ bool gz::sim::systems::ArduPilotPlugin::ReceiveServoPacket()
14531455
}
14541456

14551457
// 16 / 32 channel compatibility
1456-
uint16_t pkt_magic{0};
1457-
uint16_t pkt_frame_rate{0};
1458-
uint32_t pkt_frame_count{0};
1458+
uint16_t pkt_magic{};
1459+
uint16_t pkt_frame_rate{};
1460+
uint32_t pkt_frame_count{};
14591461
std::array<uint16_t, 32> pkt_pwm{};
14601462
ssize_t recvSize{-1};
14611463
if (this->dataPtr->have32Channels)

0 commit comments

Comments
 (0)