New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X Plane HIL unable to work #5651

Open
ruyi7952 opened this Issue Oct 12, 2016 · 63 comments

Comments

Projects
None yet
@ruyi7952

ruyi7952 commented Oct 12, 2016

HW: PixHawk 2.4.7 CUAV Clone
FW: Standard
X-Plane 9.70 / 10.51r1

I have read http://www.pixhawk.com/users/hil to do this one.

BTW,No Throttle No Ailerion No Elevator No Rudder in X-Plane, I can ben sure my RC on air ,The ground station is correct 。

why?

@dagar

This comment has been minimized.

Member

dagar commented Oct 13, 2016

Has this ever worked for you? Did you select the HIL plane airframe? When you press connect in QGC does the map location match xplane? Are you able to arm from RC?

@ruyi7952

This comment has been minimized.

ruyi7952 commented Oct 13, 2016

Airframe: SIM-XPlane ,
QGC location ok, with xplane 10.51r1 , XPlane 10.45/10.50 map error,
Yes arm 。

@dagar

This comment has been minimized.

Member

dagar commented Feb 16, 2017

@ruyi7952 can you try this again with latest PX4 and QGC? I believe it's working again.

@zthorson

This comment has been minimized.

Contributor

zthorson commented Feb 17, 2017

I am seeing the same issue attempting an HIL simulation using a pixhawk board with no sensors, actuators, or RC connected. I have disabled all circuit breaker checks, which allows me to arm.

This is for a fixed wing simulation.

Symptoms

  • Similar to ruyi7952.
  • XPlane 10 packets at ~30 Hz
  • Location in XPlane matches QGroundcontrol. Simulated attitude and gps location match as well
  • Enable sensor level HIL and USe newer actuator format is checked
  • Arm/Disarm commands are accepted
  • Setting up a mission and arming results in messages saying 'starting missions' and 'taking off' but no motion is shown in QGroundControl or XPlane
  • If I manually fly the plane in XPlane, the location tracks correctly in QGround control.
    • The link just doesn't appear to work the other way (QGroundControl managing flight)
    • 'Use newer actuator format' must be unchecked for me to do this, otherwise something is fighting and pushing my throttle back to 0. This makes me think QGroundcontrol has throttle control, but for some reason isn't using it at the start of a mission.
  • Using virtual joystick and Manual mode would not change the throttle setpoint in XPlane after arming the plane. Though the joysticks could arm/disarm the motor.
  • Attempting a manual 'Takeoff' mode command results in a few messages:
    • Info: Taking off
    • Critical: Using minimum takeoff altitude: 25.00 m
    • Critical: Takeoff denied, disarm and retry

Hardware:

  • Pixracer Based Board (Flight Tested and working)
  • USB Data Connection
  • No other connections to board

Software/Firmware:

  • Windows 10 Platform
  • XPlane 10.51r2 (build 105101 64-bit)
  • XPlane Model: HiLStar17
  • QGroundControl: Tried 3.1.0, 3.1.3
  • PX4 Firmware: Tried 1.5.5, 1.6.0rc1 and 1.6.0dev (master)
@zthorson

This comment has been minimized.

Contributor

zthorson commented Feb 23, 2017

I found the issue. It is very specific to PX4FMU_V4 hardware builds. The bug is related to a workaround to flaky boards was put in place in 021f084 about 8 months ago.

Basically, if you are using Pixracer (or variants thereof), when you attempt to enter HIL mode, the code meant to reset the sensors leaves the fmu driver running. This uses up the /dev/pwm_output0 file structure, preventing pwm_out_sim from registering to it, causing the simulated pwm not to run. This resulted in the simulator not being able to control throttle or other control surfaces.

I am going to look into having the sensor_reset call to the px4fmu driver shut down and clean up after the lines have been reset. I can't think of a case where you would want the sensor_reset command to leave the fmu driver running, since it gets fully configured in a later step of the rcS script anyway.

@ruyi7952 I will try to get a pull request in next week, but if you would like to try it on your hardware sooner, I can send you a firmware file with the changes.

zthorson added a commit to zthorson/Firmware that referenced this issue Feb 27, 2017

px4fmu-v4: Fix for HIL Unable to Set Control Surfaces. Fixes PX4#5651
The sensor_rest command added to the startup script for px4fmu_v4 hardware
was leaving the /dev/pwm_output0 driver open.  This would prevent the
pwm_out_sim module from registering as a simulated driver.  The result
would cause the system to properly boot in HIL mode, but you would not
be able to set any control surfaces.

Since sensor_rest and peripheral_reset are only used on initialization, the
drivers can be shut down after they have performed their reset functions.

Signed-off-by: zthorson <zachthorson@gmail.com>

intgyl pushed a commit to intgyl/Firmware that referenced this issue Mar 7, 2017

px4fmu-v4: Fix for HIL Unable to Set Control Surfaces. Fixes PX4#5651
The sensor_rest command added to the startup script for px4fmu_v4 hardware
was leaving the /dev/pwm_output0 driver open.  This would prevent the
pwm_out_sim module from registering as a simulated driver.  The result
would cause the system to properly boot in HIL mode, but you would not
be able to set any control surfaces.

Since sensor_rest and peripheral_reset are only used on initialization, the
drivers can be shut down after they have performed their reset functions.

Signed-off-by: zthorson <zachthorson@gmail.com>
@ruyi7952

This comment has been minimized.

ruyi7952 commented Mar 11, 2017

Thanks for your (@zthorson) reply.
I am using:
Futaba T18SZ with firmware version 2.0,
X Plane 10.51r2,
QGroundControl Tried 3.1.3,
PX4 Firmware: 1.6.0dev (Master),
PixHawk v2.4.7 with PX4FMU_V2 (Not PX4FMU_v4).

my computer runing windows 7 pro sp1 and macos 10.12.
The same problem, no progress.I was dizzy ……
Sorry for the inconvenience.Could you send me for your parameter file?

dagar added a commit to dagar/Firmware that referenced this issue Mar 13, 2017

px4fmu-v4: Fix for HIL Unable to Set Control Surfaces. Fixes PX4#5651
The sensor_rest command added to the startup script for px4fmu_v4 hardware
was leaving the /dev/pwm_output0 driver open.  This would prevent the
pwm_out_sim module from registering as a simulated driver.  The result
would cause the system to properly boot in HIL mode, but you would not
be able to set any control surfaces.

Since sensor_rest and peripheral_reset are only used on initialization, the
drivers can be shut down after they have performed their reset functions.

Signed-off-by: zthorson <zachthorson@gmail.com>
@fernandourrets

This comment has been minimized.

fernandourrets commented Apr 23, 2017

Hello!!!! I've the same problem's Ruyi7952!!!! Please help me out!!!!! I'm working three days ago!!!! I'm so tired, please!!!!!!!!!!!!!!!! I don't want to give up!!!!! I just want to use the simulator!!!! Thanks a lot for your answer. Fernando

@dagar

This comment has been minimized.

Member

dagar commented Apr 23, 2017

@fernandourrets have you tried PX4 master?

@fernandourrets

This comment has been minimized.

fernandourrets commented Apr 24, 2017

Hello Dagar!!! Nice to meet you, not really, where can i download that Firmware???

@fernandourrets

This comment has been minimized.

fernandourrets commented Apr 24, 2017

I can Arm from my RC in the HIL but the throtlle, yaw, roll and pitch doesn't respond and if i make a Mavlink inspector the RC channels responding very well!!!! thks again

@dagar

This comment has been minimized.

Member

dagar commented Apr 24, 2017

First make sure you have the latest QGroundControl (http://qgroundcontrol.com/downloads/). Then go to the firmware tab under settings to flash the latest PX4, except select Advanced and look for master.

@fernandourrets

This comment has been minimized.

fernandourrets commented Apr 24, 2017

The Qgroundcontrol version is v3.1.3 and the firmware that i have available is PX4 standard version (stable), beta testing (beta) or Developer Build (master)

@fernandourrets

This comment has been minimized.

fernandourrets commented Apr 24, 2017

Done!!!! The master firmware is loaded....1) i must to calibrate all the sensors with Plane airframe and then switch to Simulation Hilstar (xplane)??????

@fernandourrets

This comment has been minimized.

fernandourrets commented Apr 24, 2017

I made everything with Master firmware but every time the accel, gyro, mag, etc became descalibrated, i can't do nothing!!!! Hellllllllp!!! Thanks

@fernandourrets

This comment has been minimized.

fernandourrets commented Apr 24, 2017

I must to go back and reload the Beta Firmware!!!! I can Arm by my RC Spectrum DX7 but doesn't respond the throttle, yaw, roll and pitch, if i select the Analyze function in the Widgets, select the rc channels and responds ok!!!!! I don't know what to do!!!!! Thanks again

