优化发射
This commit is contained in:
parent
a632125bbd
commit
730b703842
Binary file not shown.
@ -76,11 +76,11 @@ static const ConfigParam_t param_chassis ={
|
|||||||
},
|
},
|
||||||
/*投球*/
|
/*投球*/
|
||||||
.PitchConfig_Config = {
|
.PitchConfig_Config = {
|
||||||
.m2006_init_angle =-150,
|
.m2006_init_angle =-170,
|
||||||
.m2006_trigger_angle =0,
|
.m2006_trigger_angle =0,
|
||||||
.go1_init_position = 0,
|
.go1_init_position = -50,
|
||||||
.go1_release_threshold =0,
|
.go1_release_threshold =-210,
|
||||||
.m2006_Screw_init=0
|
.m2006_Screw_init=0,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
122
User/Module/up.c
122
User/Module/up.c
@ -120,7 +120,7 @@ int8_t VESC_M5065_Control(UP_t *u,fp32 speed)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int aaaaaaaaaaa=1;
|
||||||
|
|
||||||
|
|
||||||
/*go电机控制*/
|
/*go电机控制*/
|
||||||
@ -130,17 +130,17 @@ int8_t GO_SendData(UP_t *u, float pos, float limit)
|
|||||||
static int is_calibration=0;
|
static int is_calibration=0;
|
||||||
static fp32 error=0; //误差量
|
static fp32 error=0; //误差量
|
||||||
|
|
||||||
GO_MotorData_t *GO_calibration;//校准前,原始数据
|
// GO_MotorData_t *GO_calibration;//校准前,原始数据
|
||||||
GO_calibration = get_GO_measure_point() ;
|
u->motorfeedback .go_data = get_GO_measure_point() ;
|
||||||
if(is_calibration==0)
|
// if(is_calibration==0)
|
||||||
{
|
// {
|
||||||
is_calibration=HAL_GPIO_ReadPin (GPIOE ,GPIO_PIN_9 );
|
// is_calibration=HAL_GPIO_ReadPin (GPIOE ,GPIO_PIN_9 );
|
||||||
u->go_cmd.Pos = -50; //上电之后跑
|
// u->go_cmd.Pos = -50; //上电之后跑
|
||||||
error= GO_calibration->Pos ;
|
// error= GO_calibration->Pos ;
|
||||||
}
|
// }
|
||||||
u->motorfeedback .go_data = GO_calibration;
|
// u->motorfeedback .go_data = GO_calibration;
|
||||||
u->motorfeedback .go_data ->Pos= error ;
|
// u->motorfeedback .go_data ->Pos= error ;
|
||||||
u->go_cmd.Pos = pos;
|
// u->go_cmd.Pos = pos;
|
||||||
|
|
||||||
// 读取参数
|
// 读取参数
|
||||||
float tff = u->go_cmd.T; // 前馈力矩
|
float tff = u->go_cmd.T; // 前馈力矩
|
||||||
@ -181,7 +181,7 @@ int8_t ALL_Motor_Control(UP_t *u,CAN_Output_t *out)
|
|||||||
&u->pid .Pitch_M2006_angle ,
|
&u->pid .Pitch_M2006_angle ,
|
||||||
&u->pid .Pitch_M2006_speed ,
|
&u->pid .Pitch_M2006_speed ,
|
||||||
u->motor_target .Pitch_M2006_angle );
|
u->motor_target .Pitch_M2006_angle );
|
||||||
GO_SendData(u,u->motor_target .go_shoot,1 );
|
GO_SendData(u,u->motor_target .go_shoot,5 );
|
||||||
|
|
||||||
|
|
||||||
for(int i=0;i<4;i++){
|
for(int i=0;i<4;i++){
|
||||||
@ -218,8 +218,8 @@ int8_t UP_control(UP_t *u,CAN_Output_t *out,CMD_t *c)
|
|||||||
u->motor_target .go_shoot =u->PitchContext .PitchConfig .go1_init_position ;
|
u->motor_target .go_shoot =u->PitchContext .PitchConfig .go1_init_position ;
|
||||||
is_pitch=0;
|
is_pitch=0;
|
||||||
}
|
}
|
||||||
// u->motor_target .M2006_angle =u->PitchContext .PitchConfig .m2006_init_angle ;
|
u->motor_target .Shoot_M2006_angle =u->PitchContext .PitchConfig .m2006_init_angle ;
|
||||||
// u->PitchContext .PitchState = PITCH_PREPARE; //状态更新,开始夹球
|
u->PitchContext .PitchState = PITCH_PREPARE; //状态更新,开始夹球
|
||||||
|
|
||||||
// /*运球*/
|
// /*运球*/
|
||||||
// u->motor_target .go_spin = u->DribbleContext.DribbleConfig .go2_init_angle ;
|
// u->motor_target .go_spin = u->DribbleContext.DribbleConfig .go2_init_angle ;
|
||||||
@ -234,12 +234,12 @@ int8_t UP_control(UP_t *u,CAN_Output_t *out,CMD_t *c)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Pitch :
|
case Pitch :
|
||||||
if (u->PitchContext .PitchState ==PITCH_PREPARE) //首次启动
|
if (u->PitchContext .PitchState ==PITCH_PREPARE)
|
||||||
{
|
{
|
||||||
u->PitchContext .PitchState=PITCH_START;//置标志位用于启动投篮
|
u->PitchContext .PitchState=PITCH_START;//置标志位用于启动投篮
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pitch_Process(u,out,c);
|
Pitch_Process(u,out,c);
|
||||||
|
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ int8_t UP_control(UP_t *u,CAN_Output_t *out,CMD_t *c)
|
|||||||
|
|
||||||
}break ;
|
}break ;
|
||||||
case Dribbl_transfer:
|
case Dribbl_transfer:
|
||||||
|
break ;
|
||||||
// Dribbl_transfer_a(u,out);
|
// Dribbl_transfer_a(u,out);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -286,52 +286,52 @@ return 0;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//int8_t Pitch_Process(UP_t *u, CAN_Output_t *out,CMD_t *c)
|
int8_t Pitch_Process(UP_t *u, CAN_Output_t *out,CMD_t *c)
|
||||||
//{
|
{
|
||||||
// static fp32 go1_position,M2006_Screw_position ;
|
static fp32 go1_position,M2006_Screw_position ;
|
||||||
// static int is_initialize=1;
|
static int is_initialize=1;
|
||||||
// if(is_initialize)
|
if(is_initialize)
|
||||||
// {
|
{
|
||||||
// go1_position=u->PitchContext .PitchConfig .go1_init_position ;
|
go1_position=u->PitchContext .PitchConfig .go1_init_position ;
|
||||||
// M2006_Screw_position=u->PitchContext .PitchConfig .m2006_Screw_init;
|
M2006_Screw_position=u->PitchContext .PitchConfig .m2006_Screw_init;
|
||||||
// is_initialize=0;
|
is_initialize=0;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// switch(u->PitchContext .PitchState){
|
switch(u->PitchContext .PitchState){
|
||||||
//
|
|
||||||
// case PITCH_START:
|
case PITCH_START:
|
||||||
// u->motor_target .go_shoot = u->PitchContext .PitchConfig .go1_release_threshold;
|
u->motor_target .go_shoot = u->PitchContext .PitchConfig .go1_release_threshold;
|
||||||
//
|
|
||||||
//// if(u->motorfeedback .GO_motor_info[0]->Pos < -32.40){ //检测go位置到达最上面,这里的检测条件可以更改
|
if(u->motorfeedback .go_data ->Pos < -209){ //检测go位置到达最上面,这里的检测条件可以更改
|
||||||
//// u->motor_target .M2006_angle = u->PitchContext .PitchConfig .m2006_trigger_angle ;//设置2006角度,0
|
u->motor_target .Shoot_M2006_angle = u->PitchContext .PitchConfig .m2006_trigger_angle ;//设置2006角度,0
|
||||||
//
|
|
||||||
// u->PitchContext .PitchState=PITCH_PULL_TRIGGER;
|
u->PitchContext .PitchState=PITCH_PULL_TRIGGER;
|
||||||
////}//更改标志位
|
}//更改标志位
|
||||||
|
|
||||||
// break ;
|
break ;
|
||||||
// case PITCH_PULL_TRIGGER:
|
case PITCH_PULL_TRIGGER:
|
||||||
//
|
|
||||||
//
|
|
||||||
// if(u->motorfeedback .M2006 .total_angle >-1) //当2006的总角度小于1,可以认为已经勾上,误差为1
|
if(u->motorfeedback .DJmotor_feedback [0].total_angle >-1) //当2006的总角度小于1,可以认为已经勾上,误差为1
|
||||||
// {
|
{
|
||||||
// u->motor_target .go_shoot = go1_position;//go下拉
|
u->motor_target .go_shoot = go1_position;//go下拉
|
||||||
// u->motor_target .M3508_angle = M2006_Screw_position;//丝杠上的2006
|
u->motor_target .Pitch_M2006_angle = M2006_Screw_position;//丝杠上的2006
|
||||||
// go1_position = go1_position + c->Vx ;
|
go1_position = go1_position + c->Vx ;
|
||||||
// M2006_Screw_position=M2006_Screw_position+ c->Vy;
|
M2006_Screw_position=M2006_Screw_position+ c->Vy;
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// break ;
|
break ;
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
//return 0;
|
return 0;
|
||||||
//
|
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -228,6 +228,7 @@ int8_t UP_control(UP_t *u,CAN_Output_t *out,CMD_t *c);
|
|||||||
int8_t ALL_Motor_Control(UP_t *u,CAN_Output_t *out);
|
int8_t ALL_Motor_Control(UP_t *u,CAN_Output_t *out);
|
||||||
int8_t DJ_processdata(DJmotor_feedback_t *f,fp32 ecd_to_angle);
|
int8_t DJ_processdata(DJmotor_feedback_t *f,fp32 ecd_to_angle);
|
||||||
int8_t DJ_Angle_Control(UP_t *u,int id,DJmotor_feedback_t *f,pid_type_def *Angle_pid,pid_type_def *Speed_pid,fp32 target_angle);
|
int8_t DJ_Angle_Control(UP_t *u,int id,DJmotor_feedback_t *f,pid_type_def *Angle_pid,pid_type_def *Speed_pid,fp32 target_angle);
|
||||||
|
int8_t Pitch_Process(UP_t *u, CAN_Output_t *out,CMD_t *c);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -68,9 +68,9 @@ void Task_up(void *argument)
|
|||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
// UP_control(&UP,&UP_CAN_out,&up_cmd);
|
UP_control(&UP,&UP_CAN_out,&up_cmd);
|
||||||
UP.motor_target .Pitch_M2006_angle =aaa;
|
// UP.motor_target .go_shoot =aaa;
|
||||||
// UP.motor_target .M2006_angle =bbb ;
|
// UP.motor_target .Shoot_M2006_angle =bbb ;
|
||||||
|
|
||||||
// UP.motor_target .M3508_angle =CCC;
|
// UP.motor_target .M3508_angle =CCC;
|
||||||
// UP.motor_target .go_shoot =aaa;
|
// UP.motor_target .go_shoot =aaa;
|
||||||
|
Loading…
Reference in New Issue
Block a user