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
5950221e
Commit
5950221e
authored
Jul 18, 2017
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate positioning for multiple vehicles
parent
c64f0626
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
30 deletions
+38
-30
MockLink.cc
src/comm/MockLink.cc
+32
-27
MockLink.h
src/comm/MockLink.h
+6
-3
No files found.
src/comm/MockLink.cc
View file @
5950221e
...
...
@@ -33,11 +33,13 @@ QGC_LOGGING_CATEGORY(MockLinkVerboseLog, "MockLinkVerboseLog")
///
/// @author Don Gagne <don@thegagnes.com>
float
MockLink
::
_vehicleLatitude
=
47.633033
f
;
float
MockLink
::
_vehicleLongitude
=
-
122.08794
f
;
float
MockLink
::
_vehicleAltitude
=
3.5
f
;
int
MockLink
::
_nextVehicleSystemId
=
128
;
const
char
*
MockLink
::
_failParam
=
"COM_FLTMODE6"
;
// Vehicle position is set close to default Gazebo vehicle location. This allows for multi-vehicle
// testing of a gazebo vehicle and a mocklink vehicle
double
MockLink
::
_defaultVehicleLatitude
=
47.397
f
;
double
MockLink
::
_defaultVehicleLongitude
=
8.5455
f
;
double
MockLink
::
_defaultVehicleAltitude
=
488.056
f
;
int
MockLink
::
_nextVehicleSystemId
=
128
;
const
char
*
MockLink
::
_failParam
=
"COM_FLTMODE6"
;
const
char
*
MockConfiguration
::
_firmwareTypeKey
=
"FirmwareType"
;
const
char
*
MockConfiguration
::
_vehicleTypeKey
=
"VehicleType"
;
...
...
@@ -45,29 +47,32 @@ const char* MockConfiguration::_sendStatusTextKey = "SendStatusText";
const
char
*
MockConfiguration
::
_failureModeKey
=
"FailureMode"
;
MockLink
::
MockLink
(
SharedLinkConfigurationPointer
&
config
)
:
LinkInterface
(
config
)
,
_missionItemHandler
(
this
,
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
())
,
_name
(
"MockLink"
)
,
_connected
(
false
)
,
_mavlinkChannel
(
0
)
,
_vehicleSystemId
(
_nextVehicleSystemId
++
)
,
_vehicleComponentId
(
MAV_COMP_ID_AUTOPILOT1
)
,
_inNSH
(
false
)
,
_mavlinkStarted
(
true
)
,
_mavBaseMode
(
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
|
MAV_MODE_FLAG_CUSTOM_MODE_ENABLED
)
,
_mavState
(
MAV_STATE_STANDBY
)
,
_firmwareType
(
MAV_AUTOPILOT_PX4
)
,
_vehicleType
(
MAV_TYPE_QUADROTOR
)
,
_fileServer
(
NULL
)
,
_sendStatusText
(
false
)
,
_apmSendHomePositionOnEmptyList
(
false
)
,
_failureMode
(
MockConfiguration
::
FailNone
)
,
_sendHomePositionDelayCount
(
10
)
// No home position for 4 seconds
,
_sendGPSPositionDelayCount
(
100
)
// No gps lock for 5 seconds
:
LinkInterface
(
config
)
,
_missionItemHandler
(
this
,
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
())
,
_name
(
"MockLink"
)
,
_connected
(
false
)
,
_mavlinkChannel
(
0
)
,
_vehicleSystemId
(
_nextVehicleSystemId
++
)
,
_vehicleComponentId
(
MAV_COMP_ID_AUTOPILOT1
)
,
_inNSH
(
false
)
,
_mavlinkStarted
(
true
)
,
_mavBaseMode
(
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
|
MAV_MODE_FLAG_CUSTOM_MODE_ENABLED
)
,
_mavState
(
MAV_STATE_STANDBY
)
,
_firmwareType
(
MAV_AUTOPILOT_PX4
)
,
_vehicleType
(
MAV_TYPE_QUADROTOR
)
,
_vehicleLatitude
(
_defaultVehicleLatitude
+
((
_vehicleSystemId
-
128
)
*
0.0001
))
// Slight offset for each vehicle
,
_vehicleLongitude
(
_defaultVehicleLongitude
+
((
_vehicleSystemId
-
128
)
*
0.0001
))
,
_vehicleAltitude
(
_defaultVehicleAltitude
)
,
_fileServer
(
NULL
)
,
_sendStatusText
(
false
)
,
_apmSendHomePositionOnEmptyList
(
false
)
,
_failureMode
(
MockConfiguration
::
FailNone
)
,
_sendHomePositionDelayCount
(
10
)
// No home position for 4 seconds
,
_sendGPSPositionDelayCount
(
100
)
// No gps lock for 5 seconds
,
_currentParamRequestListComponentIndex
(
-
1
)
,
_currentParamRequestListParamIndex
(
-
1
)
,
_logDownloadCurrentOffset
(
0
)
,
_logDownloadBytesRemaining
(
0
)
,
_currentParamRequestListParamIndex
(
-
1
)
,
_logDownloadCurrentOffset
(
0
)
,
_logDownloadBytesRemaining
(
0
)
{
MockConfiguration
*
mockConfig
=
qobject_cast
<
MockConfiguration
*>
(
_config
.
data
());
_firmwareType
=
mockConfig
->
firmwareType
();
...
...
src/comm/MockLink.h
View file @
5950221e
...
...
@@ -216,6 +216,9 @@ private:
MAV_AUTOPILOT
_firmwareType
;
MAV_TYPE
_vehicleType
;
double
_vehicleLatitude
;
double
_vehicleLongitude
;
double
_vehicleAltitude
;
MockLinkFileServer
*
_fileServer
;
...
...
@@ -236,9 +239,9 @@ private:
uint32_t
_logDownloadCurrentOffset
;
///< Current offset we are sending from
uint32_t
_logDownloadBytesRemaining
;
///< Number of bytes still to send, 0 = send inactive
static
float
_v
ehicleLatitude
;
static
float
_v
ehicleLongitude
;
static
float
_v
ehicleAltitude
;
static
double
_defaultV
ehicleLatitude
;
static
double
_defaultV
ehicleLongitude
;
static
double
_defaultV
ehicleAltitude
;
static
int
_nextVehicleSystemId
;
static
const
char
*
_failParam
;
};
...
...
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