@TheRibbonRed

This comment has been minimized.

TheRibbonRed commented Aug 23, 2017

@fernandourrets if you're still after HIL, you might wanna check out PX4 Flight Stack version 1.5.5. It works completely with HIL. It seems the ver 1.6.5 has another HIL bug in it that's yet to be resolved.

You can find the previous versions of PX4 Flight Stack on its GitHub:
https://github.com/PX4/Firmware/releases

@fernandourrets

This comment has been minimized.

fernandourrets commented Aug 23, 2017

@1MSG1

This comment has been minimized.

1MSG1 commented Aug 30, 2017

@TheRibbonRed confirming that it's still inoperable. I'm able to arm (after lots and lots and lots of finessing it) but initiating a sequence in QGCS is impossible. Throttle locks to 50% and control surfaces don't respond to inputs.

@TheRibbonRed

This comment has been minimized.

TheRibbonRed commented Sep 1, 2017

@1MSG1 did you try loading the PX4 Flight Stack version 1.5.5 manually? Via "custom firmware" option? The PX4 team already made the .px4 firmware and zipped it, all you have to do is download from the GitHub and choose the firmware that suits your board.

As far as I know, the 1.6.5 version still has HIL bugs.

@1MSG1

This comment has been minimized.

1MSG1 commented Sep 2, 2017

@macfly1202

This comment has been minimized.

macfly1202 commented Sep 13, 2017

Hi, I'm still looking for HIL with last px4 firmware. Same issue as describes above.
I successfully run HIL mode with PX4 1.5.5 but mission loading doesn't work aka activating "mission" after waypoint sync put the HIL UAVin "land" mode.
Does anybody know the last "more" complete/running firmware version of Hil mode ?

thanks

@1MSG1

This comment has been minimized.

1MSG1 commented Sep 13, 2017

@macfly1202

This comment has been minimized.

macfly1202 commented Sep 13, 2017

@1MSG1 : I'm speaking about qgroundcontrol : it's what I use ! Have you sucessfully load waypoint/run mission from qgroundcontrol ? In my case, each attempt hil uav go to land mode.

@1MSG1

This comment has been minimized.

1MSG1 commented Sep 13, 2017

@macfly1202

This comment has been minimized.

macfly1202 commented Sep 15, 2017

Sorry for late answer - miss message.
So I successfully run HIL mode with PX4 1.5.5 but mission loading doesn't
work aka activating "mission" after waypoint sync put the HIL UAVin "land"
mode.
What do you mean with "tried to flash a new SD card with the older firmware?"
I flashed my pixfalcon with px4 1.5.5 and Hil basic command works with X plane 10 but impossible to launch a mission after sync : go directly to landing.

@fernandourrets

This comment has been minimized.

fernandourrets commented Oct 13, 2017

@LorenzMeier

This comment has been minimized.

Member

LorenzMeier commented Mar 13, 2018

@dagar Are you using this setup?

@macfly1202

This comment has been minimized.

macfly1202 commented Mar 13, 2018

Thanks LorenzMeier. I test with Pixfalcon, PX4 FMU V2 1.5.5 stable, perfectly working with hilstar. Will test with latest build stable on this hardware now.

@LorenzMeier LorenzMeier reopened this Mar 13, 2018

@macfly1202

This comment has been minimized.

macfly1202 commented Mar 13, 2018

I confirm even on PX4 FMU V2, latest stable build have no RC command in HIL mode.
I haven't V1(is it still exist?) and V3 to test...

So only PX4 V2 FMU on 1.5.5 is working as now.

I love to test, seriously, don't hesitate to ask me !
Thanks !

@macfly1202

This comment has been minimized.

macfly1202 commented Mar 14, 2018

fyi PX4 V2 FMU is sucessfully tested with xplane 11, like 10, same setup. Hil config Receive rate reach 37Hz (max), avg 31Hz on my config (versus 19 Hz max on xplane 10).
capture

@acfloria

This comment has been minimized.

Member

acfloria commented Mar 15, 2018

The problem is that the mixer is missing. The mixer was accidentally deleted just before the v1.6.4 release. I added it again but that was after the last stable release. So you either should use the master branch or add that mixer to the code, build and flash then that version. In our group we are using X-Plane for HITL simulation. On a good enough computer it will run but you will need data at about 100 Hz otherwise the estimator will complain. To increase the data rate you should decrease the graphics options (such as visibility, cloud details,....) in X-Plane and deactivate vsynch in your graphics driver.

