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 <gtest/gtest.h>
2
#include "
test_board.h
"
3
#include "mavlink.h"
4
#include "rosflight.h"
5
6
using namespace
rosflight_firmware
;
7
8
#define EXPECT_PARAM_EQ_INT(id, value) EXPECT_EQ(value, rf.params_.get_param_int(id))
9
#define EXPECT_PARAM_EQ_FLOAT(id, value) EXPECT_EQ(value, rf.params_.get_param_float(id))
10
11
TEST
(parameters_test, default_parameters_test)
12
{
13
testBoard
board;
14
Mavlink
mavlink(board);
15
ROSflight
rf(board, mavlink);
16
17
rf.
init
();
18
19
EXPECT_PARAM_EQ_INT
(
PARAM_BAUD_RATE
, 921600);
20
EXPECT_PARAM_EQ_INT
(
PARAM_SYSTEM_ID
, 1);
21
EXPECT_PARAM_EQ_FLOAT
(
PARAM_X_EQ_TORQUE
, 0.0
f
);
22
EXPECT_PARAM_EQ_FLOAT
(
PARAM_Y_EQ_TORQUE
, 0.0
f
);
23
EXPECT_PARAM_EQ_FLOAT
(
PARAM_Z_EQ_TORQUE
, 0.0
f
);
24
EXPECT_PARAM_EQ_FLOAT
(
PARAM_MOTOR_IDLE_THROTTLE
, 0.1
f
);
25
EXPECT_PARAM_EQ_FLOAT
(
PARAM_FAILSAFE_THROTTLE
, 0.3
f
);
26
EXPECT_PARAM_EQ_INT
(
PARAM_SPIN_MOTORS_WHEN_ARMED
, 1);
27
EXPECT_PARAM_EQ_INT
(
PARAM_CALIBRATE_GYRO_ON_ARM
, 0);
28
EXPECT_PARAM_EQ_FLOAT
(
PARAM_GYRO_X_BIAS
, 0.0
f
);
29
EXPECT_PARAM_EQ_FLOAT
(
PARAM_GYRO_Y_BIAS
, 0.0
f
);
30
EXPECT_PARAM_EQ_FLOAT
(
PARAM_GYRO_Z_BIAS
, 0.0
f
);
31
EXPECT_PARAM_EQ_FLOAT
(
PARAM_ACC_X_BIAS
, 0.0
f
);
32
EXPECT_PARAM_EQ_F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AM_RC_Y_CHANNEL
, 1);
53
EXPECT_PARAM_EQ_INT
(
PARAM_RC_Z_CHANNEL
, 3);
54
EXPECT_PARAM_EQ_INT
(
PARAM_RC_F_CHANNEL
, 2);
55
EXPECT_PARAM_EQ_INT
(
PARAM_RC_ATTITUDE_OVERRIDE_CHANNEL
, 4);
56
EXPECT_PARAM_EQ_INT
(
PARAM_RC_THROTTLE_OVERRIDE_CHANNEL
, 4);
57
EXPECT_PARAM_EQ_INT
(
PARAM_RC_ATT_CONTROL_TYPE_CHANNEL
, -1);
58
EXPECT_PARAM_EQ_INT
(
PARAM_RC_ARM_CHANNEL
, -1);
59
EXPECT_PARAM_EQ_INT
(
PARAM_RC_NUM_CHANNELS
, 6);
60
EXPECT_PARAM_EQ_INT
(
PARAM_RC_SWITCH_5_DIRECTION
, 1);
61
EXPECT_PARAM_EQ_INT
(
PARAM_RC_SWITCH_6_DIRECTION
, 1);
62
EXPECT_PARAM_EQ_INT
(
PARAM_RC_SWITCH_7_DIRECTION
, 1);
63
EXPECT_PARAM_EQ_INT
(
PARAM_RC_SWITCH_8_DIRECTION
, 1);
64
EXPECT_PARAM_EQ_FLOAT
(
PARAM_RC_OVERRIDE_DEVIATION
, 0.1
f
);
65
EXPECT_PARAM_EQ_INT
(
PARAM_RC_OVERRIDE_TAKE_MIN_THROTTLE
, 1);
66
EXPECT_PARAM_EQ_INT
(
PARAM_RC_ATTITUDE_MODE
, 1);
67
EXPECT_PARAM_EQ_INT
(
PARAM_MIXER
,
Mixer::INVALID_MIXER
);
68
EXPECT_PARAM_EQ_INT
(
PARAM_FIXED_WING
, 0);
69
EXPECT_PARAM_EQ_INT
(
PARAM_AILERON_REVERSE
, 0);
70
EXPECT_PARAM_EQ_INT
(
PARAM_ELEVATOR_REVERSE
, 0);
71
EXPECT_PARAM_EQ_INT
(
PARAM_RUDDER_REVERSE
, 0);
72
EXPECT_PARAM_EQ_INT
(
PARAM_FC_ROLL
, 0);
73
EXPECT_PARAM_EQ_INT
(
PARAM_FC_PITCH
, 0);
74
EXPECT_PARAM_EQ_INT
(
PARAM_FC_YAW
, 0);
75
EXPECT_PARAM_EQ_FLOAT
(
PARAM_ARM_THRESHOLD
, 0.15
f
);
76
}
rosflight_firmware::PARAM_MAG_A12_COMP
Definition:
param.h:147
rosflight_firmware::PARAM_ACC_Y_TEMP_COMP
Definition:
param.h:143
rosflight_firmware::PARAM_MAG_A21_COMP
Definition:
param.h:149
rosflight_firmware::PARAM_MAG_X_BIAS
Definition:
param.h:155
rosflight_firmware::PARAM_RC_F_CHANNEL
Definition:
param.h:171
rosflight_firmware::PARAM_GYRO_Z_BIAS
Definition:
param.h:138
rosflight_firmware::PARAM_RC_TYPE
Definition:
param.h:167
EXPECT_PARAM_EQ_FLOAT
#define EXPECT_PARAM_EQ_FLOAT(id, value)
Definition:
parameters_test.cpp:9
rosflight_firmware::testBoard
Definition:
test_board.h:41
rosflight_firmware::PARAM_FC_YAW
Definition:
param.h:206
rosflight_firmware::PARAM_ACC_Z_TEMP_COMP
Definition:
param.h:144
rosflight_firmware::PARAM_RUDDER_REVERSE
Definition:
param.h:202
rosflight_firmware::Mixer::INVALID_MIXER
Definition:
mixer.h:63
rosflight_firmware::PARAM_CALIBRATE_GYRO_ON_ARM
Definition:
param.h:130
rosflight_firmware::PARAM_RC_SWITCH_7_DIRECTION
Definition:
param.h:180
rosflight_firmware::PARAM_MAG_Z_BIAS
Definition:
param.h:157
rosflight_firmware::PARAM_X_EQ_TORQUE
Definition:
param.h:104
rosflight_firmware
Definition:
airbourne_board.cpp:34
rosflight_firmware::PARAM_MAG_A13_COMP
Definition:
param.h:148
rosflight_firmware::PARAM_RC_Y_CHANNEL
Definition:
param.h:169
rosflight_firmware::Mavlink
Definition:
mavlink.h:50
rosflight_firmware::PARAM_SPIN_MOTORS_WHEN_ARMED
Definition:
param.h:116
EXPECT_PARAM_EQ_INT
#define EXPECT_PARAM_EQ_INT(id, value)
Definition:
parameters_test.cpp:8
rosflight_firmware::PARAM_ACC_X_BIAS
Definition:
param.h:139
rosflight_firmware::PARAM_MAG_A31_COMP
Definition:
param.h:152
rosflight_firmware::PARAM_Z_EQ_TORQUE
Definition:
param.h:106
rosflight_firmware::PARAM_RC_ATTITUDE_MODE
Definition:
param.h:187
rosflight_firmware::PARAM_MAG_A11_COMP
Definition:
param.h:146
rosflight_firmware::PARAM_SYSTEM_ID
Definition:
param.h:62
rosflight_firmware::PARAM_AILERON_REVERSE
Definition:
param.h:201
test_board.h
rosflight_firmware::PARAM_RC_NUM_CHANNELS
Definition:
param.h:176
rosflight_firmware::PARAM_MAG_A23_COMP
Definition:
param.h:151
rosflight_firmware::PARAM_MAG_A22_COMP
Definition:
param.h:150
rosflight_firmware::PARAM_MIXER
Definition:
param.h:197
rosflight_firmware::PARAM_RC_Z_CHANNEL
Definition:
param.h:170
rosflight_firmware::PARAM_RC_SWITCH_6_DIRECTION
Definition:
param.h:179
rosflight_firmware::PARAM_FC_PITCH
Definition:
param.h:205
rosflight_firmware::PARAM_RC_OVERRIDE_DEVIATION
Definition:
param.h:183
rosflight_firmware::PARAM_MOTOR_IDLE_THROTTLE
Definition:
param.h:114
rosflight_firmware::ROSflight
Definition:
include/rosflight.h:50
rosflight_firmware::PARAM_BAUD_RATE
Definition:
param.h:56
rosflight_firmware::PARAM_ACC_Y_BIAS
Definition:
param.h:140
rosflight_firmware::PARAM_ACC_Z_BIAS
Definition:
param.h:141
rosflight_firmware::PARAM_RC_ARM_CHANNEL
Definition:
param.h:175
rosflight_firmware::PARAM_ELEVATOR_REVERSE
Definition:
param.h:200
rosflight_firmware::PARAM_RC_ATTITUDE_OVERRIDE_CHANNEL
Definition:
param.h:172
rosflight_firmware::PARAM_GYRO_Y_BIAS
Definition:
param.h:137
rosflight_firmware::PARAM_FIXED_WING
Definition:
param.h:199
rosflight_firmware::PARAM_RC_X_CHANNEL
Definition:
param.h:168
rosflight_firmware::PARAM_FAILSAFE_THROTTLE
Definition:
param.h:115
rosflight_firmware::PARAM_Y_EQ_TORQUE
Definition:
param.h:105
param_parser.f
f
Definition:
param_parser.py:12
rosflight_firmware::PARAM_RC_OVERRIDE_TAKE_MIN_THROTTLE
Definition:
param.h:185
rosflight_firmware::PARAM_BARO_BIAS
Definition:
param.h:159
TEST
TEST(parameters_test, default_parameters_test)
Definition:
parameters_test.cpp:11
rosflight_firmware::PARAM_MAG_A33_COMP
Definition:
param.h:154
rosflight_firmware::PARAM_RC_SWITCH_5_DIRECTION
Definition:
param.h:178
rosflight_firmware::PARAM_ACC_X_TEMP_COMP
Definition:
param.h:142
rosflight_firmware::PARAM_MAG_A32_COMP
Definition:
param.h:153
rosflight_firmware::ROSflight::init
void init()
Main initialization routine for the ROSflight autopilot flight stack.
Definition:
rosflight.cpp:52
rosflight_firmware::PARAM_GYRO_X_BIAS
Definition:
param.h:136
rosflight_firmware::PARAM_MAG_Y_BIAS
Definition:
param.h:156
rosflight_firmware::PARAM_FC_ROLL
Definition:
param.h:204
rosflight_firmware::PARAM_RC_THROTTLE_OVERRIDE_CHANNEL
Definition:
param.h:173
rosflight_firmware::PARAM_RC_ATT_CONTROL_TYPE_CHANNEL
Definition:
param.h:174
rosflight_firmware::PARAM_ARM_THRESHOLD
Definition:
param.h:211
rosflight_firmware::PARAM_RC_SWITCH_8_DIRECTION
Definition:
param.h:181
rosflight_firmware
Author(s): Daniel Koch
, James Jackson
autogenerated on Wed Jul 3 2019 19:59:25