Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
b974f350
Commit
b974f350
authored
Nov 07, 2018
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
6d052668
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
13 deletions
+16
-13
MockLink.cc
src/comm/MockLink.cc
+13
-11
MockLink.h
src/comm/MockLink.h
+2
-2
PX4MockLink.params
src/comm/PX4MockLink.params
+1
-0
No files found.
src/comm/MockLink.cc
View file @
b974f350
...
...
@@ -257,6 +257,7 @@ void MockLink::_loadParams(void)
QStringList
paramData
=
line
.
split
(
"
\t
"
);
Q_ASSERT
(
paramData
.
count
()
==
5
);
int
compId
=
paramData
.
at
(
1
).
toInt
();
QString
paramName
=
paramData
.
at
(
2
);
QString
valStr
=
paramData
.
at
(
3
);
uint
paramType
=
paramData
.
at
(
4
).
toUInt
();
...
...
@@ -292,8 +293,8 @@ void MockLink::_loadParams(void)
qCDebug
(
MockLinkVerboseLog
)
<<
"Loading param"
<<
paramName
<<
paramValue
;
_mapParamName2Value
[
_vehicleComponent
Id
][
paramName
]
=
paramValue
;
_mapParamName2MavParamType
[
paramName
]
=
static_cast
<
MAV_PARAM_TYPE
>
(
paramType
);
_mapParamName2Value
[
comp
Id
][
paramName
]
=
paramValue
;
_mapParamName2MavParamType
[
compId
][
paramName
]
=
static_cast
<
MAV_PARAM_TYPE
>
(
paramType
);
}
}
...
...
@@ -515,11 +516,11 @@ void MockLink::_setParamFloatUnionIntoMap(int componentId, const QString& paramN
Q_ASSERT
(
_mapParamName2Value
.
contains
(
componentId
));
Q_ASSERT
(
_mapParamName2Value
[
componentId
].
contains
(
paramName
));
Q_ASSERT
(
_mapParamName2MavParamType
.
contains
(
paramName
));
Q_ASSERT
(
_mapParamName2MavParamType
[
componentId
]
.
contains
(
paramName
));
valueUnion
.
param_float
=
paramFloat
;
MAV_PARAM_TYPE
paramType
=
_mapParamName2MavParamType
[
paramName
];
MAV_PARAM_TYPE
paramType
=
_mapParamName2MavParamType
[
componentId
][
paramName
];
QVariant
paramVariant
;
...
...
@@ -569,9 +570,9 @@ float MockLink::_floatUnionForParam(int componentId, const QString& paramName)
Q_ASSERT
(
_mapParamName2Value
.
contains
(
componentId
));
Q_ASSERT
(
_mapParamName2Value
[
componentId
].
contains
(
paramName
));
Q_ASSERT
(
_mapParamName2MavParamType
.
contains
(
paramName
));
Q_ASSERT
(
_mapParamName2MavParamType
[
componentId
]
.
contains
(
paramName
));
MAV_PARAM_TYPE
paramType
=
_mapParamName2MavParamType
[
paramName
];
MAV_PARAM_TYPE
paramType
=
_mapParamName2MavParamType
[
componentId
][
paramName
];
QVariant
paramVar
=
_mapParamName2Value
[
componentId
][
paramName
];
switch
(
paramType
)
{
...
...
@@ -677,9 +678,9 @@ void MockLink::_paramRequestListWorker(void)
mavlink_message_t
responseMsg
;
Q_ASSERT
(
_mapParamName2Value
[
componentId
].
contains
(
paramName
));
Q_ASSERT
(
_mapParamName2MavParamType
.
contains
(
paramName
));
Q_ASSERT
(
_mapParamName2MavParamType
[
componentId
]
.
contains
(
paramName
));
MAV_PARAM_TYPE
paramType
=
_mapParamName2MavParamType
[
paramName
];
MAV_PARAM_TYPE
paramType
=
_mapParamName2MavParamType
[
componentId
][
paramName
];
Q_ASSERT
(
paramName
.
length
()
<=
MAVLINK_MSG_ID_PARAM_VALUE_LEN
);
strncpy
(
paramId
,
paramName
.
toLocal8Bit
().
constData
(),
MAVLINK_MSG_ID_PARAM_VALUE_LEN
);
...
...
@@ -726,8 +727,9 @@ void MockLink::_handleParamSet(const mavlink_message_t& msg)
qCDebug
(
MockLinkLog
)
<<
"_handleParamSet"
<<
componentId
<<
paramId
<<
request
.
param_type
;
Q_ASSERT
(
_mapParamName2Value
.
contains
(
componentId
));
Q_ASSERT
(
_mapParamName2MavParamType
.
contains
(
componentId
));
Q_ASSERT
(
_mapParamName2Value
[
componentId
].
contains
(
paramId
));
Q_ASSERT
(
request
.
param_type
==
_mapParamName2MavParamType
[
paramId
]);
Q_ASSERT
(
request
.
param_type
==
_mapParamName2MavParamType
[
componentId
][
paramId
]);
// Save the new value
_setParamFloatUnionIntoMap
(
componentId
,
paramId
,
request
.
param_value
);
...
...
@@ -795,7 +797,7 @@ void MockLink::_handleParamRequestRead(const mavlink_message_t& msg)
}
Q_ASSERT
(
_mapParamName2Value
[
componentId
].
contains
(
paramId
));
Q_ASSERT
(
_mapParamName2MavParamType
.
contains
(
paramId
));
Q_ASSERT
(
_mapParamName2MavParamType
[
componentId
]
.
contains
(
paramId
));
if
(
_failureMode
==
MockConfiguration
::
FailMissingParamOnAllRequests
&&
strcmp
(
paramId
,
_failParam
)
==
0
)
{
qCDebug
(
MockLinkLog
)
<<
"Ignoring request read for "
<<
_failParam
;
...
...
@@ -809,7 +811,7 @@ void MockLink::_handleParamRequestRead(const mavlink_message_t& msg)
&
responseMsg
,
// Outgoing message
paramId
,
// Parameter name
_floatUnionForParam
(
componentId
,
paramId
),
// Parameter value
_mapParamName2MavParamType
[
paramId
],
// Parameter type
_mapParamName2MavParamType
[
componentId
][
paramId
],
// Parameter type
_mapParamName2Value
[
componentId
].
count
(),
// Total number of parameters
_mapParamName2Value
[
componentId
].
keys
().
indexOf
(
paramId
));
// Index of this parameter
respondWithMavlinkMessage
(
responseMsg
);
...
...
src/comm/MockLink.h
View file @
b974f350
...
...
@@ -216,8 +216,8 @@ private:
bool
_inNSH
;
bool
_mavlinkStarted
;
QMap
<
int
,
QMap
<
QString
,
QVariant
>
>
_mapParamName2Value
;
QMap
<
QString
,
MAV_PARAM_TYPE
>
_mapParamName2MavParamType
;
QMap
<
int
,
QMap
<
QString
,
QVariant
>
>
_mapParamName2Value
;
QMap
<
int
,
QMap
<
QString
,
MAV_PARAM_TYPE
>>
_mapParamName2MavParamType
;
uint8_t
_mavBaseMode
;
uint32_t
_mavCustomMode
;
...
...
src/comm/PX4MockLink.params
View file @
b974f350
...
...
@@ -737,3 +737,4 @@
1 1 TRIG_MODE 4 6
1 1 VT_B_DEC_MSS 2.000000000000000000 9
1 1 VT_B_REV_DEL 0.000000000000000000 9
1 2 VT_B_REV_DEL 0.000000000000000000 9
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment