I’m trying to implement an inverted pendulum on a custom quadrotor in Gazebo-Classic. This is my first time using Gazebo.
The quadrotor is done with the PX4 flight stack and I verified that it flies as intended in Gazebo. Now, I’m trying to put an inverted pendulum on top of the quadrotor and have the quadrotor to balance the pendulum. For the mounting method, I’m just going to use an empty cup. In other words, there will be no actual “joint” for mounting the pendulum on the drone. The pendulum will be inserted into this small empty cup since that’s how I will simulate in the real world.
I would appreciate help in the following parts:
How to put the pendulum on top of the quadrotor as a different entity. Again, there is no physical link between the two entities.
How to “start” the pendulum dynamics. Once the quadrotor takes off and has the custom controller started, I would like the pendulum to “appear” on the quadrotor in vertical position. Then the quadrotor controller will try to balance it. This is how I will run hardware experiments: have the quadrotor in stable hovering, start custom controller, and put the pendulum in the mount.
Hi @fasdf , as this is your first time using Gazebo, you should consider removing the cup and link the pendulum to the drone with a universal joint.
Using the cup would require a lot of work on the collision geometry of the cup and the pendulum to allow one to sit on the other.
To start the simulation you could also add a fixed joint between drone and pendulum and programmatically disable it when you want to free the pendulum.
Hi Benja, thank you for your response.
I am following your recommendation and am working with a universal joint. I am running into problems, however. I have a custom drone model named “danausA” and it runs well when I build it using PX4 SITL: make px4_sitl gazebo-classic_danausA. I added a universal joint for this pendulum in the SDF file for danausA to see how it’s rendered. I named this custom model “danausA_pend”. Now, when I run make px4_sitl gazebo-classic_danausA_pend, Gazebo does not give me anything! It doesn’t give me an error message nor renders the drone at all.
Hi @Benja, thank you for the quick response. I have not pushed my code yet and will do so shortly this week.
As for the universal joints, it is working well now - I simply missed a </inertia> line.
I am now trying to dynamically disable the fixed joint as you recommended. If you have any suggestions, please let me know. I am currently looking into DetachableJoint as suggested by this post, but am not sure if this is a supported feature in Gazebo Classic.