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

[Spinal] Add an option for body rate cmd #579

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Li-Jinjie
Copy link
Contributor

What is this

Add body rate option in cmd msg.

Details

First, I add SetControlMode.srv to set mode. The default set is is_attitude == True and is_body_rate == False.

If is_attitude == True and is_body_rate == False, everything remains the same with previous version.

If is_attitude == True and is_body_rate == True, the controller will use error_ang_vel = target_ang_vel - ang_vel to get D term.

If is_attitude == False and is_body_rate == True, the controller becomes a body_rate controller with only P term.

is_attitude == False and is_body_rate == False are temporarily not allowed.

TODO:

Note that I have changed the sign of d term in control_feedback_state_msg_ to be compatible with p and i. I think this change will not affect anything. Please check the 309 line of attitude_control.cpp

…te == true, the body_rate cmd will be set as target_ang_vel and hence becomes the feedforward term. Note that I change the sign of d term in control_feedback_state_msg_ to be compatible with p and i.
@tongtybj
Copy link
Collaborator

I think this is a very useful contribution to our control framework.

@sugikazu75
Copy link
Member

@Li-Jinjie

If is_attitude == False and is_body_rate == True, the controller becomes a body_rate controller with only P term.

In my understanding, in this mode, we use only D-term in our original system for attitude control. Is this correct ?
If so, we don't have to add p_term and i_term to roll_pitch_term.

Moreover, where is is_attitude_ctrl_ used other than in callback function? It seems to me that there is no difference between two modes: (is_attitude, is_body_rate) = (True, True) and (False, True).

@Li-Jinjie
Copy link
Contributor Author

@Li-Jinjie

If is_attitude == False and is_body_rate == True, the controller becomes a body_rate controller with only P term.

In my understanding, in this mode, we use only D-term in our original system for attitude control. Is this correct ? If so, we don't have to add p_term and i_term to roll_pitch_term.

Yes correct, only D-term of attitude controller (or we can call it the P gain for angular rate) is used.

Moreover, where is is_attitude_ctrl_ used other than in callback function? It seems to me that there is no difference between two modes: (is_attitude, is_body_rate) = (True, True) and (False, True).

You are right, I truly missed something during cherry-pick. Now I have fixed this part and please check.

@tongtybj
Copy link
Collaborator

Yes correct, only D-term of attitude controller (or we can call it the P gain for angular rate) is used.

For the naming of the control term, I also agree with @Li-Jinjie . Although using d_term for angular control is convenient (saving several code lines), but it might be theorerically confusing. So, I suggest @Li-Jinjie to use p_term for angular control.

@Li-Jinjie Li-Jinjie changed the title [Spinal] Add body rate cmd option [Spinal] Add an option for body rate cmd Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants