Skip to content

Commit

Permalink
Fix some more deprecations and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasVautherin committed Oct 5, 2020
1 parent c9e1967 commit cbd5e19
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 29 deletions.
2 changes: 1 addition & 1 deletion examples/fly_multiple_drones/fly_multiple_drones.cpp
Expand Up @@ -115,7 +115,7 @@ int main(int argc, char* argv[])
}
}

std::atomic<unsigned> num_systems_discovered{0};
std::atomic<size_t> num_systems_discovered{0};

std::cout << "Waiting to discover system..." << std::endl;
mavsdk.subscribe_on_change([&mavsdk, &num_systems_discovered]() {
Expand Down
11 changes: 5 additions & 6 deletions examples/multiple_drones/multiple_drones.cpp
Expand Up @@ -18,7 +18,7 @@ using namespace mavsdk;
using namespace std::this_thread;
using namespace std::chrono;

static void takeoff_and_land(System& system);
static void takeoff_and_land(std::shared_ptr<System> system);

#define ERROR_CONSOLE_TEXT "\033[31m" // Turn text on console red
#define TELEMETRY_CONSOLE_TEXT "\033[34m" // Turn text on console blue
Expand All @@ -34,7 +34,7 @@ int main(int argc, char* argv[])

Mavsdk mavsdk;

int total_udp_ports = argc - 1;
size_t total_udp_ports = argc - 1;

// the loop below adds the number of ports the sdk monitors.
for (int i = 1; i < argc; ++i) {
Expand All @@ -46,7 +46,7 @@ int main(int argc, char* argv[])
}
}

std::atomic<signed> num_systems_discovered{0};
std::atomic<size_t> num_systems_discovered{0};

std::cout << "Waiting to discover system..." << std::endl;
mavsdk.subscribe_on_change([&mavsdk, &num_systems_discovered]() {
Expand All @@ -70,8 +70,7 @@ int main(int argc, char* argv[])

std::vector<std::thread> threads;

for (auto uuid : mavsdk.system_uuids()) {
System& system = mavsdk.system(uuid);
for (auto system : mavsdk.systems()) {
std::thread t(&takeoff_and_land, std::ref(system));
threads.push_back(std::move(t));
}
Expand All @@ -82,7 +81,7 @@ int main(int argc, char* argv[])
return 0;
}

void takeoff_and_land(System& system)
void takeoff_and_land(std::shared_ptr<System> system)
{
auto telemetry = std::make_shared<Telemetry>(system);
auto action = std::make_shared<Action>(system);
Expand Down
2 changes: 1 addition & 1 deletion examples/takeoff_land/takeoff_and_land.cpp
Expand Up @@ -81,7 +81,7 @@ int main(int argc, char** argv)

// Register a callback so we get told when components (camera, gimbal) etc
// are found.
system.register_component_discovered_callback(component_discovered);
system->register_component_discovered_callback(component_discovered);

auto telemetry = std::make_shared<Telemetry>(system);
auto action = std::make_shared<Action>(system);
Expand Down
Expand Up @@ -38,7 +38,7 @@ int main(int argc, char** argv)
}

// We need an autopilot connected to start.
while (!mavsdk.systems().at(0).has_autopilot()) {
while (!mavsdk.systems().at(0)->has_autopilot()) {
sleep_for(seconds(1));
std::cout << "Waiting for system to connect." << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion src/integration_tests/mission_transfer_lossy.cpp
Expand Up @@ -13,7 +13,7 @@ static void set_link_lossy(std::shared_ptr<MavlinkPassthrough> mavlink_passthrou
static std::vector<Mission::MissionItem> create_mission_items();
static bool should_keep_message(const mavlink_message_t& message);

static std::atomic<unsigned> _lossy_counter{0};
static std::atomic<size_t> _lossy_counter{0};

TEST_F(SitlTest, MissionTransferLossy)
{
Expand Down
2 changes: 0 additions & 2 deletions src/integration_tests/system_multi_components.cpp
Expand Up @@ -36,8 +36,6 @@ TEST(SitlTestMultiple, SystemMultipleComponents)
std::cout << "We've nothing to do until we've some system to talk to. Lets sleep!\n";
sleep_for(seconds(3));

auto uuids = mavsdk.system_uuids();

for (auto system : mavsdk.systems()) {
std::cout << "We found a System with UUID: " << system->get_uuid() << '\n';

Expand Down
21 changes: 7 additions & 14 deletions src/integration_tests/telemetry_async.cpp
Expand Up @@ -59,25 +59,18 @@ static bool _received_actuator_output_status = false;

TEST_F(SitlTest, TelemetryAsync)
{
Mavsdk dc;
Mavsdk mavsdk;

ConnectionResult ret = dc.add_udp_connection();
ConnectionResult ret = mavsdk.add_udp_connection();
ASSERT_EQ(ret, ConnectionResult::Success);

std::this_thread::sleep_for(std::chrono::seconds(3));

std::vector<uint64_t> uuids = dc.system_uuids();

for (auto it = uuids.begin(); it != uuids.end(); ++it) {
std::cout << "found system with UUID: " << *it << std::endl;
}

ASSERT_EQ(uuids.size(), 1);

uint64_t uuid = uuids.at(0);

ASSERT_EQ(ret, ConnectionResult::Success);
const auto systems = mavsdk.systems();
ASSERT_EQ(systems.size(), 1);
const auto system = systems.at(0);

System& system = dc.system(uuid);
std::cout << "Found system with UUID: " << system->get_uuid() << std::endl;

auto telemetry = std::make_shared<Telemetry>(system);

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/camera/camera_impl.cpp
Expand Up @@ -164,7 +164,7 @@ void CameraImpl::manual_disable()
_camera_found = false;
}

Camera::Result CameraImpl::select_camera(unsigned id)
Camera::Result CameraImpl::select_camera(const size_t id)
{
static constexpr std::size_t MAX_SUPPORTED_ID = 5;

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/camera/camera_impl.h
Expand Up @@ -20,7 +20,7 @@ class CameraImpl : public PluginImplBase {
void enable() override;
void disable() override;

Camera::Result select_camera(unsigned id);
Camera::Result select_camera(size_t id);

Camera::Result take_photo();

Expand Down Expand Up @@ -168,7 +168,7 @@ class CameraImpl : public PluginImplBase {

std::unique_ptr<CameraDefinition> _camera_definition{};

std::atomic<unsigned> _camera_id{0};
std::atomic<size_t> _camera_id{0};
std::atomic<bool> _camera_found{false};

struct {
Expand Down

0 comments on commit cbd5e19

Please sign in to comment.