Skip to content

Commit

Permalink
[Gimablrotor][control] corrected the mecthod to calculate target gimb…
Browse files Browse the repository at this point in the history
…al angle (accumlation of i term during tilted flight is solved)
  • Loading branch information
sugihara-16 committed Apr 9, 2024
1 parent 0300203 commit 10a0908
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions robots/gimbalrotor/src/control/gimbalrotor_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,11 @@ namespace aerial_robot_control
else if(gimbal_dof_ == 2)
{
if(f_i_integrated[0] == 0 || f_i_integrated[2] == 0) continue;
double gimbal_roll = atan2(-f_i_integrated[0], f_i_integrated[2]);
double gimbal_pitch = atan2(f_i_integrated[1], f_i_integrated[0] * sin(-gimbal_roll) + f_i_integrated[2]* cos(-gimbal_roll));

double gimbal_roll = atan2(-f_i_integrated[1], f_i_integrated[2]);
double gimbal_pitch = atan2(f_i_integrated[0], -f_i_integrated[1] * sin(gimbal_roll) + f_i_integrated[2]* cos(gimbal_roll));
target_gimbal_angles_.at(2 * i) = gimbal_roll;
target_gimbal_angles_.at(2 * i + 1) = gimbal_pitch;
// target_gimbal_angles_.at(2 * i) = atan2(-f_i_integrated[1], f_i_integrated[2]);
// target_gimbal_angles_.at(2 * i + 1) = atan2(f_i_integrated[0], f_i_integrated[2]);
}
last_col += rotor_coef_;
}
Expand Down

0 comments on commit 10a0908

Please sign in to comment.