Phoenix four classification handling structure

Introduction: In order to complete the classification and handling task of the intelligent vision group of the 17th National College Student Smart Car Competition, I independently designed the Phoenix three-category handling structure, which can pick up the target boards on the whole site and store them in three categories in the turntable storage. At the same time, the structure can open the door by controlling the electromagnetic lock to realize fast "unloading", and can quickly and perfectly complete the handling task of the vision group.

The four-category handling structure of the Phoenix is ​​adapted to the rules of the online competition in the national competition. It is based on the improvement of the three-category structure of the Phoenix. It is also the final competition version. Due to the similar structure and principle, this article only introduces the production method and application of the four-category turntable storage bin .

关键词: Intelligent vision group , classified storage and handling , Phoenix four-category handling structure

 

01Material preparation


1.1 Consumables

  Beihua T-1type 502instant adhesive, 30× 40× 0.2㎝ and 30× 40× 0.3㎝ three-ply wood board each, high-grade bearing oil, facial tissue or cotton wool.

1.2 Machinery

  • Turntable storage compartment : 2-inch stainless steel hinge × 4, three-piece plane thrust needle roller bearing (inner 65, outer 90, height 5mm) × 1, lock (3D printing/wooden/metal) × 4.

  • Arm servo bracket : universal bracket × 2, large long U-shaped bracket × 2, short U-shaped bracket × 2, cup bearing × 2, Futaba25T-2㎜ steering plate × 3.

  • Nut : M3 ordinary nut, M3 self-locking nut, M3*10+6 copper column.

  • Screws : M2.5 5, M3 5, M3 6, M3 8, M3 10, M3 12, M3 15, M3 20.

  • Washers : M3 plastic washers, M3 metal washers, M4 large metal washers.

1.3 Electronic components

  SPT5410HV-180High-voltage digital steering gear × 2, SPT5435MSmagnetically coded 360° controllable steering gear, miniature electromagnetic lock (spring tongue facing left) × 4, electromagnet KK-P30/22.

  Single-channel electromagnetic relay module (self-made), four-way electromagnetic relay module (self-made), XH2.54-2Psingle-head connection line, XH2.54-6Pconnection line, servo extension line.

1.4 Make tools

  Pencil, stainless steel ruler, multi-function screwdriver set, paper cutter, pliers, crimping pliers, scissors, electric soldering iron, etc.

  Note: All my punching tools are screwdrivers. For each hole, three types of cross-heads need to be replaced to ensure that the board does not crack. Therefore, it is recommended to use a special punching tool.

 

01 turntable storage bin


  Chapter 2

2.1 Cutting board size

2.2 Bottom plate

  Draw a reference line according to the table below, and dig the reserved holes:

2.2 Internal base

2.3 Left side panel

2.4 Electromagnetic lock extension wire and copper column reserved

2.5 Right Side Panel

2.6 Fixing the side panels


  Since the door needs to be mounted on the side panel, it is recommended to use tissue paper for caulking, and then add 502 to fasten it to increase the supporting force.

2.7 Fixed door

2.8 Lock

  (1) Lock production (3D printing, can be designed by yourself)

  (2) Lock and fix

2.9 Top cover

2.10 Bearing Top Surface

2.11 Electronic components

2.12 Unicorn barrier

  This type of barrier is suitable for three-category agencies and is not recommended for four-category agencies. Because the three-category space is relatively spacious, there will be no situation where the target board is stuck and unable to fall, and at the same time, the target board can be better organized into a vertical state.

  The turntable storage compartment is the essence of the four-category structure of the Phoenix, and the production part is over here.

 

03 Storage bin loading


3.1 Storage compartment support

  The storage bin bracket should be made according to individual circumstances. The main points to note are:

  (1) Reserve four through holes for fixing the steering wheel;
  (2) Reserve a countersunk hole in the center for screws, and open a 3mm through hole for inserting a screwdriver;
  (3) Reserve a certain space for the plane thrust bearing;
  (4) Reserve the hole for the control line.

▲ Figure 3.1.1 Storage bin bracket

▲ 图3.1.1 储物仓支架

3.2 Rudder wheel

  Before the steering wheel is fixed on the bracket, a M3*6 screw must be left in the middle to connect with the steering gear.

3.3 Plane thrust bearing

  Put the bottom surface of the bearing in the ring groove left by the bracket, and you can choose hot melt glue to fix it, or you can choose not to fix it.

3.4 Connecting the Storage Compartment to the Bracket

  Before connecting, you need to pass the two control lines through the reserved space, and initialize the servo to the desired position, such as 240°, and the red storage compartment is facing forward.

  Finally, tighten the screw connecting the servo, turn it to check whether it is loose, and check whether the initialization angle is normal after powering on.

▲ Figure 3.4.1 The effect of storage once connected to the bracket

▲ 图3.4.1 储物曾与支架连接效果

 

04 Manipulator Composition


4.1 Two-axis robotic arm

  The two steering gears of the robotic arm use SPT5410HV-180 high-voltage digital steering gear, with a speed of up to 0.07sec/60°, and the steering gear rotates stably without shaking the rudder.

  Three days before the race, I tried to use the GXServoX20-270 brushless servo to replace it, and the speed was as high as
0.045sec/60°. Although this steering gear has a large torque and fast speed, the steering gear is unstable, and it is prone to rudder shaking and slow response to loss of action, resulting in pickup failure. In addition, the too fast rotation of the servo will cause the target board to break away from the electromagnet and be thrown out, so it wasted a day and a night of debugging, and finally replaced it with SPT5410.

  The mechanical arm has a simple structure and is mainly composed of standard parts. The upper arm is a large and long U-shaped bracket, and the lower arm is composed of two large and long U-shaped brackets connected with a short U-shaped bracket.

  The whole robotic arm is fixed on the front of the car by a U-shaped 3D printing bracket, and the actuator at the end of the robotic arm is an electromagnet.

▲ Figure 4.1.1 Two-axis robot arm and robot arm fixing bracket

▲ 图4.1.1 两轴机械臂与机械臂固定支架

4.2 Electromagnet

  The electromagnet uses the electromagnet of Yueqing Kaka Electric Model KK-P30/22, and the parameter is DC12V suction force 15kg. The electromagnet is fixed in the reserved hole in the middle of the long U-shaped bracket with matching M4 screws, spring washers and a large M4 washer.

  Electromagnet KK-P30/22 at the end of the mechanical arm:

▲ Figure 4.2.1 Electromagnet

▲ 图4.2.1 电磁铁

  Everyone intuitively thinks that the larger the contact surface of the electromagnet, the better it is to pick up the target board. However, after using a variety of different types of electromagnets, I think that the longer electromagnet is more conducive to picking up the target board. Below I will try to give reasons.

  (1) After the electromagnet is energized, the range of magnetic force is limited to the middle part, that is, the iron core inside the coil has magnetic force, and there is no magnetic force other than that.

▲ Figure 4.2.2 Magnetic field distribution of electromagnet

▲ 图4.2.2 电磁铁磁场分布

  (2) The magnetic force of the electromagnet will decrease sharply as the adsorption distance increases; if the surface of the electromagnet chuck cannot fit tightly with the target plate, the adsorption force will be greatly reduced.

  (3) Assuming a scenario where the angle adjustment of the servo is unreasonable and the surface of the suction cup is not facing the target board when the electromagnet lands, then the part far from the ground will basically lose its adsorption effect.

  (4) The larger the area of ​​the electromagnet, the longer the distance between the far end and the target board after it is stuck at a certain angle, and more magnetic force is "wasted".

▲ Figure 4.2.3 The electromagnet forms a certain inclination angle with the target plate

▲ 图4.2.3 电磁铁与目标板成一定的倾角

  The above is my understanding of the use of the electromagnet. These characteristics of the electromagnet not only affect the selection, but also have guiding significance for the setting of the servo action.

 

05 Servo action setting


5.1 Initialization

  (1) Turntable servo: Lower the robotic arm first, and then initialize the turntable servo to 220°, at this time, the storage compartment marked in red faces forward.
  (2) Lower the servo: lift it up close to the turntable, and initialize it to 95°.
  (3) Upper servo: move forward as far as possible without blocking the view of the camera, initialized to 65°, so that it can quickly turn to the angle of 5° facing the ground.

steer_init();//舵机初始化 
turn_Angle(firststeer,15,180);//下舵机下放以供转盘复位 
turn_Angle(secondsteer,100,180);//上舵机 
systick_delay_ms(200); 
turn_Angle(thirdsteer,220,360);//中舵机归位:360套件一黑 40\黄 130\红 220\蓝 310 
systick_delay_ms(400); 
turn_Angle(firststeer,95,180);//下舵机归位 
turn_Angle(secondsteer,60,180);//上舵机归位 

5.2 Lower and pick up the target board

  (1) The electromagnet is energized.

electromagnet_Set(1);

  (2) Prioritize the rotation of the upper servo to ensure that the upper servo reaches the specified angle (6°) first, which is conducive to the contact surface of the electromagnet and the target plate to fit together, and the absorption is more stable. If this cannot be guaranteed, the scenario mentioned in Chapter 4 4.2 of this article may occur, resulting in adsorption failure.

turn_Angle(secondsteer,6,180);//上舵机转到最下面

  (3) Considering the protection of the steering gear during the normal shunting stage, springs can be used for buffering. However, in order to achieve relatively high precision requirements when putting it into the storage compartment, I adopted a software delay buffering method. For example, when the electromagnet absorbs the target board, it is necessary to set the angle of the lower servo to 25°. When the lower servo is lowered from 95° to 25°, I set a delay of 150ms at the position of 45° as a buffer, which can play a role The role of silent pickup.

  (4) In the competition stage, the buffer delay of mute pickup can be removed, and the macro definition #defineClockUp can be enabled. At this time, the servo will rotate quickly and hit the electromagnet on the target board. There is a risk of damage to the servo gear, but the total time can be reduced by 2s about.

#ifdef ClockUp turn_Angle(firststeer,25,180);//下舵机不完全触碰地面,起缓冲作用提速改 25 
#else 
turn_Angle(firststeer,45,180);//下舵机不完全触碰地面,起缓冲作用稳定改 45 
#endif
//此处跳过储物仓分类转动步骤 
#ifdef ClockUp systick_delay_ms(150);//提速延长目标板接触时间 
#else 
systick_delay_ms(150);//舵机延时缓冲,提速去掉 turn_Angle(firststeer,25,180);//下舵机下放吸取目标板 systick_delay_ms(80);//稳定改 80 
#endif 

5.3 Classification and rotation of storage bins

  The turntable uses a 360° magnetically encoded steering gear, which needs to be given an absolute position for control. I set the red marked storage compartment forward as the initial state of 220°.

  (1) Correspondence

  Each storage compartment needs to perform two tasks of storing forward and opening the door sideways, so it needs to correspond to the angle and the control pin of the electromagnetic lock. The corresponding relationship in the initialization state is as follows:

▲ Figure 5.3.1 Correspondence diagram

▲ 图5.3.1 对应关系图

  (2) Waiting interval

  The steering gear rotates at different angles, and the time required is different. It can be roughly divided into three angle differences: 90°, 180° and 270°. The rated rotation time is 210ms, 420ms and 630ms respectively.

  When the mechanical arm is raised, the turntable will be stuck, so the mechanical arm needs to wait for the turntable to complete. Although there is no need to wait from the beginning to the end, there are roughly four gears, no need to rotate, and the rotation time is short, medium and long.

  If you want to know the angle difference of this rotation, you must make a difference between the position of the servo this time and the position of the previous servo. In fact, it is the difference of the corresponding number 0, 1, 2, 3. With the difference of the rotation angle, you can set it accordingly. different delays.

  (3) Ignoring the influence of different intervals

  The turning time of the turntable does not actually take the game time, because after the electromagnet absorbs the target board, the car model has actually left to go to the next target point, so the follow-up lifting of the mechanical arm will send the target board into the storage compartment. It is completed during the movement of the car model or the adjustment of the position of the body.

  After actual testing, I found that giving the longest delay can also complete all actions before the next task, so I finally unified the delay time. In this case, we can omit the step of finding the angle difference and control them uniformly.

