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
95c71cb1
Commit
95c71cb1
authored
Aug 15, 2011
by
LM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Flightgear sim running
parent
9daf5fde
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
10 deletions
+40
-10
MAVLinkXMLParserV10.cc
src/apps/mavlinkgen/generator/MAVLinkXMLParserV10.cc
+1
-1
QGCFlightGearLink.cc
src/comm/QGCFlightGearLink.cc
+39
-9
No files found.
src/apps/mavlinkgen/generator/MAVLinkXMLParserV10.cc
View file @
95c71cb1
...
...
@@ -927,7 +927,7 @@ bool MAVLinkXMLParserV10::generate()
// QString compact2Send("\n\n#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS_SMALL\nstatic inline void mavlink_msg_%3_send(%1 chan%5)\n{\n\t%2 hdr;\n\tmavlink_%3_t payload;\n\tuint16_t checksum;\n\tmavlink_%3_t *p = &payload;\n\n%6\n\thdr.STX = MAVLINK_STX;\n\thdr.len = MAVLINK_MSG_ID_%4_LEN;\n\thdr.msgid = MAVLINK_MSG_ID_%4;\n");
QString
compact2Send0
(
"
\n
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
\n
"
);
QString
compact2Send1
(
"static inline void mavlink_msg_%3_send(%1 chan%5)
\n
{
\n\t
%2 hdr;
\n\t
mavlink_%3_t payload;
\n\n\t
MAVLINK_BUFFER_CHECK_START( chan, MAVLINK_MSG_ID_%4_LEN )
\n
%6
\n\t
hdr.STX = MAVLINK_STX;
\n\t
hdr.len = MAVLINK_MSG_ID_%4_LEN;
\n\t
hdr.msgid = MAVLINK_MSG_ID_%4;
\n
"
);
QString
compact2Send2
(
"
\t
hdr.sysid = mavlink_system.sysid;
\n\t
hdr.compid = mavlink_system.compid;
\n\t
hdr.seq = mavlink_get_channel_status(chan)->current_tx_seq;
\n\t
mavlink_get_channel_status(chan)->current_tx_seq = hdr.seq + 1;
\n\t
mavlink_send_mem(chan, (uint8_t *)&hdr.STX, MAVLINK_NUM_HEADER_BYTES );
\n
"
);
QString
compact2Send2
(
"
\t
hdr.sysid = mavlink_system.sysid;
\n\t
hdr.compid = mavlink_system.compid;
\n\t
hdr.seq = mavlink_get_channel_status(chan)->current_tx_seq;
\n\t
mavlink_get_channel_status(chan)->current_tx_seq = hdr.seq + 1;
\n\t
mavlink_send_mem(chan, (uint8_t *)&hdr.STX, MAVLINK_NUM_HEADER_BYTES );
\n
\t
mavlink_send_mem(chan, (uint8_t *)&payload, sizeof(payload) );
\n
"
);
QString
compact2Send3
(
"
\n\t
crc_init(&hdr.ck);
\n\t
crc_calculate_mem((uint8_t *)&hdr.len, &hdr.ck, MAVLINK_CORE_HEADER_LEN);
\n\t
crc_calculate_mem((uint8_t *)&payload, &hdr.ck, hdr.len );
\n\t
crc_accumulate( 0x%1, &hdr.ck); /// include key in X25 checksum
\n\t
mavlink_send_mem(chan, (uint8_t *)&hdr.ck, MAVLINK_NUM_CHECKSUM_BYTES);
\n\t
MAVLINK_BUFFER_CHECK_END
\n
}
\n\n
#endif"
);
QString
compact2Send
=
compact2Send0
+
commentSendContainer
.
arg
(
messageName
.
toLower
(),
commentLines
)
+
compact2Send1
.
arg
(
channelType
,
headerType
,
messageName
,
messageName
.
toUpper
(),
packParameters
,
packLines
.
replace
(
QString
(
"p->"
),
QString
(
"payload."
))
)
+
compact2Send2
+
compact2Send3
.
arg
(
stringCRC
.
toUpper
());
// QString cFile = "// MESSAGE " + messageName.toUpper() + " PACKING\n\n" + idDefine.arg(messageName.toUpper(), QString::number(messageId), QString::number(calculatedLength), stringCRC.toUpper() ) + "\n\n" + cStruct + "\n" + arrayDefines + "\n" + commentContainer.arg(messageName.toLower(), commentLines) + pack + commentPackChanContainer.arg(messageName.toLower(), commentLines) + packChan + commentEncodeContainer.arg(messageName.toLower()) + encode + "\n" + commentSendContainer.arg(messageName.toLower(), commentLines) + compactSend + compact2Send + "\n" + "// MESSAGE " + messageName.toUpper() + " UNPACKING\n\n" + unpacking + commentDecodeContainer.arg(messageName.toLower()) + decode;
...
...
src/comm/QGCFlightGearLink.cc
View file @
95c71cb1
...
...
@@ -178,7 +178,7 @@ void QGCFlightGearLink::writeBytes(const char* data, qint64 size)
qDebug
()
<<
bytes
;
qDebug
()
<<
"ASCII:"
<<
ascii
;
#endif
socket
->
writeDatagram
(
data
,
size
,
currentHost
,
currentPort
);
if
(
connectState
&&
socket
)
socket
->
writeDatagram
(
data
,
size
,
currentHost
,
currentPort
);
}
/**
...
...
@@ -202,7 +202,7 @@ void QGCFlightGearLink::readBytes()
// Print string
QString
state
(
b
);
qDebug
()
<<
"FG LINK GOT:"
<<
state
;
//
qDebug() << "FG LINK GOT:" << state;
QStringList
values
=
state
.
split
(
","
);
...
...
@@ -254,6 +254,14 @@ qint64 QGCFlightGearLink::bytesAvailable()
**/
bool
QGCFlightGearLink
::
disconnectSimulation
()
{
disconnect
(
process
,
SIGNAL
(
error
(
QProcess
::
ProcessError
)),
this
,
SLOT
(
processError
(
QProcess
::
ProcessError
)));
disconnect
(
mav
,
SIGNAL
(
hilControlsChanged
(
uint64_t
,
float
,
float
,
float
,
float
,
uint8_t
,
uint8_t
)),
this
,
SLOT
(
updateControls
(
uint64_t
,
float
,
float
,
float
,
float
,
uint8_t
,
uint8_t
)));
disconnect
(
this
,
SIGNAL
(
hilStateChanged
(
uint64_t
,
float
,
float
,
float
,
float
,
float
,
float
,
int32_t
,
int32_t
,
int32_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
)),
mav
,
SLOT
(
sendHilState
(
uint64_t
,
float
,
float
,
float
,
float
,
float
,
float
,
int32_t
,
int32_t
,
int32_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
,
int16_t
)));
process
->
close
();
delete
process
;
process
=
NULL
;
delete
socket
;
socket
=
NULL
;
...
...
@@ -331,7 +339,7 @@ QObject::connect( process, SIGNAL(error(QProcess::ProcessError)),
QStringList
processCall
;
QString
processFgfs
;
QString
fgRoot
;
QString
aircraft
(
"Rascal110"
);
QString
aircraft
(
"Rascal110
-JSBSim
"
);
#ifdef Q_OS_MACX
processFgfs
=
"/Applications/FlightGear.app/Contents/Resources/fgfs"
;
...
...
@@ -343,18 +351,40 @@ processFgfs = "C:\Program Files (x86)\FlightGear\bin\Win32\fgfs";
fgRoot
=
"--fg-root=C:\Program Files (x86)\FlightGear\data"
;
#endif
#ifdef Q_OS_LINUX
processFgfs
=
"fgfs"
;
fgRoot
=
"--fg-root=/usr/share/flightgear/data"
;
#endif
processCall
<<
fgRoot
;
//processCall << "--generic=socket,out,50,127.0.0.1,49005,udp,ardupilot" << "--generic=socket,in,50,127.0.0.1,49000,udp,ardupilot" << "--in-air" << "--altitude=10" << "--vc=90" << "--heading=300" << "--timeofday=noon";
//processCall << QString("--aircraft=%2").arg(aircraft);
processCall
<<
"--generic=socket,out,50,127.0.0.1,49005,udp,ardupilot"
;
processCall
<<
"--generic=socket,in,50,127.0.0.1,49000,udp,ardupilot"
;
processCall
<<
"--in-air"
;
processCall
<<
"--altitude=10"
;
processCall
<<
"--vc=90"
;
processCall
<<
"--heading=300"
;
processCall
<<
"--timeofday=noon"
;
processCall
<<
"--disable-hud-3d"
;
processCall
<<
"--control=mouse"
;
processCall
<<
"--disable-intro-music"
;
processCall
<<
"--disable-sound"
;
processCall
<<
"--disable-anti-alias-hud"
;
processCall
<<
"--disable-fullscreen"
;
processCall
<<
"--disable-random-objects"
;
processCall
<<
"--disable-ai-models"
;
processCall
<<
"--wind=0@0"
;
processCall
<<
"--fdm=jsb"
;
// Add new argument with this: processCall << "";
processCall
<<
QString
(
"--aircraft=%2"
).
arg
(
aircraft
);
process
->
start
(
processFgfs
,
processCall
);
qDebug
()
<<
"STARTING: "
<<
processFgfs
<<
processCall
;
if
(
!
process
->
waitForStarted
())
{
qDebug
()
<<
"PROCESS START FAILED!"
;
}
//
if (!process->waitForStarted())
//
{
//
qDebug() << "PROCESS START FAILED!";
//
}
emit
flightGearConnected
(
connectState
);
if
(
connectState
)
{
...
...
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