HITL simulation

I installed again, and follow this steps:

1-git checkout -b tags/v1.7.0

2-git submodule update --init --recursive

3-make px4fmu-v2_default

But doing this I’m still working on firmware 1.8.0, as you can see in the figure below:

sorry I didn’t post something before, i got sick last week. Anyway i follow a diferent step, that make me able of see a different px4 version when i tried to build.

1 - git checkout v1.7.0

2 - git submodule update --init --recursive

And than i was able to see the px4 version v1.7.0, but i can’t find the serial enable and the serial device in sdf file.

Thankyou Tiago for the update…!
I don’t know why you can’t find these tags in the sdf… Are you sure the sdf file is correct (Tools/sitl_gazebo/models/iris/iris.sdf)?

Yes, i think this is happening because i donwgraded the firmware. Are you sure that you’re using the firmware v1.7.0 ?

Thank you for reply Matteo.

Hi @Tiago, I’ve checked the firmware version and you are right, the firmware version was not downgraded…Now I have installed v.1.7.0 and I confirm I don’t have serialEnablend and serialDevice in iris.sdf (see the picture: 1.7.0 on the left, 1.8.0 on the right)… How about try to add them in the sdf? @mehdy do you think is enough?How did you manage this problem?
@Tiago, I’m travelling and I don’t have a pixhawk board to test it until next week, i’ll update you asap…

Hi @Tiago, @Matteo_Scanavino I downloaded the last version of PX4 then I downgraded to version v1.7.0 and I did make posix_sitl_default gazebo then I searched for the iris.sdf file and I did find the serialEnabled and serialDevice in it. I don’t know why you can’t find it!!!

@mehdy I suspect your downgraded was not successful… By the way, you were able to lunch HITL… which version of ROS and Gazebo didi you use? Did you upload v1.7.0 also for the px4 board, right? Thankyou

@Tiago I’ve followed @mehdy suggestions and I was able to launch the HITL. I can arm the copter using my RC however, the drone still doesn’t takeoff…

@Matteo_Scanavino I have the same problem too. But i tried run jmavsim HIL on version v1.7.0 and worked today. In gazebo it dosen’t takeoff and i only can see that drone is arming and desarming, but on simulator it stay in the ground.

Hello @Tiago, thankyou for the update. I suspect it is a firmware problem… I’m happy to hear you were able to run HIL on jmavsim. However, I need Gazebo…
I’ve post the problem here, for now I didn’t tried yet.

Hello @Tiago, finally I was able to takeoff the copter in Gazebo HITL. I’ll try to explain you what I have done.

  1. completly remove src/Firmware directory
  2. git clone https://github.com/PX4/Firmware -> it will clone v1.8.0
  3. make px4_sitl_default gazebo -> check that SITL is working
  4. git checkout v1.7.0 -> downgraded to v1.7.0
  5. git submodule update --init --recursive
  6. make px4fmu-v2_default upload -> upload firmware in Pixhawk 1 (I checked the version and it was 1.7.0, as expected)
  7. follow steps reported in px4 HILT tutorial

I’ve noticed that downgrading the firmware version will not overwrite iris.sdf file in Tool/sitl_gazebo/models/iris/. So I was able to find the tags , and <hil_mode> as reported in the HITL wiki.

I hope it will help you…!
@hamishwillee I would suggest to update HITL px4 wiki and explain that v1.8.* don’t work…

1 Like

Thanks @Matteo_Scanavino

I would suggest to update HITL px4 wiki and explain that v1.8.* don’t work…

I first need to confirm if any work is being done to fix it (as that will change the content of the note)

Actually @Matteo_Scanavino - have you created an issue for this yet? If so, can I please have the URL (or can you create one). If no one creates and issue then the dev team may not be working on it.

I could create it, but then it would be anecdotal, and if there are any questions about the setup, I can’t answer them.

FYI, might be the same as this closed one https://github.com/PX4/Firmware/issues/10813

Hello @Matteo_Scanavino, I’m trying to follow your steps but I could not do it. When you follow px4 HILT tutorial (https://dev.px4.io/en/simulation/hitl.html), you make px4_sitl_default gazebo again? becouse this is failing for me.

Thanks again

Yes I made it to check SITL was working before modify the sdf file and set HITL

I didn’t create a new issue. Actually everthing is reported in this discussion…

Hi @Matteo_Scanavino, I’m still trying HIL in gazebo in 1.7.0 firmware, but until now every time that i do make posix_sitl_default gazebo the sdf file get overwrited (becouse the command px4_sitl_default apeare dont exist)

Thanks

Hi @Tiago, I had been facing the same issue of the model not taking off in HITL. Here is my setup and steps which finally worked.

  1. Downgrading Gazebo9 to Gazebo7.
  2. Downgrading the PX4 firmware from v1.8*** to v1.7.0 from git. https://github.com/PX4/Firmware/releases/download/v1.7.0/px4fmu-v2_default.px4
  3. Flashed the above firmware from step 2 using Qgroundcontrol v3.5.0
  4. Cloned the latest firmware from git using git clone https://github.com/PX4/Firmware.git
  5. make px4_sitl_default gazebo
    6.This opens a gazebo window. I closed it.
  6. In a new terminal, source Tools/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default
  7. Edit the .sdf file as mentioned in the HITL guide.
  8. Launch using: gazebo Tools/sitl_gazebo/worlds/iris.world

In summary, Gazebo7 works with v1.7.0 firmware and steps from HITL guide on latest branch. Hope this helps.

The problem with the latest bits is that the pwm_out_sim module was removed from the default configuration for px4fmu-v2_default.px4. You can add it back by editing cmake/configs/nuttx_px4fmu-v2_default.cmake and uncommenting the line:

#drivers/pwm_out_sim

Then rebuild, or you can download the new firmware I built from my OneDrive download.

Can you please share how you downgraded from Gazebo9 to gazebo7. Thanks