1
Dependencies: mcp2515 mbed-dev-f303
Diff: main.cpp
- Revision:
- 6:7d2743feaf23
- Parent:
- 5:902ba9999d6c
--- a/main.cpp Tue Jan 11 13:34:14 2022 +0000 +++ b/main.cpp Fri Jun 24 01:13:03 2022 +0000 @@ -21,7 +21,6 @@ //////////////////////////////////////////////////////////////////////////////// - int main() { Timer t; @@ -36,10 +35,18 @@ // foot.baud(115200); //接收鞋垫信息 // foot.attach(&serial_board_isr); -// command.baud(115200); //485通信 +// command.baud(115200); // // command.attach(&serial_command_isr); + /////////////////////// + + + + + + + //////////////////////////// pf_can.frequency(800000); @@ -60,24 +67,25 @@ df1_can.frequency(800000); /////////////////////////////////////position/////////////////////////////////////////// - wait(8); + wait(4); Zero(&pf_txMsg); // EnterSPEEDMode(&pf_txMsg); + //EnterPositionMode(&pf_txMsg); + EnterMotorMode(&pf_txMsg); - //Zero(&df_txMsg); - // EnterSPEEDMode(&df_txMsg); + Zero(&df_txMsg); + //EnterSPEEDMode(&df_txMsg); + //EnterPositionMode(&df_txMsg); + EnterMotorMode(&df_txMsg); Zero(&df1_txMsg); - EnterSPEEDMode(&df1_txMsg); + // EnterSPEEDMode(&df1_txMsg); + EnterPositionMode(&df1_txMsg); + //EnterMotorMode(&df1_txMsg); - EnterPositionMode(&pf_txMsg); - //EnterPositionMode(&df_txMsg); - EnterPositionMode(&df1_txMsg); + - - //EnterMotorMode(&pf_txMsg); - //EnterMotorMode(&df_txMsg); - //EnterMotorMode(&df1_txMsg); + @@ -162,7 +170,7 @@ a_control.pf.t_ff=0; } */ - a_control.pf.p_des=PI/32; + a_control.pf.p_des=-PI/4; a_control.pf.v_des=0; a_control.pf.kp=10; a_control.pf.kd=5; @@ -170,29 +178,19 @@ - a_control.df.p_des=PI/4; - a_control.df.v_des=0; - a_control.df.kp=10; + a_control.df.p_des=0; + a_control.df.v_des=-500*2*3.14/60/50; + a_control.df.kp=0; a_control.df.kd=5; a_control.df.t_ff=0; - if(t.read()<2) - { - a_control.df1.p_des=PI/4; - a_control.df1.v_des=0; - a_control.df1.kp=30; - a_control.df1.kd=5; - a_control.df1.t_ff=0; - } - - if(t.read()>2&&t.read()<4) - { + a_control.df1.p_des=PI/8; a_control.df1.v_des=0; a_control.df1.kp=35; a_control.df1.kd=5; a_control.df1.t_ff=0; - } + /* if(t.read()>4&&t.read()<6) {