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
2ce38b47
Commit
2ce38b47
authored
Sep 04, 2011
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed wrong message timings in simulated waypoint planner
parent
012e8345
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
30 deletions
+22
-30
MAVLinkSimulationLink.cc
src/comm/MAVLinkSimulationLink.cc
+5
-13
MAVLinkSimulationMAV.cc
src/comm/MAVLinkSimulationMAV.cc
+14
-14
MAVLinkSimulationWaypointPlanner.cc
src/comm/MAVLinkSimulationWaypointPlanner.cc
+3
-3
No files found.
src/comm/MAVLinkSimulationLink.cc
View file @
2ce38b47
...
@@ -36,7 +36,7 @@ This file is part of the QGROUNDCONTROL project
...
@@ -36,7 +36,7 @@ This file is part of the QGROUNDCONTROL project
#include <QTime>
#include <QTime>
#include <QImage>
#include <QImage>
#include <QDebug>
#include <QDebug>
#include
"MG.h"
#include
<QFileInfo>
#include "LinkManager.h"
#include "LinkManager.h"
#include "MAVLinkProtocol.h"
#include "MAVLinkProtocol.h"
#include "MAVLinkSimulationLink.h"
#include "MAVLinkSimulationLink.h"
...
@@ -78,7 +78,7 @@ MAVLinkSimulationLink::MAVLinkSimulationLink(QString readFile, QString writeFile
...
@@ -78,7 +78,7 @@ MAVLinkSimulationLink::MAVLinkSimulationLink(QString readFile, QString writeFile
simulationHeader
=
simulationFile
->
readLine
();
simulationHeader
=
simulationFile
->
readLine
();
}
}
receiveFile
=
new
QFile
(
writeFile
,
this
);
receiveFile
=
new
QFile
(
writeFile
,
this
);
lastSent
=
MG
::
TIME
::
getGroundTimeNow
()
*
1000
;
lastSent
=
QGC
::
groundTimeMilliseconds
()
;
if
(
simulationFile
->
exists
())
{
if
(
simulationFile
->
exists
())
{
this
->
name
=
"Simulation: "
+
QFileInfo
(
simulationFile
->
fileName
()).
fileName
();
this
->
name
=
"Simulation: "
+
QFileInfo
(
simulationFile
->
fileName
()).
fileName
();
...
@@ -118,7 +118,7 @@ void MAVLinkSimulationLink::run()
...
@@ -118,7 +118,7 @@ void MAVLinkSimulationLink::run()
static
quint64
last
=
0
;
static
quint64
last
=
0
;
if
(
MG
::
TIME
::
getGroundTimeNow
()
-
last
>=
rate
)
{
if
(
QGC
::
groundTimeMilliseconds
()
-
last
>=
rate
)
{
if
(
_isConnected
)
{
if
(
_isConnected
)
{
mainloop
();
mainloop
();
...
@@ -132,7 +132,7 @@ void MAVLinkSimulationLink::run()
...
@@ -132,7 +132,7 @@ void MAVLinkSimulationLink::run()
readBytes
();
readBytes
();
}
}
last
=
MG
::
TIME
::
getGroundTimeNow
();
last
=
QGC
::
groundTimeMilliseconds
();
}
}
QGC
::
SLEEP
::
msleep
(
3
);
QGC
::
SLEEP
::
msleep
(
3
);
...
@@ -265,9 +265,6 @@ void MAVLinkSimulationLink::mainloop()
...
@@ -265,9 +265,6 @@ void MAVLinkSimulationLink::mainloop()
double
d
=
QString
(
parts
.
at
(
i
)).
toDouble
(
&
res
);
double
d
=
QString
(
parts
.
at
(
i
)).
toDouble
(
&
res
);
if
(
!
res
)
d
=
0
;
if
(
!
res
)
d
=
0
;
//qDebug() << "TIME" << time << "VALUE" << d;
//emit valueChanged(220, keys.at(i), d, MG::TIME::getGroundTimeNow());
if
(
keys
.
value
(
i
,
""
)
==
"Accel._X"
)
{
if
(
keys
.
value
(
i
,
""
)
==
"Accel._X"
)
{
rawImuValues
.
xacc
=
d
;
rawImuValues
.
xacc
=
d
;
}
}
...
@@ -345,7 +342,7 @@ void MAVLinkSimulationLink::mainloop()
...
@@ -345,7 +342,7 @@ void MAVLinkSimulationLink::mainloop()
//qDebug() << "ATTITUDE" << "BUF LEN" << bufferlength << "POINTER" << streampointer;
//qDebug() << "ATTITUDE" << "BUF LEN" << bufferlength << "POINTER" << streampointer;
//qDebug() << "REALTIME" <<
MG::TIME::getGroundTimeNow
() << "ONBOARDTIME" << attitude.msec << "ROLL" << attitude.roll;
//qDebug() << "REALTIME" <<
QGC::groundTimeMilliseconds
() << "ONBOARDTIME" << attitude.msec << "ROLL" << attitude.roll;
}
}
...
@@ -667,11 +664,6 @@ qint64 MAVLinkSimulationLink::bytesAvailable()
...
@@ -667,11 +664,6 @@ qint64 MAVLinkSimulationLink::bytesAvailable()
void
MAVLinkSimulationLink
::
writeBytes
(
const
char
*
data
,
qint64
size
)
void
MAVLinkSimulationLink
::
writeBytes
(
const
char
*
data
,
qint64
size
)
{
{
//qDebug() << "Simulation received " << size << " bytes from groundstation: ";
// Increase write counter
//bitsSentTotal += size * 8;
// Parse bytes
// Parse bytes
mavlink_message_t
msg
;
mavlink_message_t
msg
;
mavlink_status_t
comm
;
mavlink_status_t
comm
;
...
...
src/comm/MAVLinkSimulationMAV.cc
View file @
2ce38b47
...
@@ -23,13 +23,13 @@ MAVLinkSimulationMAV::MAVLinkSimulationMAV(MAVLinkSimulationLink *parent, int sy
...
@@ -23,13 +23,13 @@ MAVLinkSimulationMAV::MAVLinkSimulationMAV(MAVLinkSimulationLink *parent, int sy
yaw
(
0.0
),
yaw
(
0.0
),
globalNavigation
(
true
),
globalNavigation
(
true
),
firstWP
(
false
),
firstWP
(
false
),
// previousSPX(8.548056),
// previousSPX(8.548056),
// previousSPY(47.376389),
// previousSPY(47.376389),
// previousSPZ(550),
// previousSPZ(550),
// previousSPYaw(0.0),
// previousSPYaw(0.0),
// nextSPX(8.548056),
// nextSPX(8.548056),
// nextSPY(47.376389),
// nextSPY(47.376389),
// nextSPZ(550),
// nextSPZ(550),
previousSPX
(
37.480391
),
previousSPX
(
37.480391
),
previousSPY
(
122.282883
),
previousSPY
(
122.282883
),
previousSPZ
(
550
),
previousSPZ
(
550
),
...
...
src/comm/MAVLinkSimulationWaypointPlanner.cc
View file @
2ce38b47
...
@@ -450,7 +450,7 @@ MAVLinkSimulationWaypointPlanner::MAVLinkSimulationWaypointPlanner(MAVLinkSimula
...
@@ -450,7 +450,7 @@ MAVLinkSimulationWaypointPlanner::MAVLinkSimulationWaypointPlanner(MAVLinkSimula
timestamp_last_send_setpoint
(
0
),
timestamp_last_send_setpoint
(
0
),
systemid
(
sysid
),
systemid
(
sysid
),
compid
(
MAV_COMP_ID_WAYPOINTPLANNER
),
compid
(
MAV_COMP_ID_WAYPOINTPLANNER
),
setpointDelay
(
10
),
setpointDelay
(
10
00
),
yawTolerance
(
0.4
f
),
yawTolerance
(
0.4
f
),
verbose
(
true
),
verbose
(
true
),
debug
(
false
),
debug
(
false
),
...
@@ -553,7 +553,7 @@ void MAVLinkSimulationWaypointPlanner::send_setpoint(uint16_t seq)
...
@@ -553,7 +553,7 @@ void MAVLinkSimulationWaypointPlanner::send_setpoint(uint16_t seq)
emit
messageSent
(
msg
);
emit
messageSent
(
msg
);
}
}
uint64_t
now
=
QGC
::
groundTime
Usecs
()
/
1000
;
uint64_t
now
=
QGC
::
groundTime
Milliseconds
()
;
timestamp_last_send_setpoint
=
now
;
timestamp_last_send_setpoint
=
now
;
}
}
}
}
...
@@ -699,7 +699,7 @@ void MAVLinkSimulationWaypointPlanner::mavlink_handler (const mavlink_message_t*
...
@@ -699,7 +699,7 @@ void MAVLinkSimulationWaypointPlanner::mavlink_handler (const mavlink_message_t*
//qDebug() << "MAV: %d WAYPOINTPLANNER GOT MESSAGE" << systemid;
//qDebug() << "MAV: %d WAYPOINTPLANNER GOT MESSAGE" << systemid;
uint64_t
now
=
QGC
::
groundTime
Usecs
()
/
1000
;
uint64_t
now
=
QGC
::
groundTime
Milliseconds
()
;
if
(
now
-
protocol_timestamp_lastaction
>
protocol_timeout
&&
current_state
!=
PX_WPP_IDLE
)
{
if
(
now
-
protocol_timestamp_lastaction
>
protocol_timeout
&&
current_state
!=
PX_WPP_IDLE
)
{
if
(
verbose
)
qDebug
()
<<
"Last operation (state=%u) timed out, changing state to PX_WPP_IDLE"
<<
current_state
;
if
(
verbose
)
qDebug
()
<<
"Last operation (state=%u) timed out, changing state to PX_WPP_IDLE"
<<
current_state
;
current_state
=
PX_WPP_IDLE
;
current_state
=
PX_WPP_IDLE
;
...
...
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