-
Notifications
You must be signed in to change notification settings - Fork 480
Missing Topic: How to integrate customised Gazebo copter models into the code base #398
Comments
@jannsta1 ,@TSC21 suggested we open a standalone issue for your question in #391. Do you think you might be able to share the approach that you used to seed our documentation efforts? My experience is that it is much easier to get feedback if you say "I did it this way, is that right" than to ask for someone to start the docs from scratch. |
Hello @hamishwillee, perhaps this is a useful starting point?: Creating custom gazebo models for use with px4 sitlThere are 2 situations where this is useful. Specifying a new physical model and/or specifying a new px4 software environment. These can be achieved independently but both cases require a rebuild of the posix-configs build. Incorporating a custom physics model
Defining the px4 modules / parameters
Building with the custom model
Comments:
|
Yes @jannsta1 - definitely. I will have a proper look at this after Xmas (away today). Thank you! @TSC21 in the meantime, can you look at the advice above and comment
|
@TSC21 Appreciate you may be off on holiday. Do you think you could ETA when you might have time to discuss this/ and suggest others that might be interested in being involved? |
@hamishwillee Sorry I missed the above. I will have write some comment soon. |
Thanks @TSC21 - I'm watching you :-) |
Yeah just cleaning and tightening some stuff on |
is there any update with this issue? :) |
@TSC21 ? |
Hi, |
I found it (I believe) it is moved to ROMFS/px4fmu_common/init.d-posix, is that right? |
@kuiskas I think so. The recent changes for startup in posix and nuttx are captured in System Startup |
Some of that above is not necessary depending on what is being done or what the objective is. LPE normally shouldn't be used, you don't need a world, and you don't need to touch make. Just follow the existing models as a guide and edit models, rcs, and launch params approperately. |
@lamping7 - could you confirm the directory that a custom rcs file for a posix_sitl_default build should go (running with sitl/gazebo)? Have tried putting my custom file, 'bee', in
|
@jannsta1 it doesn't matter where you put it if you're just using a launch file to spin all this up as long as you change the parameters in the launch file to point there. |
Oh yeah, makes sense, thanks! - sorry should have gotten that. The updates to the build procedure is apparently making the code much easier to use / interface with. Its just a bit of overhead rejigging launch files and unlearning my work arounds from before. |
I've also been trying to work through this and make it work, but I'm not having much luck. In addition to the above instructions, I noticed that there's also a CMakeLists.txt in the configuration folder (Firmware/ROMFS/px4fmu_common/init.d). Changing this has not helped get things running. @lamping7 When you say that you need launch files to point to the model, which argument to the script are you referring to (the first argument or what comes after the -s)? |
@bkueng Did some magic getting all this cleaned up, but it still essentially works the same, from what I can see (correct me if I'm wrong Beat, I haven't tried my custom models with master yet (still on v1.8.0)). Here are the main PRs: PX4/PX4-Autopilot#10173, PX4/PX4-Autopilot#10222; with some minor documentation changes here #600. One new thing with launching the px4 app with a custom model is the The cool thing that was added (that you normally won't be using with a custom model is the auto rcs loading): https://github.com/PX4/Firmware/blob/719bfd10730310f3b897dd7f6f0c44d24eb3d19a/ROMFS/px4fmu_common/init.d-posix/rcS#L42. So, by default it loads the generic startup and auto selects the right one according to the vehicle. None of this matters for your custom model though. |
Additionally, in regards to "where to put the startup file" you can't just drop it in a folder anymore, like you used to be able to (my comment a few above this, may be misleading) PX4/PX4-Autopilot@273988c#diff-277741a901ccb3e1f2c296310691a8e6. You have to change the arg manually. Perhaps we should put the |
Previously the way people did it was to copy an existing rcS file and do their modifications. That partially worked because the file was self-contained. However this was never a good solution because:
Essentially you would have to maintain the whole rcS file yourself. I see 2 solutions with the new structure:
|
Yeah. That makes sense. But for now users can just maintain the whole rcS as how it previously was. |
I get some errors from a custom sdf file that previously worked OK - my sdf file is called
|
You need to either revert back to 1.8.0 or fix your startup file according to the new way all this is arranged. Those modules are not in the same place. See the PRs I posted above. |
After reading through some of the recent comments I've made some progress on this, but I'm not sure I'm understanding the whole process. I now have files for my custom airframe in both px4fmu_common/init.d and px4fmu_common/init.d-posix (since I'm trying to do SITL over our custom SDF), and both are using the unique identifier 0001 (is that allowed as an autostart ID?). PX4 no longer seems to complain about finding the vehicle, but now I am getting |
@ChuplesKai What you are doing sounds correct, but I'd have to see all your changes to be able to diagnose it. 0001 should be fine. What are your file names and what vehicle names do you use? |
OK, for a sanity check is
I think this was working before (post the build changes discussed here) but I've tried completely wiping and re-cloning the firmware and all submodules and rebuilding and I still see this error. |
Just had another look, you cannot use 0001, because the preceding 0's will be stripped.
Indeed, I broke that :/ I'll look into it, it's because of the additional |
Fix is up: PX4/PX4-Autopilot#10631 |
Have you looked at the gazebo output when passing the verbose flag in the launch file? |
@lamping7 thanks for the advice! I didn't think Gazebo was having trouble, but putting that verbose flag true reveals a very different story. Hopefully this will let me fix whatever is upset. |
Hello, does anyone know how to set and launch px4 sitl using a user-defined world file? |
There is an argument 'world' in the px4 launch files (e.g. see posix_sitl.launch) you can pass the file path of your custom world to this parameter in the usual way. |
@jannsta1 Thank-you, it works! |
@lamping7 you make a very good point where you say:
We're at the point now that the current state of this needs to be a PR. That we can work through and test. Then future change and issues can be discussions against a clear baseline. Can one of you guys volunteer to create a PR based on our current knowledge? Then we'll ask the other and @ChuplesKai if they can test those instructions. Looking at this.
Thoughts? |
PS. We know we want the structure to include topics related to modelling the motors. @TSC21 proposed some topics needed: importing an URDF from SolidWorks and convert it to an SDF, what plugins to include in the model, modelling the motors, modelling the control surfaces ... I am happy for many of these to be just TBD in the PR. But would be good if we could capture all the topic headings that we eventually intend to populate. So if there are any you would like to see, please add here. |
@lamping7 @TSC21 - Jan does not feel confident to create the initial structure of topics. Would you be willing to do so and populate with the current steps? (As discussed above: #398 (comment)) |
@hamishwillee Yeah I will do that along this week. |
I would appreciate a documnetation on how to add sensors to the copter sdf file. I'd like also to understand how to perform multi-vehicle simulation with custom sensors (i.e. one copter with camera, another with laser scanner and so on...) and how to model my own drone. Thankyou |
Nag nag nag |
@hamishwillee I have a initial structure for it but I still feel some things are missing. Been out of bandwidth, sorry. |
@TSC21 That's fine :-) I'll keep nagging. |
What I do for using my own models without creating additional PX4 is to keep the same target and |
@TSC21 And here I am again :-) |
This is not the point of the discussion here. This is rather if one wants to have a proper simulation of their vehicle, how can one add it to the PX4 SITL pipeline and Gazebo.
@hamishwillee ahah I know sorry, have been quite busy lately. |
Any progress here @hamishwillee ?? now it's my turn to nag 😝 |
@RicardoM17 That's a question for @TSC21 :-) I'm not going to even attempt to progress this without him. |
Hi, I just wondering if I want to use my own custom model, how could I create my model file after |
@TSC21 Would be nice to progress this ... |
What would that be to launch a custom vehicle with make ? |
@imagotechteam YOu post above is a technical support query, and not particularly relevant to this post. Please post on the discussion boards. |
Can also someone explain how the .sdf are generated from the .xacro? For example for the iris model it seems that the .sdf are automagically generated from .xacro (inside the /models/rotor_description/urdf) which is much more readable. |
Did you read the gazebo help pages about URDF? e.g. http://gazebosim.org/tutorials/?tut=ros_urdf. I think it's explained quite comprehensively there. I haven't used them a lot but the way I think of it is that the URDF gets converted into the .sdf, xacros are a feature of URDF. e.g. https://answers.ros.org/question/202162/urdf-or-xacro/ |
Yeah, but I'd like to understand which script (I think there is one) in the px4 firmare builds the .sdf from the .xacro and how to add custom .xacro that will build automatically the .sdf for new models. |
@tuloski https://github.com/PX4/sitl_gazebo/blob/a0b0eb8df12b11e8f63d3cc766dee97cefa32ab7/scripts/xacro.py But please if you have further questions move this to discuss. ;) This thread is not the place for it. |
@RicardoM17 I think this is the thread, because in the documentation of how to integrate customized models I'd like to see explained how to use xacro instead of sdf. Moreover on discuss none ever answer :) . |
From #391 "Another nice to have would be how to integrate customised gazebo quadcopter models into the code base. Took me a bit to figure that out and I’m still not sure that I’m following best practices."
The text was updated successfully, but these errors were encountered: