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
199c6f93
Commit
199c6f93
authored
Oct 23, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delay HOME_POSITION to better simulate reality
parent
af824e20
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
19 deletions
+32
-19
MockLink.cc
src/comm/MockLink.cc
+30
-19
MockLink.h
src/comm/MockLink.h
+2
-0
No files found.
src/comm/MockLink.cc
View file @
199c6f93
...
...
@@ -88,6 +88,7 @@ MockLink::MockLink(MockConfiguration* config)
,
_fileServer
(
NULL
)
,
_sendStatusText
(
false
)
,
_apmSendHomePositionOnEmptyList
(
false
)
,
_sendHomePositionDelayCount
(
2
)
{
_config
=
config
;
if
(
_config
)
{
...
...
@@ -171,7 +172,12 @@ void MockLink::_run1HzTasks(void)
{
if
(
_mavlinkStarted
&&
_connected
)
{
_sendHeartBeat
();
_sendHomePosition
();
if
(
_sendHomePositionDelayCount
>
0
)
{
// We delay home position a bit to be more realistic
_sendHomePositionDelayCount
--
;
}
else
{
_sendHomePosition
();
}
if
(
_sendStatusText
)
{
_sendStatusText
=
false
;
_sendStatusTextMessages
();
...
...
@@ -715,24 +721,29 @@ void MockLink::setMissionItemFailureMode(MockLinkMissionItemHandler::FailureMode
void
MockLink
::
_sendHomePosition
(
void
)
{
mavlink_message_t
msg
;
float
bogus
[
4
];
bogus
[
0
]
=
0.0
f
;
bogus
[
1
]
=
0.0
f
;
bogus
[
2
]
=
0.0
f
;
bogus
[
3
]
=
0.0
f
;
mavlink_msg_home_position_pack
(
_vehicleSystemId
,
_vehicleComponentId
,
&
msg
,
(
int32_t
)(
_vehicleLatitude
*
1E7
),
(
int32_t
)(
_vehicleLongitude
*
1E7
),
(
int32_t
)(
_vehicleAltitude
*
1000
),
0.0
f
,
0.0
f
,
0.0
f
,
&
bogus
[
0
],
0.0
f
,
0.0
f
,
0.0
f
);
respondWithMavlinkMessage
(
msg
);
// APM stack does not yet support HOME_POSITION
if
(
_firmwareType
!=
MAV_AUTOPILOT_ARDUPILOTMEGA
)
{
mavlink_message_t
msg
;
float
bogus
[
4
];
bogus
[
0
]
=
0.0
f
;
bogus
[
1
]
=
0.0
f
;
bogus
[
2
]
=
0.0
f
;
bogus
[
3
]
=
0.0
f
;
mavlink_msg_home_position_pack
(
_vehicleSystemId
,
_vehicleComponentId
,
&
msg
,
(
int32_t
)(
_vehicleLatitude
*
1E7
),
(
int32_t
)(
_vehicleLongitude
*
1E7
),
(
int32_t
)(
_vehicleAltitude
*
1000
),
0.0
f
,
0.0
f
,
0.0
f
,
&
bogus
[
0
],
0.0
f
,
0.0
f
,
0.0
f
);
respondWithMavlinkMessage
(
msg
);
}
}
void
MockLink
::
_sendGpsRawInt
(
void
)
...
...
src/comm/MockLink.h
View file @
199c6f93
...
...
@@ -191,6 +191,8 @@ private:
bool
_sendStatusText
;
bool
_apmSendHomePositionOnEmptyList
;
int
_sendHomePositionDelayCount
;
static
float
_vehicleLatitude
;
static
float
_vehicleLongitude
;
static
float
_vehicleAltitude
;
...
...
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