@macfly1202

This comment has been minimized.

macfly1202 commented Mar 15, 2018

Congrats for reactivity @acfloria
Ok with travis master build at this day: RC command are working on px4 v4 under HIL now.
About Xplane, I'm using all max details and option (:-)) in general ...
I will try to desactivate option like you suggest but normally I have a quick powerfull graphic card I use for Deep Learning : nvidia 1080ti with suffisant ram (64gb) and 6 cores dual @ 3.2Ghz ... It must be sufficiant. Graphic renderer send back info to qgroundcontrol as you seem to suggest ?I have a look here https://dev.px4.io/en/simulation/hitl.html trying to understand what is slowing the system : UDP ? Will test you suggestions.
Thanks a lot !

@macfly1202

This comment has been minimized.

macfly1202 commented Mar 15, 2018

Another feed back : RC command are working on px4 v4 under HIL (master dev build) ...but there is no stabilization mode. All stabilized and auto mode crash plane (stabilzed, position, altitude, ). Like if there is no gyro. Checkbox 'Enable sensor level HIL' and 'Use newer actuator format' is checked. Same setup Rc link, xplane10 on px4 v2 stable haven't got this issue and perfectly working. So there is still an issue. sorry about that.

@acfloria

This comment has been minimized.

Member

acfloria commented Mar 15, 2018

Can you check if acc/gyro data arrives on PX4 and the estimator converged? In addition what is the data rate you get currently?

@macfly1202

This comment has been minimized.

macfly1202 commented Mar 15, 2018

