ethz-asl / data-driven-dynamics

Data Driven Dynamics Modeling for Aerial Vehicles
Other
99 stars 14 forks source link

Question about applying forces to links in gazebo #26

Closed manumerous closed 3 years ago

manumerous commented 3 years ago

While looking through the gazebo_motor_model.cpp I had a few questions coming up.

Am I right to assume that link_ will specify the propeller as an actual physical body which is linked through the rest through the revolute joint joint_? What is the difference between adding relative and normal forces?

e.g. link_->AddRelativeForce(ignition::math::Vector3d(0, 0, force * scalar));

e.g. link_->AddForce(air_drag);

How do we know the direction the force is applied to in both cases? Is the first one relative to a local bodyframe of link and the second one represented in the "main body frame"?

I guess it would be possible to find that somewhere in the gazebo repo but i hope it is okay to ask, since you might already know part of the answers I guess.

Jaeyoung-Lim commented 3 years ago

@manumerous In general, you can look up the gazebo api: http://osrf-distributions.s3.amazonaws.com/gazebo/api/11.0.0/classgazebo_1_1physics_1_1Link.html

As it is said in the API the relative force applies force on a specific location while the addforce applies forces at the link origin.

They are both not related to the main bodyframe and apply forces at the link frame

manumerous commented 3 years ago

Okay thank you for your answer. I am still a bit confused by it.

According to the documentation it seems that AddRelativeForce() also adds the force at the links origin, but the force is expressed in the link frame:

Screenshot from 2021-04-09 10-42-24

Could it be that you were refering to AddForceAtRelativePosition() instead of AddRelativeForce()?

I guess in contrast the AddForce probably has a force specified in bodyframe, what would make since since the airspeed used to calculate the drag force is most likely expressed in the bodyframe. Unfortunatly it is not specified directly.

Screenshot from 2021-04-09 10-50-20

manumerous commented 3 years ago

Anyways that setup seems to be slightly overkill for our application. I guess I will just calculate everything in the body frame since we do not have that many links and joints in the UAV case.

Jaeyoung-Lim commented 3 years ago

@manumerous

Could it be that you were refering to AddForceAtRelativePosition() instead of AddRelativeForce()?

I think you are right. The truth is in the API docs :smile:

Since those are component wise plugins, they don't generally know what the "body" is in the simulation. It is applying forces to the link entity, therefore a "body" means link.

Those are referred from two different objects (model and link) as they are on different pointers. I think that is where your confusion on the coordinate frames are coming form.

manumerous commented 3 years ago

Hey Jay, I have a few questions about the lift drag plugin. Would you have time for a quick sparring session on jitsi?

Jaeyoung-Lim commented 3 years ago

@manumerous Sure

manumerous commented 3 years ago

https://jitsi.bastli.ethz.ch/SA_Meeting

Jaeyoung-Lim commented 3 years ago

@manumerous I am in the meeting - unfortunately I need to leave before 4