111
Dependencies: yezhong_main_controller_copy mbed1-dev
Revision 10:f83b0935a8f0, committed 2022-07-09
- Comitter:
- ganlikun
- Date:
- Sat Jul 09 11:58:13 2022 +0000
- Parent:
- 9:c082f1c52936
- Commit message:
- 00000
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Jul 07 11:38:10 2022 +0000 +++ b/main.cpp Sat Jul 09 11:58:13 2022 +0000 @@ -17,7 +17,7 @@ int main() { - //Timer t; + Timer tim; //float a=PI/8; //float j=0.558,P=0; ////////////////////////初始化////////////////////////////////////// @@ -35,7 +35,7 @@ pf_can.filter(CAN_ID<<21, 0xFFE00004, CANStandard, 0); pf_rxMsg.len = 6; PF_can.len = 8; - PF_can.id = 0x03; + PF_can.id = 0x02; df_can.frequency(800000); df_can.filter(CAN_ID<<21, 0xFFE00004, CANStandard, 0); @@ -148,15 +148,22 @@ ///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////velocity/////////////////////////////////////////////// - + tim.start(); +// float timeRecord() + float s =tim.read(); + if(s >= 10.0f) { + tim.reset(); + } + a_control.pf.p_des=0; - a_control.pf.v_des=500*2*3.14/60/49; + a_control.pf.v_des=500*2*3.14/60/50*(sin(3.14/5*s)+1); a_control.pf.kp=0; a_control.pf.kd=5; a_control.pf.t_ff=0; a_control.df.p_des=0; - a_control.df.v_des=500*2*3.14/60/49;//49减速比, + a_control.df.v_des=100*2*3.14/60/50*s; +// a_control.df.v_des=500*2*3.14/60/50;//50减速比, a_control.df.kp=0; a_control.df.kd=5; a_control.df.t_ff=0; @@ -166,4 +173,4 @@ //////////////////////////////////////////////////////////////////////////////////////////////// } -} \ No newline at end of file +}