5.4 Send to the storage bin

  This part is all done in the car model movement and does not take up the game time, so it can be delayed boldly.

  (1) Raise the robotic arm slightly and wait for the turntable to rotate

  At this stage, if the lower servo is lifted too high, the mechanical arm will be stuck in the storage compartment of the turntable, so it is necessary to lift the mechanical arm slightly and wait for a few hundred milliseconds. At this time, the body will twist obviously because the center of gravity is too forward.

systick_delay_ms(160); 
turn_Angle(firststeer,50,180);//下舵机抬起等待转盘 
systick_delay_ms(230);

  (2) Raise the robotic arm and prepare to turn the direction of the target board

  The target board has a large area. If the robot arm is not lifted high enough, it will start to turn the direction of the target board, which will cause the corner of the target board to be stuck on the ground and deformed.

▲ Figure 5.4.1 The target board is deformed when it touches the ground

▲ 图5.4.1 目标板接触地面发生形变

  Once the target board is stuck to the ground, there is a high probability that it will come off the electromagnet. The most typical phenomenon is that the robot arm obviously picks up the electromagnet, but the target board is thrown forward. It seems that the servo is too fast or the electromagnet has insufficient suction, but the essential reason is this.

  Therefore, it is necessary to set the lower servo to a position with a relatively large angle (70°), and then give enough delay to allow the lower servo to hit the target value.

turn_Angle(firststeer,60,180);//下舵机抬起避免目标板卡到地面
systick_delay_ms(50);

  (3) Lower the robotic arm and turn the direction of the target board at the same time
'

  'Why did the robot arm go down again just after it was raised? Because there is an attitude adjustment camera above the robotic arm.

  Lifting the robotic arm is to leave space for the target board to turn, and lowering the robotic arm is to avoid the camera. If the robot arm is not lowered and the upper servo is allowed to rotate the target board, the target board will definitely be hit on the camera and the target board will be bounced off.

  In addition, even if the camera is bypassed, the target board may be stuck to the target board in the turntable during the rotation process. The effect is the same as that of the camera, and the target board will be ejected. Therefore, it is necessary to cooperate with the two servos, turn the direction of the target board while lowering the robotic arm, wait for the target board to pass under the camera, and then recover it further.

turn_Angle(secondsteer,100,180);//上舵机只转到一半,避免卡到摄像头 
systick_delay_ms(50); 
turn_Angle(firststeer,40,180);//下舵机下放避免目标板卡到转盘目标板

  (4) Send to the storage bin

  Retrieve the upper and lower servos at the same time, insert the target board obliquely into the storage compartment. Whether there is a target board in the bin has different requirements for the action requirements of sending it into the storage bin.

  If it is the first target board to be placed in the storage compartment, it is necessary to prevent the target board from hitting the top cover and being bounced off when it is cut obliquely, so the mechanical arm can be set slightly forward, so that the target board can freely fall into the storage warehouse. So I set two different actions through flags.

  All four types have the first target board, should we use four flags?
  I use an interesting mathematical tool - prime numbers to solve the flag problem. The first is to set a Boolean flag to mark whether it is the first target board, and the second is to use the accumulated multiplication of prime numbers 2, 3, 5, and 7 to record the first target board of different types.

(5) Servo homing

  After the servos come to a complete stop, the electromagnet is powered off to release the target board, and then the two servos return to the initialization state, waiting for the next handling task.

systick_delay_ms(400);//等待舵机停稳,释放目标板 
electromagnet_Set(0); 
systick_delay_ms(60);
//机械臂归位 
turn_Angle(firststeer,65,180);//下舵机 
turn_Angle(secondsteer,60,180);//上舵机避免遮住摄像头 
systick_delay_ms(80);  
turn_Angle(firststeer,95,180);//下舵机 

5.5 "Unloading" task

  (1) Lower the robotic arm

  Since the warehouse door cannot be closed again after being opened during unloading, in order to avoid the warehouse door being stuck on the robot arm and causing breakage, the robot arm is required to be as close to the ground as possible, so the robot arm is basically dragged on the ground when performing tasks .

turn_Angle(firststeer,0,180);//下舵机下放到最低位置 
turn_Angle(secondsteer,110,180);//上舵机 
systick_delay_ms(100);

  (2) Rotate the turntable to assist in opening the door

  The positions of the four types of "unloading" are consistent with the corresponding positions of the target boards on the turntable. Since we left the bottom type of target boards in the garage for release, the final order of "unloading" is according to the right and upper sides of the arena. , left, and bottom, the corresponding numbers are ③②①④.

  Turn the turntable to an angle and open the door to release the target board. Why do you say that the turntable turns to assist in opening the door?

  If you just open the door in a static state, the target board will automatically push open the door and fall under the force of gravity. However, if the target board moves back before it falls off the car, it will inevitably bring the target board back and move back, which may cause the line to be pressed. penalty.

  Then why not release the target board early before turning? First of all, the car model has not reached the boundary at this time, and secondly, opening the door without reaching the set angle will only cause the target board to fall on the car, so it is not advisable.

  In order not to be sloppy, I set the steering gear to turn a certain angle in a specific direction after opening the warehouse door to throw the target board out, and release the target board quickly and stably. Netizens at station B commented on this as "clean and neat".

  The specific rotation angle and direction should be determined based on which side of the boundary line the target board should fall on. For example, if it is outside the upper boundary, it needs to be thrown forward, and if it is outside the left boundary, it needs to be thrown to the left. Only by setting the direction can the target board be released away from the boundary line.

▲ Figure 5.6.1 Rotation assistance specific angle

▲ 图5.6.1 转动辅助具体角度

  The above is the main points of servo action setting, and the demonstration video will be uploaded to Bilibili.

 

Conclusion  ※


  This article introduces the detailed steps and principles of making the Phoenix four-category handling structure, and at the same time explains the program settings for the movement process of the robotic arm and the turntable storage bin, hoping to inspire readers.

  Whether it is the three categories of the offline competition of the visual group or the four categories of the online competition, we can handle it with ease. The point is that we never rest on our laurels.

  From the very beginning of preparing for the 17th Vision Group, we did not wait for Zhufei to provide a solution demonstration, but created our own path; when others made their solutions, we would not rush to copy them, but to think To achieve the effect you want, give full play to your innovative thinking and creative ability, so that others will never be able to keep up with our pace of creation!

appendix

1. steer_control.c

#include "steer_control.h" 
//#define ClockUp 
int SteerPosition = 2;//起始位置 
int position = 220; 
int prime = 1; 
bool once_flag = 0; 

/**************************************************************************
函数功能:提供舵机的运作的初始化
入口参数:无
返回值:无
使用说明:在 main函数里面调用一次即可 
**************************************************************************/ 

void steer_init() 
{
    
     
    pwm_init(steer_one,50,0); 
    pwm_init(steer_two,50,0); 
    pwm_init(steer_three,50,0);//舵机初始化 
} 

//-----------------------------------------------------------------------------------
// @brief舵机旋转角度设置 // @param whichsteer选择舵机:firststeer,secondsteer,thirdsteer 
// @param angle设置的旋转角度 
// @param maxAngle舵机的最大角度(由舵机本身参数决定,选择 180°和270°或360°) 
// @return void 
// Sample usage: turn_Angle(firststeer,90,270)270°舵机旋转到90°位置 
//-----------------------------------------------------------------------------------¬

void turn_Angle(MySteer Whichsteer,int angle,int maxAngle) 
{
    
     
    switch(Whichsteer) {
    
     
        case firststeer: 
        {
    
     
            if(maxAngle==180) {
    
     
                if(angle<181&&angle>-1) {
    
     
                    pwm_duty(steer_one,(angle*10/9+50)*25); 
                } 
            } else if(maxAngle==270) {
    
     
            	if(angle<271&&angle>-1) {
    
     
            		pwm_duty(steer_one,(angle*20/27+50)*25); 
				} 
			} else if(maxAngle==360) {
    
     
				if(angle<361&&angle>-1) {
    
     
					pwm_duty(steer_one,(angle*5/9+50)*25); 
				} 
			} else return; 
		} 
		break; 
	case secondsteer: {
    
     
		if(maxAngle==180) {
    
     
			if(angle<181&&angle>-1) {
    
     
				pwm_duty(steer_two,(angle*10/9+50)*25); 
			} 
		} else if(maxAngle==270) {
    
     
			if(angle<271&&angle>-1) {
    
     
				pwm_duty(steer_two,(angle*20/27+50)*25); 
			} 
		} else if(maxAngle==360) {
    
     
			if(angle<361&&angle>-1) {
    
     
				pwm_duty(steer_two,(angle*5/9+50)*25); 
			} 
		} 
		else return; 
	} 
	break; 
	case thirdsteer: {
    
     
		if(maxAngle==180) 
		{
    
     
			if(angle<181&&angle>-1) {
    
     
				pwm_duty(steer_three,(angle*10/9+50)*25); 
			} 
		} else if(maxAngle==270) {
    
     
			if(angle<271&&angle>-1) {
    
     
					pwm_duty(steer_three,(angle*20/27+50)*25); 
			} 
		} else if(maxAngle==360) {
    
     
			if(angle<361&&angle>-1) {
    
     
				pwm_duty(steer_three,(angle*5/9+50)*25); 
			} 
		} else return; 
	} 
	break; 

	default: 
		assert(0); 
		break; 
	} 
}

//电磁铁,0为释放,1为吸附 
void electromagnet_Set(uint8_t choose) {
    
     
	gpio_set(C14,choose); 
}

//将物体吸附 
void getImg() 
{
    
     
	int next_position = JudgeThirdSteerPosition(SmallClass); 
	int steerTurnErr = next_position -SteerPosition; 
	if(next_position == 0) //不吸取 
		return;

	//
	electromagnet_Set(1); 
#ifdef ClockUp 
	turn_Angle(firststeer,25,180);//下舵机不完全触碰地面,起缓冲作用提速改 25 
#else 
	turn_Angle(firststeer,45,180);//下舵机不完全触碰地面,起缓冲作用稳定改 45 
#endif 
	turn_Angle(secondsteer,6,180);//上舵机转到最下面 systick_delay_ms(20);

	//分类转动转盘 
	switch(abs(steerTurnErr)) 
	{
    
     
		case 0: {
    
     
			//systick_delay_ms(80); 
			break; 
		} 
		
		case 1: 
		{
    
     
			switch(next_position) {
    
     
				case 1: position = 310;break; 
				case 2: position = 220;break; 
				case 3: position = 130;break; 
				case 4: position = 40;break; 
			} 
			turn_Angle(thirdsteer,position,360);/ /中舵机 
			break; 
		} 
		
		case 2: {
    
     
			switch(next_position) {
    
     
				case 1: position = 310;break; 
				case 2: position = 220;break; 
				case 3: position = 130;break; 
				case 4: position = 40;break; 
			} 
			turn_Angle(thirdsteer,position,360);//中舵机 
		} 

		case 3: {
    
     
			switch(next_position) {
    
     
				case 1: position = 310;break; 
				case 2: position = 220;break; 
				case 3: position = 130;break; 
				case 4: position = 40;break; 
			} 

			turn_Angle(thirdsteer,position,360);//中舵机 
			break; 
		} 
		} 

#ifdef ClockUp 
	systick_delay_ms(150);//提速改 150 
#else 
	systick_delay_ms(150);//提速去掉 
	turn_Angle(firststeer,25,180);//下舵机下放吸取目标板 
	systick_delay_ms(80);//稳定改 80 
#endif 

	SteerPosition = next_position; 
	switch(SteerPosition){
    
    //第一次放置特殊处理 
		
unsigned char JudgeThirdSteerPosition(unsigned char Class) {
    
     
	if(Class==3||Class==10||Class==11) return 1; 
	else if(Class==4||Class==8||Class==13) return 2; 
	else if(Class==1||Class==6||Class==14) return 3; 
	else if(Class==2||Class==9||Class==12) return 4; 
	else return 0; 
}

 
//pullClass: 1,2,3,4
void pulloutStart(unsigned char pullClass) 
{
    
     
	turn_Angle(firststeer,0,180);//下舵机 
	turn_Angle(secondsteer,110,180);//上舵机 
	systick_delay_ms(100); 
	switch(pullClass) 
	{
    
     
		case 1: {
    
     
			turn_Angle(thirdsteer,160,360);//中舵机 178 
			break ; 
		} 
		case 2: {
    
     
			turn_Angle(thirdsteer,260,360);//中舵机 220 
			break ; 
		} 
		case 3: {
    
     
			turn_Angle(thirdsteer,280,360);//中舵机 268 
			break ; 
		} 
		case 4: {
    
     
			turn_Angle(thirdsteer,350,360);//中舵机 310 
			break ; 
		} 
	} 
} 

void pulloutEnd(unsigned char pullClass) 
{
    
     
	switch(pullClass) {
    
     
		case 1: 
		{
    
     
			gpio_set(C15,1); 
			turn_Angle(thirdsteer,200,360);//中舵机右转甩出目标板 220 
			systick_delay_ms(100); 
			gpio_set(C18,0); 
			break ; 
		} 
		case 2: {
    
     
			gpio_set(C18,1); 
			turn_Angle(thirdsteer,178,360);//中舵机左转甩出目标板 
			systick_delay_ms(100); 
			gpio_set(C26,0); 
			break ; 
		} 
		case 3: {
    
     
			gpio_set(C26,1); 
			turn_Angle(thirdsteer,270,360);//中舵机左转甩出目标板 220 
			systick_delay_ms(120); 
			gpio_set(B28,0); 
			break ; 
		} 
		case 4: {
    
     
			gpio_set(B28,1); 
			turn_Angle(thirdsteer,130,360);//中舵机左转甩出目标板 268130 //
			systick_delay_ms(100); 
			break ; 
		} 
	} 
} 

void SteerUp() {
    
     
	//systick_delay_ms(200); 
	turn_Angle(thirdsteer,170,360);//中舵机 220红改 130
	systick_delay_ms(100); 
	turn_Angle(secondsteer,110,180);//上舵机 
	turn_Angle(firststeer,15,180);//下舵机 
	gpio_set(C15,0); 
} 

void putToCar() 
{
    
     
	int next_position = JudgeThirdSteerPosition(SmallClass); 
	if(next_position == 0)//不收回 return;
	//
	systick_delay_ms(160); 
	turn_Angle(firststeer,50,180);//下舵机抬起等待转盘 s
	ystick_delay_ms(230); 
	turn_Angle(firststeer,60,180);//下舵机抬起避免目标板卡到地面 
	systick_delay_ms(50); 
	turn_Angle(secondsteer,100,180);//上舵机只转到一半,避免卡到摄像头
	systick_delay_ms(50); turn_Angle(firststeer,40,180);//下舵机下放避免目标板卡到转盘 

	if(once_flag == 1) {
    
    //第一个放置特殊处理 
		turn_Angle(secondsteer,170,180);//上舵机往后放 
		systick_delay_ms(220); 
		once_flag=0; 
		turn_Angle(firststeer,74,180);//下舵机往后放 
		systick_delay_ms(50); 
		turn_Angle(secondsteer,180,180);//上舵机往后放 
	} 
	else {
    
     
		turn_Angle(secondsteer,140,180);//上舵机往后放 
		systick_delay_ms(160); 
		turn_Angle(firststeer,77,180);//下舵机往后放 76 
		systick_delay_ms(50); 
		turn_Angle(secondsteer,180,180);//上舵机往后放 
	} 
	systick_delay_ms(400);//等待舵机停稳,释放目标板 
	electromagnet_Set(0); 
	systick_delay_ms(60);
	//机械臂归位 
	turn_Angle(firststeer,65,180);//下舵机 
	turn_Angle(secondsteer,60,180);//上舵机避免遮住摄像头 
	systick_delay_ms(80); 
	turn_Angle(firststeer,95,180);//下舵机 
} 


● Links to related diagrams:

Guess you like

Origin blog.csdn.net/zhuoqingjoking97298/article/details/132171469