Skip to content
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

support fixed-wings in new Gazebo(gz or ignition gazebo) #20939

Merged
merged 10 commits into from
Jan 24, 2023
Merged

Conversation

Jaeyoung-Lim
Copy link
Member

@Jaeyoung-Lim Jaeyoung-Lim commented Jan 15, 2023

Solved Problem

Currently, the new gazebo does not support fixed-wing / VTOL type vehicles due to the missing interface for the lift drag plugin

As we want to support the new Gazebo moving forward, this is one of the major features that is missing before we can switch to the new gazebo.

Fixes #20836

Solution

I took the plane model in https:/PX4/PX4-Autopilot/tree/pr-gz-bridge-airspeed from @ahcorde and modified it so that the joint angles can be controlled via the px4 gz_bridge

What was done:

  • Added a airframe config for the plane model
  • Modified the plane model to have correct thrust directions
  • Added a joint controller to take care of the control surface deflection
  • Added a servo control publication in gz_bridge to publish joint position commands for the control surfaces. Joint names need to strictly follow a naming convention px4_servo_<i> depending on the index

Test coverage

To test,

make px4_sitl gz_plane

Video of first flight: https://youtu.be/4heMHqKiYUI
First Flight

Still Unresolved issues

  • Tune Flight Controls
  • The servo outputs are non-dimensional, but the control surface deflections are in joint angles.
  • It is still unclear what the development workflow would look like if someone is to develop on gazebo plugins. Current workflow does not include custom plugins
  • Add airspeed sensor

Jaeyoung-Lim and others added 8 commits January 14, 2023 19:00
To test airspeed plugin the relevant lines need uncommented in models
and worlds.

Signed-off-by: Benjamin Perseghetti <[email protected]>

Co-authored-by: Alejandro Hernández Cordero <[email protected]>
@Jaeyoung-Lim Jaeyoung-Lim changed the title Support planes in Gazebo(gz) Support fixedwings in new Gazebo(gz or ignition gazebo) Jan 15, 2023
@Jaeyoung-Lim Jaeyoung-Lim changed the title Support fixedwings in new Gazebo(gz or ignition gazebo) [WIP] Support fixed-wings in new Gazebo(gz or ignition gazebo) Jan 15, 2023
@bperseghetti
Copy link
Member

Nice, I've worked on adding functionality to the joint position controller system to control groups as well as use subtopics that inherit the model name. I also made the Ackermann steering plugin behave the way we want it to allowing for phi (center steering angle published as a double)

@Jaeyoung-Lim
Copy link
Member Author

Jaeyoung-Lim commented Jan 15, 2023

Nice, I've worked on adding functionality to the joint position controller system to control groups as well as use subtopics that inherit the model name. I also made the Ackermann steering plugin behave the way we want it to allowing for phi (center steering angle published as a double)

Great! Is this somewhere I can use? or are you saying that this is already what I am using?

adding functionality to the joint position controller system to control groups

I would like to start separating motors(velocity control) and servos (joint control), but I think we need to make the distinction on the gz_bridge with control allocation first

@bperseghetti
Copy link
Member

bperseghetti commented Jan 15, 2023

Nice, I've worked on adding functionality to the joint position controller system to control groups as well as use subtopics that inherit the model name. I also made the Ackermann steering plugin behave the way we want it to allowing for phi (center steering angle published as a double)

Great! Is this somewhere I can use? or are you saying that this is already what I am using?

adding functionality to the joint position controller system to control groups

I would like to start separating motors(velocity control) and servos (joint control), but I think we need to make the distinction on the gz_bridge with control allocation first

Yep, that's what I'm working on. Haha
Here is what we needed for Ackermann: gazebosim/gz-sim#1860
Here is my work for multiple joint_name and sub_topic for joint-controller and joint-position-controller:
https:/rudislabs/gz-sim/tree/pr-multi-joint-with-subtopic

I'll finish implementing the joint-controller later today, but the joint-position-controller works perfect.
I also have a more updated buggy and plane model using them.

@bperseghetti
Copy link
Member

@Jaeyoung-Lim @dagar Here is what will allow us to do multi-vehicle like what I enabled for the multicopter:
gazebosim/gz-sim#1861
gazebosim/gz-sim#1860

@ahcorde
Copy link
Contributor

ahcorde commented Jan 16, 2023

When I execute

make px4_sitl gz_x500

I got this error:

INFO  [dataman] data manager file './dataman' size is 7866640 bytes
INFO  [init] starting gazebo with world: /tmp/PX4-Autopilot/Tools/simulation/gz/worlds/default.sdf
WARN  [init] PX4_GZ_MODEL_NAME or PX4_GZ_MODEL not set using PX4_SIM_MODEL.
INFO  [gz_bridge] world: default, model name: plane_0, simulation model: plane
libEGL warning: DRI2: failed to create dri screen
libEGL warning: DRI2: failed to create dri screen
ERROR [gz_bridge] Service call timed out
ERROR [gz_bridge] Task start failed (-1)
ERROR [init] gz_bridge failed to start
ERROR [px4] Startup script returned with return value: 256

</ode>
</physics>
</joint>
<joint name='rudder_joint' type='revolute'>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<joint name='rudder_joint' type='revolute'>
<joint name='px4_servo_4' type='revolute'>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Jaeyoung-Lim
Copy link
Member Author

Jaeyoung-Lim commented Jan 16, 2023

ERROR [px4] Startup script returned with return value: 256

This means that it cannot find the airframe config in ROMFS

@ahcorde Could you make sure you did a make clean or make distclean so that the airframe configs are copied into the build directory?

@ahcorde
Copy link
Contributor

ahcorde commented Jan 16, 2023

I merged with main, but I removed the merge and it's working. thank you

@dagar dagar self-assigned this Jan 23, 2023
@dagar dagar marked this pull request as ready for review January 23, 2023 14:40
@dagar dagar changed the title [WIP] Support fixed-wings in new Gazebo(gz or ignition gazebo) support fixed-wings in new Gazebo(gz or ignition gazebo) Jan 23, 2023
@dagar
Copy link
Member

dagar commented Jan 24, 2023

Needs more work (tuning, Fortress support questions, etc), but this should be good enough to merge into main so we can continue iterating.

@dagar dagar merged commit 644aeb9 into main Jan 24, 2023
@dagar dagar deleted the pr-gz-plane branch January 24, 2023 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gazebo VTOL and fixed wing plane support
4 participants