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

Add quadrotor model linked to generated model from pipeline #89

Merged
merged 4 commits into from Jul 22, 2021

Conversation

Jaeyoung-Lim
Copy link
Member

@Jaeyoung-Lim Jaeyoung-Lim commented Jun 28, 2021

Problem Description
This PR adds the capability of linking the generated parametric model into the gazebo simulation for multirotors.

  • Added a multirotor model with the data driven dynamics plugin integrated
  • Read vehicle parameters from yaml file
  • Add rotor force calculation in the aerodynamics plugin
  • Rename fw_dynamics plugin to data-driven-dynamics-plugin
  • Test flight in SITL
  • Comparison with groundtruth parameters (Addressed in Add moment calculation for simulation #117)
  • Add rotor moment calculation in the aerodynamics plugin (Addressed in Add moment calculation for simulation #117)

Additional Context

@Jaeyoung-Lim
Copy link
Member Author

Jaeyoung-Lim commented Jul 17, 2021

@manumerous The pipeline is set(for force), but it seems like the estimated thrust is not able to lift the vehicle up from the ground.

  • Looking at the estimated parameters, I can see that the estimated thrust is significantly lower than the one that is modeled in the simulation(Gazebo MotorModelPlugin), enough to not able to takeoff or hover:

Figure_1

  • Comparison with zero input airspeed

Figure_2

This PR adds a multirotor model of the data driven dynamics model
@Jaeyoung-Lim
Copy link
Member Author

Vehicle flying in PX4 SITL with ONLY force estimation

Hovering drone

  • notice that the rotors are not spinning, due to the motor plugin not running.

@Jaeyoung-Lim Jaeyoung-Lim marked this pull request as ready for review July 18, 2021 19:34
@manumerous
Copy link
Contributor

@manumerous The pipeline is set(for force), but it seems like the estimated thrust is not able to lift the vehicle up from the ground.

* Looking at the estimated parameters, I can see that the estimated thrust is significantly lower than the one that is modeled in the simulation([Gazebo MotorModelPlugin](https://github.com/PX4/PX4-SITL_gazebo/blob/master/src/gazebo_motor_model.cpp)), enough to not able to takeoff or hover:

Figure_1

* Comparison with zero input airspeed

Figure_2

* References:
  
  * Visualization is done by `Tools/visualize_rotorfeatures.py` included in this PR
  * Parameters from default iris model: https://github.com/PX4/PX4-SITL_gazebo/blob/55e479aa80b57da850e307b0105baf0f262ec284/models/iris/iris.sdf.jinja#L353
  * Rotor thrust calculations from GazeboMotorModelPlugin: https://github.com/PX4/PX4-SITL_gazebo/blob/55e479aa80b57da850e307b0105baf0f262ec284/src/gazebo_motor_model.cpp#L224

Sorry if this was unclear. The other models, apart from the tiltwing were estimating accelerations instead of forces. But as it seems from #107 you figured that out by now. :)

@manumerous
Copy link
Contributor

manumerous commented Jul 18, 2021

Vehicle flying in PX4 SITL with ONLY force estimation

Hovering drone

* notice that the rotors are not spinning, due to the motor plugin not running.

that is very cool :)

@Jaeyoung-Lim
Copy link
Member Author

@manumerous Since this PR seems to be growing, I suggest that we merge this at the current state (flying with forces)

I have already tried adding moments and drag to the model, but this seems to be very unstable. (most likely due to having different moment of inertia in the sim and the estimation). Therefore, I will address it in a separate PR

@manumerous
Copy link
Contributor

@manumerous Since this PR seems to be growing, I suggest that we merge this at the current state (flying with forces)

I have already tried adding moments and drag to the model, but this seems to be very unstable. (most likely due to having different moment of inertia in the sim and the estimation). Therefore, I will address it in a separate PR

I can have a look at it on Tuesday. If you want to go ahead before its okay for me.

Tools/visualize_rotorfeatures.py Outdated Show resolved Hide resolved
Comment on lines +129 to +131
double vertical_rot_drag_lin{0.07444735702448266};
double vertical_rot_thrust_lin{-0.0017229667485354344};
double vertical_rot_thrust_quad{4.0095427586089745};
Copy link
Contributor

Choose a reason for hiding this comment

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

In the data-driven-dyanmics pipeline each rotor is assigned to a rotor group (e.g. vertical) whereby all rotors from the same group share the same coefficients. To distinguish the coefficients the name of the group is added before the coefficients name.

If I understand correctly this rotor parameters are not specific to multi-rotors but general? Would it not make sense to keep the naming general in that case?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is actually not feasible with the yaml parser macro in this repo. The variable name needs to be exactly the same as what you are parsing from the results file

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you plan to implement that for other models like for example the delta quadplane, which has two different groups of rotors? Could we maybe get the names of the rotor groups out of the config file and then generate the variables needed to access all the values?

Copy link
Member Author

Choose a reason for hiding this comment

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

@manumerous I am not sure - I have not looked into the quadplane yet. I am just trying to parse whatever config variables there is in the config file, and the API currently in this repo requires you to have the same variable name with what you are parsing. If we want a better config management then we need to discuss what we want 😄 However, I don't think this is relevant for this PR.

Could we maybe get the names of the rotor groups out of the config file and then generate the variables needed to access all the values?

I am actually not sure if I understand what you mean. I think this depends more on how the config file is being generated? Is this correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed

include/aero_parameters.h Outdated Show resolved Hide resolved
include/parametric_dynamics_model.h Outdated Show resolved Hide resolved
src/parametric_dynamics_model.cpp Outdated Show resolved Hide resolved
@Jaeyoung-Lim Jaeyoung-Lim mentioned this pull request Jul 20, 2021
@manumerous
Copy link
Contributor

How do you plan to structure the generation of different models in gazebo? will all different vehicle type dynamics be generated from the file src/parametric_dynamics_model.cpp ?

@Jaeyoung-Lim
Copy link
Member Author

How do you plan to structure the generation of different models in gazebo? will all different vehicle type dynamics be generated from the file src/parametric_dynamics_model.cpp ?

Yes, so nothing should change on the gazebo side. Gazebo should be just reading configs and applying them

This commit cleansup unnecessary calculations that were being done from the previous implementation
@Jaeyoung-Lim Jaeyoung-Lim merged commit 2ff71a7 into master Jul 22, 2021
@Jaeyoung-Lim Jaeyoung-Lim deleted the pr-model-simulation branch July 22, 2021 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gazebo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants