• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mavlink / MAVSDK / 4899817366

pending completion
4899817366

Pull #1772

github

GitHub
Merge c0bb90862 into e4e9c71dd
Pull Request #1772: Refactor MAVLinkParameters into client and server classes

2192 of 2192 new or added lines in 34 files covered. (100.0%)

7708 of 24812 relevant lines covered (31.07%)

19.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/system_tests/component_information.cpp
1
#include <iostream>
2
#include <fstream>
3
#include <vector>
4
#include <atomic>
5
#include <future>
6

7
#include "mavsdk.h"
8
#include "log.h"
9
#include "plugins/component_information/component_information.h"
10
#include "plugins/component_information_server/component_information_server.h"
11
#include "plugins/param/param.h"
12
#include <gtest/gtest.h>
13

14
using namespace mavsdk;
15

16
// Disabled for now because the mavlink ftp plugin is not available properly on
17
// the server side right now. It needs to be split into client and server and
18
// split across system_impl, and server_component_impl.
19
TEST(SystemTest, DISABLED_ComponentInformationConnect)
×
20
{
21
    Mavsdk mavsdk_groundstation;
×
22
    mavsdk_groundstation.set_configuration(
×
23
        Mavsdk::Configuration{Mavsdk::Configuration::UsageType::GroundStation});
24
    ASSERT_EQ(mavsdk_groundstation.add_any_connection("udp://:17000"), ConnectionResult::Success);
×
25

26
    Mavsdk mavsdk_companion;
×
27
    mavsdk_companion.set_configuration(
×
28
        Mavsdk::Configuration{Mavsdk::Configuration::UsageType::CompanionComputer});
29
    ASSERT_EQ(
×
30
        mavsdk_companion.add_any_connection("udp://127.0.0.1:17000"), ConnectionResult::Success);
31

32
    auto maybe_system = mavsdk_groundstation.first_autopilot(10.0);
×
33
    ASSERT_TRUE(maybe_system);
×
34
    auto system = maybe_system.value();
×
35

36
    auto server = ComponentInformationServer{
×
37
        mavsdk_companion.server_component_by_type(Mavsdk::ServerComponentType::CompanionComputer)};
×
38

39
    auto param = ComponentInformationServer::FloatParam{};
×
40
    param.name = "ANG_RATE_ACC_MAX";
×
41
    param.short_description = "Angular rate acceleration maximum.";
×
42
    param.long_description = "The lower the maximum angular rate acceleration, "
43
                             "the smoother the gimbal will react to user input.";
×
44
    param.unit = "rad/s^2";
×
45
    param.min_value = 1.0f;
×
46
    param.max_value = 10.0f;
×
47
    param.default_value = 3.0f;
×
48
    param.start_value = 4.0f;
×
49
    param.decimal_places = 1;
×
50

51
    server.provide_float_param(param);
×
52

53
    server.subscribe_float_param([](ComponentInformationServer::FloatParamUpdate param_update) {
×
54
        LogInfo() << "Param " << param_update.name << " changed to " << param_update.value
×
55
                  << " on server side";
×
56
    });
×
57

58
    auto param_client = Param{system};
×
59

60
    param_client.set_param_float("ANG_RATE_ACC_MAX", 5.0f);
×
61

62
    auto client = ComponentInformation{system};
×
63
    client.subscribe_float_param([](ComponentInformation::FloatParamUpdate param_update) {
×
64
        LogInfo() << "Param " << param_update.name << " changed to " << param_update.value
×
65
                  << " on client side";
×
66
    });
×
67

68
    // Use another parameter to trigger the second callback.
69
    param_client.set_param_float("ANG_RATE_ACC_MAX", 6.0f);
×
70
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc