ManualCourse.c 17.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561
#include "includes.h"
#include "hardware.h"
#include "all_value.h"


u8 Tim7_NotKeyNums;//用于无按键操作下的计时
u8 Step_KeyConfirm=0;//用于判断按键是否启用以及何种模式
u8 HandFtrig;//记录按键松开那一刻
u8 Tim5_Hand1Nums;//用于记录遥控安全启用+急停复位延时+高速延时
#define OtherManuAcEn 0u
void Inhand(void) //手动按键,获取动作类型
{
	switch(Step_KeyConfirm)
	{

		case 0://没有按下急停按钮延时
//					if (IN_Stop)Tim5_Hand1Nums=0;
//					else if(Tim5_Hand1Nums>2)
//							{Step_KeyConfirm=1;Tim5_Hand1Nums=0; }
					if (IN_Stop==0)
					{ Step_KeyConfirm=1;
					  Tim5_Hand1Nums=0;}
					break;	
		case 1://按下急停延时
					if (IN_Stop==0)
					{ if(Tim5_Hand1Nums>1)
						{ Step_KeyConfirm=2; AGV.AllAxisResetStep=1;AGV.Axis_No=0x3F;}
						
						if (Handnum==0)Tim5_Hand1Nums=Tim7_NotKeyNums=0;
					}
					break;
				
	}	
	
	if( (Step_KeyConfirm>=2)&&(Step_KeyConfirm<=4) )//遥控信号可采集
	{		if (Handnum)Tim7_NotKeyNums=0;
			else
			{	if(IN_Stop==0)
				{	if(Tim5_Hand1Nums>8 && OtherManuAcEn ) //松开急停后看时间
					{ if(Step_KeyConfirm==2)Step_KeyConfirm=3;
					  else Step_KeyConfirm=2;
					}
					else if(Tim5_Hand1Nums>1){Step_KeyConfirm=2;AGV.AllAxisResetStep=1;AGV.Axis_No=0x3F;}
						
					Tim5_Hand1Nums=0;
				}
			}
					
			if(Tim7_NotKeyNums>90)//松开按键持续一定时间30min无操作,则关闭遥控功能
			{ Step_KeyConfirm=1;Tim5_Hand1Nums=0;
		   }						
	 }

	/*handnum:1-整体前进;2-整体后退;3-原地左转	;4-原地右转;5-上升;6-下降;7-整体向左;8-整体向右;9-急停;
	          10-左前45度平移;11-右前45度平移;12-左后45度平移;13-右后45度平移;14-舵轮左转;15-舵轮右转;
	          20-Vy+左弧形;21-Vy+右弧形;22-Vy-左弧形;23-Vy-右弧形;24-Vx+左弧形;25-Vx+右弧形;26-Vx-左弧形;27-Vx-右弧形;
	*/
	if(Workmode==ManuMode)
		{
			if(((IN_Forward|IN_Backward|IN_Up|IN_Down|IN_Left|IN_Right|IN_Cw|IN_CCw|IN_HelmLeft|IN_HelmRight)==0)|(IN_Stop==1))Handnum=0;					//外部无按键操作
			else 
			{ 
				switch(SysKey)
				{
					default://手动确认2下,按键对应的点动常规动作
								if(Step_KeyConfirm==2)
								{ if(IN_Stop) Handnum=9;//急停
									else if(IN_Forward) Handnum=1;//整车前进
									else if(IN_Backward) Handnum=2;//整车后退
									else if(IN_CCw) Handnum=3;//原地左转
									else if(IN_Cw) Handnum=4;//原地右转
									else if(IN_Up)Handnum=12;//上升、下层轴输送正转
									else if(IN_Down) Handnum=13;//下降、下层轴输送反转
									else if(IN_Left) Handnum=7;//整车左移
									else if(IN_Right) Handnum=8;//整车右移	
									else if(Motor[5].Y)
									{	if(IN_HelmLeft) Handnum=17;//上层6号轴输送反转
										else if(IN_HelmRight) Handnum=16;//上层6号轴输送正转
									}

								}
								break;					
					case 234://手动确认3下,按键对应的点动常规动作
								if(Step_KeyConfirm==2)
								{	if(IN_Stop) Handnum=9;//急停
									else if(IN_Forward) Handnum=1;//1-整体前进
									else if(IN_Backward) Handnum=2;//2-整体后退
									else if(IN_CCw) Handnum=3;//3-原地左转
									else if(IN_Cw) Handnum=4;//4-原地右转
									else if(IN_Up)Handnum=12;//上升、5号轴输送
									else if(IN_Down) Handnum=13;//下降
									else if(IN_Left) Handnum=7;//7-整体向左
									else if(IN_Right) Handnum=8;//8-整体向右
						
									else if(IN_HelmLeft) Handnum=14;//舵轮左转
									else if(IN_HelmRight) Handnum=15;//舵轮右转
								}
								break;	

				 }
			}
			

			
			if ((Step_KeyConfirm>=2)&&(Step_KeyConfirm<=4)){;}
			else Handnum=0;
				
			if ( (TCP_Mode==200)&&(TCP_AcNo>0 &&TCP_AcNo<20) )Handnum=TCP_AcNo;//;				
			else if (TouckActionNo)Handnum=TouckActionNo;//触控模式下遥控器无效
			
			if (Handnum)HandFtrig=1;

			
		}		
}
void Fc_Matrix_RPM_Axis(u8 ModeConfirmEn,signed long V1,signed long V2,signed long V3,signed long V4,signed long V5,signed long V6)//以轴为单位,直接下发转速
{ u8 i;
	Motor[0].PcToM.Speed=V5; 
	Motor[1].PcToM.Speed=V1; 
	Motor[2].PcToM.Speed=V2; 
	Motor[3].PcToM.Speed=V3; 
	Motor[4].PcToM.Speed=V4; 
	Motor[5].PcToM.Speed=V6;
	
	if (ModeConfirmEn)
	{ for(i=0;i<MaxMotNums;i++)
		{ Motor[i].PcToM.WorkMode=3;}
	}
}


void Fc_Matrix_XSD_Axis(u8 ModeConfirmEn,float V1,float V2,float V3,float V4,float V5,float V6)//以轴为单位,线速度各轴速度,输入形参单位mm/s,或者度/s。
{ u8 i;
	
	Motor[0].PcToM.Velocity=V5;
	Motor[1].PcToM.Velocity=V1;
	Motor[2].PcToM.Velocity=V2;
	Motor[3].PcToM.Velocity=V3;
	Motor[4].PcToM.Velocity=V4;
	Motor[5].PcToM.Velocity=V6;
 	for(i=0;i<MaxMotNums;i++)
	{
		if ((ModeConfirmEn)&&(Motor[i].PcToM.AbsoluteHold_Enable==0))Motor[i].PcToM.WorkMode=3;//若开启到位置持续,模式不能为速度模式
		Motor[i].PcToM.Speed=(signed int)(Motor[i].PcToM.Velocity/Motor[i].Max_Speed*(float)Motor[i].Max_rpm);
		
	}
	
//	Motor[0].PcToM.Speed=(signed int)(V5/Motor[0].Max_Speed*Motor[0].Max_rpm*10.0f); //

//	
//	


	
//	Motor[5].PcToM.Speed=(signed int)(V6/SMax_Axis1*RMax_Axis1);
		
	
}


u8 ceshi89=0;
u8 FirstPosOk;


void Fc_Matrix_Agv(float V_x,float V_y,float V_w,float R_w,float V_z,float V_6)//以车为单位,整车速度,为了不同规格的车点动效果一样,此处使用单位mm/s,或者弧度/s。
{
	float V1,V3;
	float Ang2_Delta,Ang4_Delta;
	float R2,R4;
	
	V1=V3=0;
	if( (V_x==0)&&(V_y==0)&&(V_w==0)&&(V_z==0)&&(V_6==0)&&(R_w==0) )
		Fc_Matrix_XSD_Axis(1,0,0,0,0,0,0); 		
	else if (V_z!=0)//升降
		Fc_Matrix_XSD_Axis(1,0,0,0,0,V_z,0); 		
	else 	if (V_6!=0)//6号轴
		Fc_Matrix_XSD_Axis(1,0,0,0,0,0,V_6); 
	else
	{ if ((V_w==0)&&(R_w==0))//整体平移(无旋转或者弧时)
		{ 
			if( (V_x==0)&&(V_y!=0) )//车体仅前后方向运动
			{ Motor[2].PcToM.Angle_Target=Motor[4].PcToM.Angle_Target=90;
				V1=V3=V_y;
			}	
			else//若V_y==0 车体仅左右方向运动
			{ Ang2_Delta=atan(V_y/V_x)*Du_Pi;//车体坐标系下的平移角度
				if(fabs(Ang2_Delta)<=90)
				{	Motor[2].PcToM.Angle_Target=Motor[4].PcToM.Angle_Target=Ang2_Delta;						
					if(sqrt(pow(V_x,2)+pow(V_y,2))>Motor[1].Max_Speed)
						Ang4_Delta=Motor[1].Max_Speed;
					else Ang4_Delta=sqrt(pow(V_x,2)+pow(V_y,2));
					
					Ang4_Delta=fabs(Ang4_Delta);
					if (V_x>0)V1=V3=Ang4_Delta;
					else V1=V3=-Ang4_Delta;
				}
			}
			
		}
		else//有旋转时
		{ 		
			if( (V_x==0)&&(V_y==0) )//原地旋转
			{ if((V_w!=0)&&(R_w==0)) //原地旋转的速度看V_w,R_w=0					
				{ Motor[2].PcToM.Angle_Target=Motor[4].PcToM.Angle_Target=AngCw_Helm;
					V1=-V_w*Dis_AgvC_Helm;
					V3=-V1;
				}					
			}
			else if( (V_x!=0)&&(V_y!=0))
			{;}
			else	//绕车体轴线上某点旋转,R_w为弧半径mm。旋转方向V_w:1为逆转,-1为顺转
			{ if (R_w!=0)
				{ if( (V_x==0)&&(V_y!=0) )//圆心在车体X轴上
					{
					  Ang2_Delta=atan(F_YDis_Helm/(F_XDis_Helm+R_w))*Du_Pi;
						R2=sqrt(pow(F_YDis_Helm,2)+pow(F_XDis_Helm+R_w,2));
						Ang4_Delta=atan(F_YDis_Helm/(R_w-F_XDis_Helm))*Du_Pi;
						R4=sqrt(pow(F_YDis_Helm,2)+pow(R_w-F_XDis_Helm,2));

						V_z=fabs(R2*V_y/R_w);//借此量,V1的速度
						V_6=fabs(R4*V_y/R_w);//借此量,V3的速度
						
						if((V_z>Motor[1].Max_Speed))
						{ V_6=V_6/V_z*Motor[1].Max_Speed;
							V_z=Motor[1].Max_Speed;
						}
						if(Ang4_Delta<Ang_DeltaMax)
						{
							if( (V_y>0)&&(V_w==-1) )//前顺方向
							{ 
								Motor[2].PcToM.Angle_Target=90-Ang2_Delta;
								Motor[4].PcToM.Angle_Target=90+Ang4_Delta;
								V1=V_z;
								V3=V_6;							
							}
							else if( (V_y<0)&&(V_w==1) )//后逆方向
							{ 
								Motor[2].PcToM.Angle_Target=90-Ang2_Delta;
								Motor[4].PcToM.Angle_Target=90+Ang4_Delta;
								V1=-V_z;
								V3=-V_6;							
							}
							else if( (V_y>0)&&(V_w==1) )//前逆方向
							{ 
								Motor[2].PcToM.Angle_Target=90+Ang4_Delta;
								Motor[4].PcToM.Angle_Target=90-Ang2_Delta;
								V1=V_6;
								V3=V_z;							
							}
							else if( (V_y<0)&&(V_w==-1) )//后顺方向
							{ 
								Motor[2].PcToM.Angle_Target=90+Ang4_Delta;
								Motor[4].PcToM.Angle_Target=90-Ang2_Delta;
								V1=-V_6;
								V3=-V_z;							
							 }												
						 }
					 }
					else if( (V_x!=0)&&(V_y==0) )//圆心在车体Y轴上
					{
					  Ang2_Delta=atan(F_XDis_Helm/(F_YDis_Helm+R_w))*Du_Pi;
						R2=sqrt(pow(F_XDis_Helm,2)+pow(F_YDis_Helm+R_w,2));
						Ang4_Delta=atan(F_XDis_Helm/(R_w-F_YDis_Helm))*Du_Pi;
						R4=sqrt(pow(F_XDis_Helm,2)+pow(R_w-F_YDis_Helm,2));

						V_z=fabs(R2*V_x/R_w);
						V_6=fabs(R4*V_x/R_w);
						if((V_z>Motor[1].Max_Speed))
						{ V_6=V_6/V_z*Motor[1].Max_Speed;
							V_z=Motor[1].Max_Speed;
						}
						
						if(Ang4_Delta<90)
						{
							if( (V_x>0)&&(V_w==-1) )//右顺方向
							{ 
								Motor[2].PcToM.Angle_Target=0+Ang2_Delta;
								Motor[4].PcToM.Angle_Target=0-Ang4_Delta;
								V1=V_z;
								V3=V_6;							
							}
							else if( (V_x<0)&&(V_w==1) )//左逆方向
							{ 
								Motor[2].PcToM.Angle_Target=0+Ang2_Delta;
								Motor[4].PcToM.Angle_Target=0-Ang4_Delta;
								V1=-V_z;
								V3=-V_6;							
							}
							else if( (V_x>0)&&(V_w==1) )//右逆方向
							{ 
								Motor[2].PcToM.Angle_Target=0-Ang4_Delta;
								Motor[4].PcToM.Angle_Target=0+Ang2_Delta;
								V1=V_6;
								V3=V_z;							
							}
							else if( (V_x<0)&&(V_w==-1) )//左顺方向
							{ 
								Motor[2].PcToM.Angle_Target=0-Ang4_Delta;
								Motor[4].PcToM.Angle_Target=0+Ang2_Delta;
								V1=-V_6;
								V3=-V_z;							
							 }												
						 }
					 }
				}								
			}
			
		}	

		Ang2_Delta=Motor[2].MToPc.Angle_Actual-Motor[2].PcToM.Angle_Target;
		Ang4_Delta=Motor[4].MToPc.Angle_Actual-Motor[4].PcToM.Angle_Target;		
		/*下述为调整舵轮姿态*/
		if (ceshi89==0)
		{	if( (Motor[2].PcToM.AbsoluteHold_Step==100) && (fabs(Ang2_Delta)<DeltaAngPerm_Helmzhuan) &&
					(Motor[4].PcToM.AbsoluteHold_Step==100) && (fabs(Ang4_Delta)<DeltaAngPerm_Helmzhuan)    )//转向轴的角度在允许角度范围内
			{ 
				if(VaIndexB_R(&AGV.AllAxisOK,2))Fc_Matrix_XSD_Axis(1,V1,0,V3,0,0,0);//舵轮行走平台必须在各轴都正常的情况下才可运行,点动模式用
			}	
			else 
			{ if( Motor[2].PcToM.AbsoluteHold_Enable && Motor[4].PcToM.AbsoluteHold_Enable) //此处是寻迹时用,转角可以持续保持运动
				{ if( (fabs(Ang2_Delta)<DeltaAngPerm_Helmzhuan) && (fabs(Ang4_Delta)<DeltaAngPerm_Helmzhuan) &&
							(Motor[2].PcToM.AbsoluteHold_Step==20) && (Motor[4].PcToM.AbsoluteHold_Step==20) ) FirstPosOk=1;						
 				  if(VaIndexB_R(&AGV.AllAxisOK,2)&& (FirstPosOk |TZMiss) )Fc_Matrix_XSD_Axis(1,V1,0,V3,0,0,0);
					
					
				}
				else //普通点动模式,在转轴转到允许范围之后再动行走轴
				{ Fc_Matrix_XSD_Axis(0,0,0,0,0,0,0);
					Tim5_Hand1Nums=0;	
					if( (Motor[2].PcToM.AbsoluteHold_Step==100) && (fabs(Ang2_Delta)>DeltaAngPerm_Helmzhuan) )Motor[2].PcToM.AbsoluteHold_Step=0;
					if( (Motor[4].PcToM.AbsoluteHold_Step==100) && (fabs(Ang4_Delta)>DeltaAngPerm_Helmzhuan) )Motor[4].PcToM.AbsoluteHold_Step=0;
				}
				 
			  if (Motor[2].PcToM.AbsoluteHold_Step==0){ Motor[2].PcToM.AbsoluteHold_Step=1;FirstPosOk=0;}
				if (Motor[4].PcToM.AbsoluteHold_Step==0){ Motor[4].PcToM.AbsoluteHold_Step=1;FirstPosOk=0;}
							
			}
	
		}

	
	}
		
}





