Issues running ArduPlane in HIL mode

While trying to bring the Arduplane 3.4 into HIL Mode on Pixhawk V2 board, by setting the HIL_MODE parameter to 1 I keep getting the message “Waiting for first HIL_STATE message” in the GCS window. On doing a little investigation I found that Arduplane\system.cpp has a barometer health check method (line#551) which uses the system uptime through the call barometer.get_last_update(). The returned value from this is definitely 0 because MP is indefinitely showing this message as a result of which the Pixhawk never gets into HIL Mode.

The get_last_update() makes a call to millis() function which returns time in milliseconds from system boot up in AP_Baro_Backend.cpp. What could be the reason that the millis() function is returning zero?

I referred the following website http://dev.ardupilot.com/wiki/learning-ardupilot-threading/ and the high resolution timer function should be doing this update. I did find millis() tracing back to PX4Firmware/unittests/hrt.cpp. Am I looking at the correct implementation of millis() as this function resides in multiple system.cpp files targeted for each platform (viz. APM, VRBRAIN, PX4 etc.)

I am genuinely stuck up debugging this and any help is appreciated.

One thing to check is that JSBSim didn’t crash or fail to start. Sometimes bad parameters (e.g. --fgout without an IP:Port) will crash it. Or, if there is a zombie JSBSim process hanging around. Depending on how your start it and under which platform, you may not see the diagnositic messages. I’ve been using Cywin and Ubuntu; do a ps | grep JSBSim to see if there’s one hanging around. They are supposed to be 'pkill’ed off at the beginning of the HIL script, but it’s worth checking.

I think this is an issue with AP 3.4 and higher. I’ve tried 3.4 and 3.5 and it sticks there; 3.3.0 does not. I have not tried anything older. The code base I cloned is 3.4 for my SITL work so looking at this code may be find something.

@shouvik1984 , @brickster86 were either of you guys able to come up with a solution?

I haven’t tried this again; for most of my companion computer development, I am connecting to the SITL instance of ArduPlane via UDP. I have also tried serial and that works as well (if you setup a serial connection in SITL). I would like to get the HIL working so I could actually have the RC outputs connected to control surfaces to visually verify things.