Skip to content

Commit

Permalink
[Gimbalrotor] set another rpy gain if i term is calculated in pc
Browse files Browse the repository at this point in the history
  • Loading branch information
sugihara-16 committed Dec 9, 2023
1 parent c07f2ca commit a70473c
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions robots/gimbalrotor/src/control/gimbalrotor_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,27 @@ namespace aerial_robot_control
{
spinal::RollPitchYawTerms rpy_gain_msg; //for rosserial
/* to flight controller via rosserial scaling by 1000 */
rpy_gain_msg.motors.resize(1);
rpy_gain_msg.motors.at(0).roll_p = pid_controllers_.at(ROLL).getPGain() * 1000;
rpy_gain_msg.motors.at(0).roll_i = pid_controllers_.at(ROLL).getIGain() * 1000;
rpy_gain_msg.motors.at(0).roll_d = pid_controllers_.at(ROLL).getDGain() * 1000;
rpy_gain_msg.motors.at(0).pitch_p = pid_controllers_.at(PITCH).getPGain() * 1000;
rpy_gain_msg.motors.at(0).pitch_i = pid_controllers_.at(PITCH).getIGain() * 1000;
rpy_gain_msg.motors.at(0).pitch_d = pid_controllers_.at(PITCH).getDGain() * 1000;
rpy_gain_msg.motors.at(0).yaw_d = pid_controllers_.at(YAW).getDGain() * 1000;
rpy_gain_pub_.publish(rpy_gain_msg);
}
if(i_term_rp_calc_in_pc_){
rpy_gain_msg.motors.resize(1);
rpy_gain_msg.motors.at(0).roll_p = pid_controllers_.at(ROLL).getPGain() * 1000;
rpy_gain_msg.motors.at(0).roll_i = 0;
rpy_gain_msg.motors.at(0).roll_d = pid_controllers_.at(ROLL).getDGain() * 1000;
rpy_gain_msg.motors.at(0).pitch_p = pid_controllers_.at(PITCH).getPGain() * 1000;
rpy_gain_msg.motors.at(0).pitch_i = 0;
rpy_gain_msg.motors.at(0).pitch_d = pid_controllers_.at(PITCH).getDGain() * 1000;
rpy_gain_msg.motors.at(0).yaw_d = pid_controllers_.at(YAW).getDGain() * 1000;
rpy_gain_pub_.publish(rpy_gain_msg);
}else{
rpy_gain_msg.motors.resize(1);
rpy_gain_msg.motors.at(0).roll_p = pid_controllers_.at(ROLL).getPGain() * 1000;
rpy_gain_msg.motors.at(0).roll_i = pid_controllers_.at(ROLL).getIGain() * 1000;
rpy_gain_msg.motors.at(0).roll_d = pid_controllers_.at(ROLL).getDGain() * 1000;
rpy_gain_msg.motors.at(0).pitch_p = pid_controllers_.at(PITCH).getPGain() * 1000;
rpy_gain_msg.motors.at(0).pitch_i = pid_controllers_.at(PITCH).getIGain() * 1000;
rpy_gain_msg.motors.at(0).pitch_d = pid_controllers_.at(PITCH).getDGain() * 1000;
rpy_gain_msg.motors.at(0).yaw_d = pid_controllers_.at(YAW).getDGain() * 1000;
rpy_gain_pub_.publish(rpy_gain_msg);
}
} //namespace aerial_robot_controller


Expand Down

0 comments on commit a70473c

Please sign in to comment.