Skip to content

Commit

Permalink
final commit
Browse files Browse the repository at this point in the history
  • Loading branch information
irvingywang committed Mar 24, 2024
1 parent 9ee01c1 commit 7212746
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/app/src/gimbal_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ void Gimbal_Ctrl_Loop()
g_pitch->angle_pid->kd = 400.0f;
g_pitch->velocity_pid->kp = 4500.0f;
g_pitch->velocity_pid->ki = 0.8f;
DJI_Motor_Set_Angle(g_pitch, g_robot_state.gimbal_pitch_angle - 12.5f / 180.0f * PI);
DJI_Motor_Set_Angle(g_yaw, g_robot_state.gimbal_yaw_angle - 2.0f / 180.0f * PI);
} else {
g_yaw->angle_pid->kp = 20.0f;
g_yaw->angle_pid->kd = 150.0f;
Expand All @@ -133,9 +135,10 @@ void Gimbal_Ctrl_Loop()
g_pitch->angle_pid->kd = 400.0f;
g_pitch->velocity_pid->kp = 4500.0f;
g_pitch->velocity_pid->ki = 0.8f;
DJI_Motor_Set_Angle(g_pitch, g_robot_state.gimbal_pitch_angle);
DJI_Motor_Set_Angle(g_yaw, g_robot_state.gimbal_yaw_angle);
}
DJI_Motor_Set_Angle(g_pitch, g_robot_state.gimbal_pitch_angle);
DJI_Motor_Set_Angle(g_yaw, g_robot_state.gimbal_yaw_angle);

}
else
{
Expand Down
6 changes: 3 additions & 3 deletions src/app/src/robot.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ extern DJI_Motor_Handle_t *g_yaw;
#define SPIN_TOP_OMEGA (1.0f)

#define KEYBOARD_RAMP_COEF (0.004f)
#define SPINTOP_COEF (0.005f)
#define SPINTOP_COEF (0.003f)
#define CONTROLLER_RAMP_COEF (0.8f)
#define MAX_SPEED (.8f)
#define MAX_SPEED (.6f)

Robot_State_t g_robot_state = {0, 0};
Key_Prev_t g_key_prev = {0};
Expand Down Expand Up @@ -184,7 +184,7 @@ void Robot_Cmd_Loop()

/* Hardware Limits */
g_robot_state.gimbal_yaw_angle = fmod(g_robot_state.gimbal_yaw_angle, 2 * PI);
__MAX_LIMIT(g_robot_state.gimbal_pitch_angle, -0.2f, 0.2f);
__MAX_LIMIT(g_robot_state.gimbal_pitch_angle, -0.4f, 0.4f);
__MAX_LIMIT(g_robot_state.chassis_x_speed, -MAX_SPEED, MAX_SPEED);
__MAX_LIMIT(g_robot_state.chassis_y_speed, -MAX_SPEED, MAX_SPEED);

Expand Down

0 comments on commit 7212746

Please sign in to comment.