u8 HighSpeedEn;

#define OverrideLow_UD 4.0f
#define OverrideHigh_UD 25.0f

#define OverrideLow_Go 2.0f
#define OverrideHigh_Go 15.0f

//float OverrideLow_Go=2.0f;
//float OverrideHigh_Go=25.0f;

#define OverrideLow_CW 1.5f
#define OverrideHigh_CW 7.5f
//float OverrideLow_CW=1.5f;
//float OverrideHigh_CW=5.0f;

#define OverrideHelmLow_CW 2.0f
//float OverrideHelmLow_CW=2.0f;
#define OverrideHelmHigh_CW 7.0f


#define OverrideLow_Conver 20.0f

u8 F_OverrideGo_M;//Manu行走最大速度
u8 F_OverrideUD_M;//Manu升降最大速度
u8 F_OverrideCW_M;//Manu旋转最大速度
u8 F_OverrideConvey_M;//Manu输送最大速度


float Radius=5000;
u8 SJXZEn=1;
void hand_control(u8 handnum)
{
	u8 i;
	/*handnum:1-整体前进;2-整体后退;3-原地左转	;4-原地右转;5-上升;6-下降;7-整体向左;8-整体向右;9-急停;
	          10-左前45度平移;11-右前45度平移;12-左后45度平移;13-右后45度平移;14-舵轮左转;15-舵轮右转;
	          20-Vy+左弧形;21-Vy+右弧形;22-Vy-左弧形;23-Vy-右弧形;24-Vx+左弧形;25-Vx+右弧形;26-Vx-左弧形;27-Vx-右弧形;
	*/
	float SpeedOverride;
	switch(handnum)
		{

			case 1: //整体前进											
							if (HighSpeedEn)SpeedOverride=F_OverrideGo_M;
							else SpeedOverride=OverrideLow_Go;	
							Fc_Matrix_Agv(0,SpeedOverride*0.01f*Motor[1].Max_Speed,0,0,0,0);
							break;								
			case 2: //整体后退											
							if (HighSpeedEn)SpeedOverride=F_OverrideGo_M;
							else SpeedOverride=OverrideLow_Go;	
							Fc_Matrix_Agv(0,-SpeedOverride*0.01f*Motor[1].Max_Speed,0,0,0,0);			
							break;	
			case 7: //整体向左
							if (HighSpeedEn)SpeedOverride=F_OverrideGo_M;
							else SpeedOverride=OverrideLow_Go;
							Fc_Matrix_Agv(-SpeedOverride*0.01f*Motor[1].Max_Speed,0,0,0,0,0);
							break;	
			case 8: //整体向右
							if (HighSpeedEn)SpeedOverride=F_OverrideGo_M;
							else SpeedOverride=OverrideLow_Go;			
							Fc_Matrix_Agv(SpeedOverride*0.01f*Motor[1].Max_Speed,0,0,0,0,0);
							break;	
			case 3: //原地左转	
							if (HighSpeedEn)SpeedOverride=F_OverrideCW_M;
							else SpeedOverride=OverrideLow_CW;	
							Fc_Matrix_Agv(0,0,SpeedOverride*0.01f*Motor[1].Max_Speed/Dis_AgvC_Helm,0,0,0);
							break;	
			case 4: //原地右转
							if (HighSpeedEn)SpeedOverride=F_OverrideCW_M;
							else SpeedOverride=OverrideLow_CW;	
							Fc_Matrix_Agv(0,0,-SpeedOverride*0.01f*Motor[1].Max_Speed/Dis_AgvC_Helm,0,0,0);
							break;	
//			case 10: //左前45度平移	
//							if (HighSpeedEn)SpeedOverride=F_OverrideGo_M;
//							else SpeedOverride=OverrideLow_Go;	
//							Fc_Matrix_Agv(-SpeedOverride*0.01f*Motor[1].Max_Speed,SpeedOverride*0.01f*Motor[1].Max_Speed,0,0,0,0);
//							break;	
//			case 11: //右前45度平移
//							if (HighSpeedEn)SpeedOverride=F_OverrideGo_M;
//							else SpeedOverride=OverrideLow_Go;	
//							Fc_Matrix_Agv(SpeedOverride*0.01f*Motor[1].Max_Speed,SpeedOverride*0.01f*Motor[1].Max_Speed,0,0,0,0);
//							break;
//			case 12: //左后45度平移
//							if (HighSpeedEn)SpeedOverride=F_OverrideGo_M;
//							else SpeedOverride=OverrideLow_Go;	
//							Fc_Matrix_Agv(-SpeedOverride*0.01f*Motor[1].Max_Speed,-SpeedOverride*0.01f*Motor[1].Max_Speed,0,0,0,0);
//							break;
//			case 13: //右后45度平移
//							if (HighSpeedEn)SpeedOverride=F_OverrideGo_M;
//							else SpeedOverride=OverrideLow_Go;	
//							Fc_Matrix_Agv(SpeedOverride*0.01f*Motor[1].Max_Speed,-SpeedOverride*0.01f*Motor[1].Max_Speed,0,0,0,0);
//							break;					
			case 12: //上升
//							if(VaIndexDW_R(&F_AgvContr,9))Handnum=5;//6号轴是输送滚筒
			
							if (HighSpeedEn)SpeedOverride=F_OverrideUD_M;
							else SpeedOverride=OverrideLow_UD;
			
							if(VaIndexDW_R(&F_AgvContr,8))Fc_Matrix_Agv(0,0,0,0,-(float)F_OverrideConvey_M*0.01f*Motor[0].Max_Speed,0);//5号轴是输送滚筒
							else Fc_Matrix_Agv(0,0,0,0,SpeedOverride*0.01f*Motor[0].Max_Speed,0);//5号轴升降
							
							Out_DownValve=0;
							break;	
			case 13: //下降
 							if(VaIndexDW_R(&F_AgvContr,1))//液压
							{ Out_DownValve=1;
							  Fc_Matrix_Agv(0,0,0,0,0,0);	}
							else
							{ 
								if (HighSpeedEn)SpeedOverride=F_OverrideUD_M;
								else SpeedOverride=OverrideLow_UD;
				
								if(VaIndexDW_R(&F_AgvContr,8))Fc_Matrix_Agv(0,0,0,0,(float)F_OverrideConvey_M*0.01f*Motor[0].Max_Speed,0);//5号轴是输送滚筒
								else Fc_Matrix_Agv(0,0,0,0,-SpeedOverride*0.01f*Motor[0].Max_Speed,0);//5号轴升降								
							}
							break;
															
			case 14: //舵轮左转
							if (HighSpeedEn)SpeedOverride=OverrideHelmHigh_CW;
							else SpeedOverride=OverrideHelmLow_CW;
							Fc_Matrix_XSD_Axis(1,0,-SpeedOverride*0.01f*Motor[2].Max_Speed,0,-SpeedOverride*0.01f*Motor[2].Max_Speed,0,0);
							break;				
			case 15: //舵轮右转
							if (HighSpeedEn)SpeedOverride=OverrideHelmHigh_CW;
							else SpeedOverride=OverrideHelmLow_CW;
							Fc_Matrix_XSD_Axis(1,0,SpeedOverride*0.01f*Motor[2].Max_Speed,0,SpeedOverride*0.01f*Motor[2].Max_Speed,0,0);
							break;	
			case 16: //输送电机正转-向右
							Fc_Matrix_Agv(0,0,0,0,0,(float)F_OverrideConvey_M*0.01f*Motor[5].Max_Speed);							
							break;	
			case 17: //输送电机反转-向左
							Fc_Matrix_Agv(0,0,0,0,0,-(float)F_OverrideConvey_M*0.01f*Motor[5].Max_Speed);	
							break;
			case 20: //Vy+左弧形
							Fc_Matrix_Agv(0,OverrideLow_Go*0.01f*Motor[1].Max_Speed,1,Radius,0,0);
							break;							
			case 21: //Vy+右弧形
							Fc_Matrix_Agv(0,OverrideLow_Go*0.01f*Motor[1].Max_Speed,-1,Radius,0,0);
							break;
			case 22: //Vy-左弧形
							Fc_Matrix_Agv(0,-OverrideLow_Go*0.01f*Motor[1].Max_Speed,1,Radius,0,0);
							break;							
			case 23: //Vy-右弧形
							Fc_Matrix_Agv(0,-OverrideLow_Go*0.01f*Motor[1].Max_Speed,-1,Radius,0,0);
							break;			
			case 24: //Vx+左弧形
							Fc_Matrix_Agv(OverrideLow_Go*0.01f*Motor[1].Max_Speed,0,1,Radius,0,0);
							break;				
			case 25: //Vx+右弧形
							Fc_Matrix_Agv(OverrideLow_Go*0.01f*Motor[1].Max_Speed,0,-1,Radius,0,0);
							break;	
			case 26: //Vx-左弧形
							Fc_Matrix_Agv(-OverrideLow_Go*0.01f*Motor[1].Max_Speed,0,1,Radius,0,0);
							break;				
			case 27: //Vx-右弧形
							Fc_Matrix_Agv(-OverrideLow_Go*0.01f*Motor[1].Max_Speed,0,-1,Radius,0,0);
							break;				
						
			default:
							 if (HandFtrig!=0)
							 {
									Fc_Matrix_Agv(0,0,0,0,0,0);Out_DownValve=0;
								 
									Motor[2].PcToM.AbsoluteHold_Enable=Motor[4].PcToM.AbsoluteHold_Enable=0;
									Motor[2].PcToM.AbsoluteHold_Step=Motor[4].PcToM.AbsoluteHold_Step=0;
								  Motor[2].PcToM.TargetSpeed=Motor[4].PcToM.TargetSpeed=0;
								  Tim5_Hand1Nums=0;
									FirstPosOk=0;
									HandFtrig=0;
						 
							 }
							break;
		}	
		
		if ((Tim5_Hand1Nums>6)&&(handnum!=0))
		{ if( (TouckActionNo>0&&TouckActionNo<11&&(TCP_AcNo==0))|(TCP_AcNo>0&&TCP_AcNo<11&&(TouckActionNo==0)) ){;}
			else HighSpeedEn=1;
		}
		else HighSpeedEn=0;
		
		if (handnum!=0)
		{		for(i=0;i<MaxMotNums;i++)
				{
					if(i>0&&i<5)
					{ if(Motor[i].Max_rpm<2500)
						{ Motor[i].PcToM.Acc=2000;										
							Motor[i].PcToM.Dcc=2200;	//避免停止时过大晃动
						}
						else
						{	Motor[i].PcToM.Acc=1200;										
							Motor[i].PcToM.Dcc=1500;	//避免停止时过大晃动	//1000									
						}
					}
					else
					{ Motor[i].PcToM.Acc=2000;
					  Motor[i].PcToM.Dcc=1000;
					}
				}
//				if (AGV.AxisEn_Step==0) AGV.AxisEn_Step=1;//
		}
		
}



void ManualCourse_Pro(void) //
{	
	Inhand();
	hand_control(Handnum);
}