Skip to content

Commit

Permalink
MAVLinkHILSystem: remove cont. init on heartbeat
Browse files Browse the repository at this point in the history
We shouldn't initialize every time we receive a heartbeat but only the
first time. This worked for SITL because we only send heartbeats until
initialized, however, for HITL we keep sending them.
  • Loading branch information
julianoes committed Jan 8, 2019
1 parent b5bb445 commit 7598065
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/me/drton/jmavsim/MAVLinkHILSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,16 @@ public void handleMessage(MAVLinkMessage msg) {
if (sysId < 0) {
sysId = msg.systemID;
}

System.out.println("Init MAVLink");
initMavLink();

} else if (sysId > -1 && sysId != msg.systemID) {
System.out.println("WARNING: Got heartbeat from system #" + Integer.toString(msg.systemID) +
" but configured to only accept messages from system #" + Integer.toString(sysId) +
". Please change the system ID parameter to match in order to use HITL/SITL.");
}
}
if (gotHeartBeat) {
System.out.println("Init MAVLink");
initMavLink();
}
if ((msg.getInt("base_mode") & 128) == 0) {
vehicle.setControl(Collections.<Double>emptyList());
}
Expand Down

0 comments on commit 7598065

Please sign in to comment.