DroneKitPX4 example code with HILS is not working

Does anyone successfully use DroneKitPX4 example code from https://dev.px4.io/dronekit-example.html on HILS(Hardware in the Loop Simulation) it’s seem like i am unable to change modes and in jMAVSim the copter fly up a little bit then smash to the ground. the error appeared on terminal is

python DroneKitPX4.py
Connecting

data link #0 regained
Waiting for home position…
Waiting for home position…
Type: 2
Armed: False
System status: STANDBY
GPS: GPSInfo:fix=3,num_sat=10
Alt: -0.025
Not switching off HIL (safety)
no valid mission available, refusing takeoff
Exception in message handler for HEARTBEAT
mode 67371008 not available on mavlink definition
Exception in message handler for HEARTBEAT
mode 67371008 not available on mavlink definition
no valid mission available, refusing takeoff
Exception in message handler for HEARTBEAT
mode 67371008 not available on mavlink definition
ERROR: wp index out of bounds
Exception in message handler for HEARTBEAT
mode 67371008 not available on mavlink definition
ERROR: wp index out of bounds
ERROR: wp index out of bounds
ERROR: wp index out of bounds
ERROR: wp index out of bounds
ERROR: wp index out of bounds
ERROR: wp index out of bounds
ERROR: wp index out of bounds
ERROR: wp index out of bounds
ERROR: wp index out of bounds
ERROR: wp index out of bounds
Exception in message handler for HEARTBEAT
mode 67371008 not available on mavlink definition
ERROR: wp index out of bounds
ERROR: wp index out of bounds
ERROR: wp index out of bounds
Executing mission
Takeoff to 498.0 meters above home
Exception in message handler for HEARTBEAT
mode 67371008 not available on mavlink definition
ERROR: wp index out of bounds
Link timeout, no heartbeat in last 5 seconds
Exception in message handler for HEARTBEAT
mode 67371008 not available on mavlink definition
…link restored.
ERROR: wp index out of bounds
ERROR: wp index out of bounds
Exception in message handler for HEARTBEAT
mode 67371008 not available on mavlink definition
ERROR: wp index out of bounds
ARMED by arm/disarm component command
Exception in message handler for HEARTBEAT
mode 67371008 not available on mavlink definition
[blackbox] /fs/microsd/log/2017-02-24
Exception in message handler for HEARTBEAT
mode 67371008 not available on mavlink definition
Takeoff detected
[blackbox] recording: 06_16_54.px4log
Exception in message handler for HEARTBEAT
mode 67371008 not available on mavlink definition
Exception in message handler for HEARTBEAT
mode 67371008 not available on mavlink definition
Exception in message handler for HEARTBEAT
mode 67371008 not available on mavlink definition
Exception in message handler for HEARTBEAT
mode 67371008 not available on mavlink definition

Do i need to set more parameter apart from change the Airframe to Simulation?
What is “wp index out of bounds” error? and how to fix it, currently, i have to reinstall firmware(px4) to eliminate this problem.

Thank you in advance for any kind of help and sorry for my poor English skill, hope you understand my problem.

To start with I believe you need to install the latest Dronekit and pymavlink from github.com
https://github.com/dronekit/dronekit-python
https://github.com/ardupilot/pymavlink

Hallo im.rasp,

have you been able to run the example in HILS? I face the the same issue using code downloaded in May 2017. Can you tell how to run it.

Regards,