Starting simulation with own model

#1

Hi,
We are using your Firmware to control our autonomous underwater vehicle (called hippocampus). I am trying to start the gazebo simulation (without ROS) with the model of our AUV, which has been added in the sitl_gazebo submodule. With the command

make posix_sitl_default gazebo

the code is build and the simulation of the quadrotor starts. What do I have to adjust to start the simulation with the model of our AUV?

Best regards
Nils

#2

The gazebo simulation is a submodule in the firmware repository here - https://github.com/PX4/sitl_gazebo/tree/19d5b87aca42b01cced8155a44808f7078763414

Start by looking at how an iris vs standard_vtol is setup and used, then duplicate for your vehicle.

#3

Hi dagar,

thanks for your answer. I solved my problem.

Best regards
Nils

#4

Hi @NRottmann. I am also trying to simulate my own airframe but unable to start it using “make posix_sitl_default” Can you please tell me the steps to get the simulation working?
Thank you.

#5

Hi @Swapneel17

I have written a manual for the Gazebo simulation based on the PX4 Firmware. You can find it here (https://docs.google.com/document/d/1KRxgbc1UnTXRTV_YcbbGfYtmau41Ry7tIlQaMR1e0ec/edit?usp=sharing). I recommend you to go through it. If you have any questions regarding the manual or which files do you have to adapt in order to make your own model work, just feel free to ask me again.

Best regards
Nils Rottmann

#6

Nice! Would you like to put it in the official developers guide? https://dev.px4.io/en/

FYI @hamishwillee

#7

@dagar

Hi, I can add it, but it is based on our Model of an autonomous underwater vehicle (AUV). The manual recommends to get my modified submodule of sitl_gazebo (which may be not up to date with the actual sitl_gazebo submodule) as well as our modified version of the PX4 Firmware (just added a start_up script and some applications, but this may also be not up to date with the actual PX4 Firmware).

Best regards
Nils

#8

Thank you very much @NRottmann. It solved my problem.

#9

@dagar

I would abstract the guide a bit and then I can put it on the official developers guide. How and where shall I add this?

Best
Nils

#10

Hi @NRottmann (& @dagar),

Awesome. The docs should certainly be abstracted and refer only to official repo’s.

The existing doc on Gazebo we have on gazebo is here. The best thing would be to merge your instructions into those (this may be tough given that they are structured differently). Can you have a first look at how this might be best achieved. If you find that hard let me know and I’ll take a shot at it (very happy to do so).

Ideally the end result would be generic instructions, with a section on running the simulator for your sub much like the other ones here.

NOTE: On quick scan my take on the current PX4 docs is that they are very “thin and linky” meaning that there is the assumption you will be happy to go to linked docs and find required dependencies etc. While this approach has the benefit that you link to official docs that should be kept up to date, in this case it looks like the linked docs make a lot of assumptions about your existing knowledge of gazebo packaging/dependencies. Upshot, I’d be more than happy to extend our docs with your approach explicitly listing out dependencies and how things are installed (unless there is strong disagreement from others)

Let me know how/when I can help. I’m at hamishwillee at gmail dot com if you want to discuss offline.

Cheers
Hamish

#11

Hi guys,

I will try to abstract the manual but this may take some time. I will be getting in touch as soon as I am ready with the first version.

Best regards,
Nils

#12

Thanks very much. Here if you need help. I’m a good “dumb tester” of instructions :slight_smile:

#13

@hamishwillee

Hi I have started to adjust the manual. Therefore I just copied the actual manual from the devGuide and included some parts of my manual. It would be nice if you can test and commend it.

https://docs.google.com/document/d/1nDQzA-2e8pno8hQj4iuCoBUhcHooqf7oKZbT3rSSBls/edit?usp=sharing

Also if I start the simulation using

roslaunch px4 posix_sitl.launch

I get the error message

WARN  [modules__systemlib__mixer] file not found
ERROR [mixer] can't load mixer file: ROMFS/px4fmu_common/mixers/quad_dc.main.mix
ERROR [mixer] failed to load mixer

since the mixer can not be found.

Best Nils

#14

Thanks Nils. I probably won’t find time until early next week. Feel free to remind me if you don’t hear back by late next week :-0

#15

Hi,

I have just added the simulation for our own underwater vehicle to the fork repository of the actual Firmware. I will have a look into your comments to the manual next week.

Best
Nils

#16

@dagar, @hamishwillee

I have added our own autonomous underwater vehicle to the actual Firmware (sitl_gazebo submodule and PX4 main). I would be glad to write a manual (as proposed before) with an additional example section for an own simulation model. Is it possible to add our model of the AUV to the Firmware?

Best
Nils Rottmann

#17

@NRottmann I am working on getting a tiltrotor tricopter running. In my setup the model tree is as follows:

  • Baselink
    ----FR Motor
    ----FL Motor
    ----Servo for back motor
    ---------back motor

The problem that I am facing is that the back motor cannot be controlled if I set a channel in the mavlink_controller plugin for the servo. Only if I lock the joint and remove the channel, I am able to actuate the back motor.

I see you have some experience in modifying the code for your custom frame. Any advice as to how to get this working ?

Thanks in advance.

#18

Yes I think that would be fine. I’m curious to see how you implemented an underwater vehicle.

#19

@dagar

nice, I will just fix some further issues. I hope I am done at the end of the week. How will it work? Shall I just send a pull request?

BTW: Do you know how to enable reverse thrust such that the output is from [-1 to 1] instead of [0 to 1]?

Best Nils

#20

@ganeshrk95

I am not quite sure if I have understood your problem, but maybe you can just write a plugin for gazebo which replaces the servo for the back motor.

Best
Nils