Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
firmware
test
parameters_test.cpp
Go to the documentation of this file.
1
#include "mavlink.h"
2
#include "
test_board.h
"
3
4
#include "rosflight.h"
5
6
#include <gtest/gtest.h>
7
8
using namespace
rosflight_firmware
;
9
10
#define EXPECT_PARAM_EQ_INT(id, value) EXPECT_EQ(value, rf.params_.get_param_int(id))
11
#define EXPECT_PARAM_EQ_FLOAT(id, value) EXPECT_EQ(value, rf.params_.get_param_float(id))
12
13
TEST
(Parameters, DefaultParameters)
14
{
15
testBoard
board;
16
Mavlink
mavlink(board);
17
ROSflight
rf(board, mavlink);
18
19
rf.
init
();
20
21
EXPECT_PARAM_EQ_INT
(
PARAM_BAUD_RATE
, 921600);
22
EXPECT_PARAM_EQ_INT
(
PARAM_SYSTEM_ID
, 1);
23
EXPECT_PARAM_EQ_FLOAT
(
PARAM_X_EQ_TORQUE
, 0.0
f
);
24
EXPECT_PARAM_EQ_FLOAT
(
PARAM_Y_EQ_TORQUE
, 0.0
f
);
25
EXPECT_PARAM_EQ_FLOAT
(
PARAM_Z_EQ_TORQUE
, 0.0
f
);
26
EXPECT_PARAM_EQ_FLOAT
(
PARAM_MOTOR_IDLE_THROTTLE
, 0.1
f
);
27
EXPECT_PARAM_EQ_FLOAT
(
PARAM_FAILSAFE_THROTTLE
, 0.3
f
);
28
EXPECT_PARAM_EQ_INT
(
PARAM_SPIN_MOTORS_WHEN_ARMED
, 1);
29
EXPECT_PARAM_EQ_INT
(
PARAM_CALIBRATE_GYRO_ON_ARM
, 0);
30
EXPECT_PARAM_EQ_FLOAT
(
PARAM_GYRO_X_BIAS
, 0.0
f
);
31
EXPECT_PARAM_EQ_FLOAT
(
PARAM_GYRO_Y_BIAS
, 0.0
f
);
32
EXPECT_PARAM_EQ_FLOAT
(
PARAM_GYRO_Z_BIAS
, 0.0
f
);
33
EXPECT_PARAM_EQ_FLOAT
(
PARAM_ACC_X_BIAS
, 0.0
f
);
34
EXPECT_PARAM_EQ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
PARAM_RC_Y_CHANNEL
, 1);
55
EXPECT_PARAM_EQ_INT
(
PARAM_RC_Z_CHANNEL
, 3);
56
EXPECT_PARAM_EQ_INT
(
PARAM_RC_F_CHANNEL
, 2);
57
EXPECT_PARAM_EQ_INT
(
PARAM_RC_ATTITUDE_OVERRIDE_CHANNEL
, 4);
58
EXPECT_PARAM_EQ_INT
(
PARAM_RC_THROTTLE_OVERRIDE_CHANNEL
, 4);
59
EXPECT_PARAM_EQ_INT
(
PARAM_RC_ATT_CONTROL_TYPE_CHANNEL
, -1);
60
EXPECT_PARAM_EQ_INT
(
PARAM_RC_ARM_CHANNEL
, -1);
61
EXPECT_PARAM_EQ_INT
(
PARAM_RC_NUM_CHANNELS
, 6);
62
EXPECT_PARAM_EQ_INT
(
PARAM_RC_SWITCH_5_DIRECTION
, 1);
63
EXPECT_PARAM_EQ_INT
(
PARAM_RC_SWITCH_6_DIRECTION
, 1);
64
EXPECT_PARAM_EQ_INT
(
PARAM_RC_SWITCH_7_DIRECTION
, 1);
65
EXPECT_PARAM_EQ_INT
(
PARAM_RC_SWITCH_8_DIRECTION
, 1);
66
EXPECT_PARAM_EQ_FLOAT
(
PARAM_RC_OVERRIDE_DEVIATION
, 0.1
f
);
67
EXPECT_PARAM_EQ_INT
(
PARAM_RC_OVERRIDE_TAKE_MIN_THROTTLE
, 1);
68
EXPECT_PARAM_EQ_INT
(
PARAM_RC_ATTITUDE_MODE
, 1);
69
EXPECT_PARAM_EQ_INT
(
PARAM_MIXER
,
Mixer::INVALID_MIXER
);
70
EXPECT_PARAM_EQ_INT
(
PARAM_FIXED_WING
, 0);
71
EXPECT_PARAM_EQ_INT
(
PARAM_AILERON_REVERSE
, 0);
72
EXPECT_PARAM_EQ_INT
(
PARAM_ELEVATOR_REVERSE
, 0);
73
EXPECT_PARAM_EQ_INT
(
PARAM_RUDDER_REVERSE
, 0);
74
EXPECT_PARAM_EQ_INT
(
PARAM_FC_ROLL
, 0);
75
EXPECT_PARAM_EQ_INT
(
PARAM_FC_PITCH
, 0);
76
EXPECT_PARAM_EQ_INT
(
PARAM_FC_YAW
, 0);
77
EXPECT_PARAM_EQ_FLOAT
(
PARAM_ARM_THRESHOLD
, 0.15
f
);
78
}
rosflight_firmware::PARAM_ACC_X_BIAS
Definition:
param.h:131
rosflight_firmware::PARAM_RC_SWITCH_7_DIRECTION
Definition:
param.h:172
rosflight_firmware::PARAM_FC_ROLL
Definition:
param.h:196
rosflight_firmware::PARAM_FAILSAFE_THROTTLE
Definition:
param.h:106
rosflight_firmware::PARAM_MAG_A32_COMP
Definition:
param.h:145
rosflight_firmware::PARAM_MAG_A31_COMP
Definition:
param.h:144
rosflight_firmware::PARAM_RC_ATT_CONTROL_TYPE_CHANNEL
Definition:
param.h:166
EXPECT_PARAM_EQ_FLOAT
#define EXPECT_PARAM_EQ_FLOAT(id, value)
Definition:
parameters_test.cpp:11
rosflight_firmware::testBoard
Definition:
test_board.h:40
rosflight_firmware::Mixer::INVALID_MIXER
Definition:
mixer.h:65
rosflight_firmware::PARAM_MAG_A13_COMP
Definition:
param.h:140
rosflight_firmware::PARAM_RC_THROTTLE_OVERRIDE_CHANNEL
Definition:
param.h:165
rosflight_firmware::PARAM_RC_NUM_CHANNELS
Definition:
param.h:168
rosflight_firmware::PARAM_ACC_Z_TEMP_COMP
Definition:
param.h:136
rosflight_firmware::PARAM_MAG_A22_COMP
Definition:
param.h:142
rosflight_firmware
Definition:
airbourne_board.cpp:34
rosflight_firmware::PARAM_MOTOR_IDLE_THROTTLE
Definition:
param.h:105
rosflight_firmware::Mavlink
Definition:
mavlink.h:53
rosflight_firmware::PARAM_ELEVATOR_REVERSE
Definition:
param.h:192
rosflight_firmware::PARAM_RC_SWITCH_8_DIRECTION
Definition:
param.h:173
rosflight_firmware::PARAM_Y_EQ_TORQUE
Definition:
param.h:96
EXPECT_PARAM_EQ_INT
#define EXPECT_PARAM_EQ_INT(id, value)
Definition:
parameters_test.cpp:10
rosflight_firmware::PARAM_RC_ATTITUDE_OVERRIDE_CHANNEL
Definition:
param.h:164
TEST
TEST(Parameters, DefaultParameters)
Definition:
parameters_test.cpp:13
rosflight_firmware::PARAM_MAG_A21_COMP
Definition:
param.h:141
rosflight_firmware::PARAM_SYSTEM_ID
Definition:
param.h:53
rosflight_firmware::PARAM_AILERON_REVERSE
Definition:
param.h:193
rosflight_firmware::PARAM_RC_Y_CHANNEL
Definition:
param.h:161
test_board.h
rosflight_firmware::PARAM_RC_Z_CHANNEL
Definition:
param.h:162
rosflight_firmware::PARAM_RC_ARM_CHANNEL
Definition:
param.h:167
rosflight_firmware::PARAM_RC_ATTITUDE_MODE
Definition:
param.h:179
rosflight_firmware::PARAM_ACC_Y_TEMP_COMP
Definition:
param.h:135
rosflight_firmware::PARAM_RC_TYPE
Definition:
param.h:159
rosflight_firmware::PARAM_MAG_X_BIAS
Definition:
param.h:147
rosflight_firmware::ROSflight
Definition:
include/rosflight.h:53
rosflight_firmware::PARAM_MIXER
Definition:
param.h:189
rosflight_firmware::PARAM_MAG_A23_COMP
Definition:
param.h:143
rosflight_firmware::PARAM_GYRO_Y_BIAS
Definition:
param.h:129
rosflight_firmware::PARAM_MAG_A11_COMP
Definition:
param.h:138
rosflight_firmware::PARAM_ACC_X_TEMP_COMP
Definition:
param.h:134
rosflight_firmware::PARAM_RUDDER_REVERSE
Definition:
param.h:194
rosflight_firmware::PARAM_FIXED_WING
Definition:
param.h:191
rosflight_firmware::PARAM_GYRO_X_BIAS
Definition:
param.h:128
rosflight_firmware::PARAM_ACC_Z_BIAS
Definition:
param.h:133
rosflight_firmware::PARAM_FC_YAW
Definition:
param.h:198
rosflight_firmware::PARAM_MAG_Y_BIAS
Definition:
param.h:148
rosflight_firmware::PARAM_MAG_A12_COMP
Definition:
param.h:139
rosflight_firmware::PARAM_RC_F_CHANNEL
Definition:
param.h:163
rosflight_firmware::PARAM_BARO_BIAS
Definition:
param.h:151
rosflight_firmware::PARAM_FC_PITCH
Definition:
param.h:197
rosflight_firmware::PARAM_MAG_Z_BIAS
Definition:
param.h:149
rosflight_firmware::PARAM_RC_X_CHANNEL
Definition:
param.h:160
rosflight_firmware::PARAM_BAUD_RATE
Definition:
param.h:47
rosflight_firmware::PARAM_Z_EQ_TORQUE
Definition:
param.h:97
param_parser.f
f
Definition:
param_parser.py:12
rosflight_firmware::PARAM_SPIN_MOTORS_WHEN_ARMED
Definition:
param.h:107
rosflight_firmware::PARAM_RC_OVERRIDE_DEVIATION
Definition:
param.h:175
rosflight_firmware::PARAM_RC_SWITCH_6_DIRECTION
Definition:
param.h:171
rosflight_firmware::PARAM_RC_OVERRIDE_TAKE_MIN_THROTTLE
Definition:
param.h:177
rosflight_firmware::PARAM_ACC_Y_BIAS
Definition:
param.h:132
rosflight_firmware::PARAM_ARM_THRESHOLD
Definition:
param.h:203
rosflight_firmware::PARAM_CALIBRATE_GYRO_ON_ARM
Definition:
param.h:122
rosflight_firmware::ROSflight::init
void init()
Main initialization routine for the ROSflight autopilot flight stack.
Definition:
rosflight.cpp:55
rosflight_firmware::PARAM_RC_SWITCH_5_DIRECTION
Definition:
param.h:170
rosflight_firmware::PARAM_MAG_A33_COMP
Definition:
param.h:146
rosflight_firmware::PARAM_GYRO_Z_BIAS
Definition:
param.h:130
rosflight_firmware::PARAM_X_EQ_TORQUE
Definition:
param.h:95
rosflight_firmware
Author(s): Daniel Koch
, James Jackson
autogenerated on Thu Apr 15 2021 05:07:47