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
893f4194
Commit
893f4194
authored
Apr 26, 2018
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow manual control of when to send FOLLOW_TARGET messages.
parent
b9247f0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
16 deletions
+31
-16
FollowMe.cc
src/FollowMe/FollowMe.cc
+23
-13
FollowMe.h
src/FollowMe/FollowMe.h
+8
-3
No files found.
src/FollowMe/FollowMe.cc
View file @
893f4194
...
...
@@ -19,37 +19,48 @@
FollowMe
::
FollowMe
(
QGCApplication
*
app
,
QGCToolbox
*
toolbox
)
:
QGCTool
(
app
,
toolbox
),
estimatation_capabilities
(
0
)
,
_manualControl
(
false
)
{
memset
(
&
_motionReport
,
0
,
sizeof
(
motionReport_s
));
runTime
.
start
();
_gcsMotionReportTimer
.
setSingleShot
(
false
);
connect
(
&
_gcsMotionReportTimer
,
&
QTimer
::
timeout
,
this
,
&
FollowMe
::
_sendGCSMotionReport
);
}
void
FollowMe
::
followMeHandleManager
(
const
QString
&
)
{
QmlObjectListModel
&
vehicles
=
*
_toolbox
->
multiVehicleManager
()
->
vehicles
();
for
(
int
i
=
0
;
i
<
vehicles
.
count
();
i
++
)
{
Vehicle
*
vehicle
=
qobject_cast
<
Vehicle
*>
(
vehicles
[
i
]);
if
(
vehicle
->
px4Firmware
()
&&
vehicle
->
flightMode
().
compare
(
FirmwarePlugin
::
px4FollowMeFlightMode
,
Qt
::
CaseInsensitive
)
==
0
)
{
_enable
();
return
;
if
(
!
_manualControl
)
{
QmlObjectListModel
&
vehicles
=
*
_toolbox
->
multiVehicleManager
()
->
vehicles
();
for
(
int
i
=
0
;
i
<
vehicles
.
count
();
i
++
)
{
Vehicle
*
vehicle
=
qobject_cast
<
Vehicle
*>
(
vehicles
[
i
]);
if
(
vehicle
->
px4Firmware
()
&&
vehicle
->
flightMode
().
compare
(
FirmwarePlugin
::
px4FollowMeFlightMode
,
Qt
::
CaseInsensitive
)
==
0
)
{
_enable
(
_toolbox
->
qgcPositionManager
()
->
updateInterval
());
return
;
}
}
_disable
();
}
}
void
FollowMe
::
manualEnable
(
int
interval
)
{
_manualControl
=
true
;
_enable
(
interval
);
}
void
FollowMe
::
manualDisable
()
{
_manualControl
=
false
;
_disable
();
}
void
FollowMe
::
_enable
()
void
FollowMe
::
_enable
(
int
interval
)
{
connect
(
_toolbox
->
qgcPositionManager
(),
SIGNAL
(
positionInfoUpdated
(
QGeoPositionInfo
)),
this
,
SLOT
(
_setGPSLocation
(
QGeoPositionInfo
)));
_gcsMotionReportTimer
.
setInterval
(
_toolbox
->
qgcPositionManager
()
->
updateInterval
());
_gcsMotionReportTimer
.
setInterval
(
interval
);
_gcsMotionReportTimer
.
start
();
}
...
...
@@ -59,7 +70,6 @@ void FollowMe::_disable()
SIGNAL
(
positionInfoUpdated
(
QGeoPositionInfo
)),
this
,
SLOT
(
_setGPSLocation
(
QGeoPositionInfo
)));
_gcsMotionReportTimer
.
stop
();
}
...
...
@@ -133,7 +143,7 @@ void FollowMe::_sendGCSMotionReport(void)
for
(
int
i
=
0
;
i
<
vehicles
.
count
();
i
++
)
{
Vehicle
*
vehicle
=
qobject_cast
<
Vehicle
*>
(
vehicles
[
i
]);
if
(
vehicle
->
flightMode
().
compare
(
FirmwarePlugin
::
px4FollowMeFlightMode
,
Qt
::
CaseInsensitive
)
==
0
)
{
if
(
_manualControl
||
vehicle
->
flightMode
().
compare
(
FirmwarePlugin
::
px4FollowMeFlightMode
,
Qt
::
CaseInsensitive
)
==
0
)
{
mavlink_message_t
message
;
mavlink_msg_follow_target_encode_chan
(
mavlinkProtocol
->
getSystemId
(),
mavlinkProtocol
->
getComponentId
(),
...
...
src/FollowMe/FollowMe.h
View file @
893f4194
...
...
@@ -29,6 +29,9 @@ class FollowMe : public QGCTool
public:
FollowMe
(
QGCApplication
*
app
,
QGCToolbox
*
toolbox
);
void
manualEnable
(
int
interval
);
void
manualDisable
();
public
slots
:
void
followMeHandleManager
(
const
QString
&
);
...
...
@@ -65,8 +68,10 @@ private:
uint8_t
estimatation_capabilities
;
void
_disable
();
void
_enable
();
void
_disable
();
void
_enable
(
int
interval
);
double
_degreesToRadian
(
double
deg
);
double
_degreesToRadian
(
double
deg
)
;
bool
_manualControl
;
};
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