There is some data. cf screenshot. I redo a RC calibration (after tested beta build that wasn't ok because asking sensor calibration) and that seem to have fight the major issue. But there is still a big lag. My major concern is more than it's perfectly working with px4v2 and behaviour really different on px4v4.

I'm not PX4 devops so do my best to answer your question.

accel
accel

gyro
gyro

Rate seem good > 100
neutral

Qgroundlogfile *.log of this sensors during short xplane session with manual to stabilized mode
20180315_13h35_px4fmuxplane_issue.log

@acfloria

This comment has been minimized.

Member

acfloria commented Mar 15, 2018

Actually the log file from the pixhawk would help more than the QGroundlogfile. One thing I can spot is the Mag0 fail Timeout warning which most probably is pointing out an issue of the estimator.

I don't have a v4 on hand so I do not know why it might work worse than v2.

@macfly1202

This comment has been minimized.

macfly1202 commented Mar 15, 2018

Could it be hardware related (my CUAV pixhack nano) ?

Here the log extract from SD for this session (normally, it's not my local time log so not sure but seem
to time of Xplane offset, I didn't notice before they are linked)

log_0_2018-2-15-06-02-22.zip

here :
https://logs.px4.io/plot_app?log=61c08dd8-3f96-4913-b88f-ddfc0b6a9310

[EDIT] will add log valid soon, previous is incomplete.

@acfloria

This comment has been minimized.

Member

acfloria commented Mar 15, 2018

On the plane the data only arrives at around 25 Hz, this definitely will cause the estimator to diverge. I suspect that it is an issue of QGC not relaying the data fast enough and producing dropouts. At least that happens when in our case when HIL fails. So I think at least the issue is not caused by your hardware alone although it could contribute to it a little as you say for v2 it works better.

@macfly1202

This comment has been minimized.

macfly1202 commented Mar 15, 2018

Log (Fail simulation) file for this error on Pixhack Nano Px4 fmu v4 : this time logs are ok

https://logs.px4.io/plot_app?log=bf2ce9c1-6ea5-4bcc-8155-a29de77da9dc

log_0_UnknownDate.zip

[EDIT:] The 3d Flight path log visualizer is AMAZING ! congrats for devs who create this wonderful tool. It's clearly visualize what happen in plane attitude especially with 'Camera tracks vehicule'.
We clearly see how attitude is bad (an the difficulty I have to maintain it)
https://logs.px4.io/3d?log=bf2ce9c1-6ea5-4bcc-8155-a29de77da9dc

@macfly1202

This comment has been minimized.

macfly1202 commented Mar 15, 2018

Log (sucessful simulation) file for Pixfalcon px4 fmu v2 with Xplane and Hilstar

http://logs.uaventure.com/view/hhVUmEjhf27j6XfnNw6BMo

log_0_UnknownDate.zip

@fernandourrets

This comment has been minimized.

fernandourrets commented Mar 18, 2018

@macfly1202

This comment has been minimized.

macfly1202 commented Mar 18, 2018

Hi @fernandourrets, no problem -:)
When you say « it’s works » you mean Position and Altitude mode are ok with px4v4 and latest build ? because it’s the problem. The simulation is ok in manual mode for latest build on px4 fmu v4 but error with gyro/imu.
About 1.5.5 and px4v2, I agree it’s perfectly working.
Which firmware variants have you test ? V2 or v4 ?
Thanks for feed back !

@Dohyeung

This comment has been minimized.

Dohyeung commented May 15, 2018

Hello everyone,

I have a quick question. I am using EasyStar II, PX4 FMU V2, XPlane10, QGC and firmware 1.5.5 for HIL testbed. Then is there any way to generate RC command for control the EasyStar II in HIL mode. In advance, thank you.

@hamishwillee

This comment has been minimized.

Contributor

hamishwillee commented May 15, 2018

@Dohyeung YOu can connect an RC controller or use a joysticks/gamepads (RC will convert positions from that into MAVLink commands: https://dev.px4.io/en/simulation/#joystickgamepad-integration )

@1MSG1

This comment has been minimized.

1MSG1 commented May 15, 2018

@Dohyeung

This comment has been minimized.

Dohyeung commented May 15, 2018

@hamishwillee Thank you so much. And I have one more question. In the HIL testbed, I think the PX4 FMU does not generate PWM signal for actuators of the EasyStar II when I am just using the waypoints to control the flight. Am I correct? If I am right, could you tell me how I can activate the PWM signal for actual motors?

@Dohyeung

This comment has been minimized.

Dohyeung commented May 15, 2018

@1MSG1 Thank you. 1.5.5 is the available version for HIL testbed.

@1MSG1

This comment has been minimized.

1MSG1 commented May 15, 2018

@hamishwillee

This comment has been minimized.

Contributor

hamishwillee commented May 15, 2018

@Dohyeung @1MSG1 What makes you think that HIL is not supported? It is most definitely "supported" for a number of simulators in the current version - https://dev.px4.io/en/simulation/hitl.html#compatible_airframe

That is not to say that it works, or works particularly well. That could be a bug, in which case you would post an issue in Firmware

Thank you so much. And I have one more question. In the HIL testbed, I think the PX4 FMU does not generate PWM signal for actuators of the EasyStar II when I am just using the waypoints to control the flight. Am I correct? If I am right, could you tell me how I can activate the PWM signal for actual motors?

I do not know - I suspect that most actuators are supposed to be disabled on actual hardware and their movement sent to the simulator. The best place to ask this is either the discussion boards or Slack (#hitl channel).

@fernandourrets

This comment has been minimized.

fernandourrets commented May 16, 2018

@Dohyeung

This comment has been minimized.

Dohyeung commented Jul 16, 2018

@fernandourrets Hello fernandourrets. I am using XPlane10, QGC and firmware 1.5.5 for HIL testbed. It works well but I am trying to generate PWM signal to control actuators of Easystar II RC plane. Have you ever generated PWM signal to control actual motors of the plane?

Best regards.

@fernandourrets

This comment has been minimized.

fernandourrets commented Jul 16, 2018

@laokingshineUAV

This comment has been minimized.

laokingshineUAV commented Sep 14, 2018

fyi PX4 V2 FMU使用xplane 11进行了成功测试,如同10个相同的设置。Hil config接收速率达到37Hz(最大值),在我的配置上平均为31Hz(相对于xplane 10上的最大值为19 Hz)。
捕获
I want to know that what kind plane is used in x-plane11 in hitl

@macfly1202

This comment has been minimized.

macfly1202 commented Sep 14, 2018

fyi PX4 V2 FMU使用xplane 11进行了成功测试,如同10个相同的设置。Hil config接收速率达到37Hz(最大值),在我的配置上平均为31Hz(相对于xplane 10上的最大值为19 Hz)。
捕获
I want to know that what kind plane is used in x-plane11 in hitl

using Hilstar17F from https://diydrones.com/profiles/blogs/hilstar17-public-release
Amazingly, this old plane have a nice behaviour in Xplane.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment