Open source solution for robot production | Intelligent firefighting robot

Author: Huang Feiyang, Hao Mengyan, Xia Yawen, Zhou Fucheng

Unit: Jianghan University

Instructor: Qin Gong, Shizhonglou

1. Introduction to the work

1. Overview

1.1 Introduction to the work

       The intelligent firefighting robot is based on an omnidirectional mobile chassis, multi-link mechanism, visual recognition, hydraulic transmission and other methods. It can realize automatic inspection, automatic identification of fire sources, automatic fire extinguishing and other functions. Through thinking about the theme of the 2022 International Youth Artificial Intelligence Competition Explorer Innovation Design Project: other devices in smart manufacturing scenarios, combined with scenario research and inspection, we found that the fire protection equipment currently on the market cannot well meet the needs of smart manufacturing factories. demand, so we designed this smart fire truck to improve fire safety in smart manufacturing factories.

      This work is mainly composed of an identification unit, a movement unit, and a fire extinguishing unit, and is assembled from the Explorer kit as the main body. This intelligent firefighting robot is designed based on the actual situation, and can be continuously improved according to needs. This work originates from the needs of smart manufacturing factories and is designed around the scenarios and applications of competition robots. It is realistic, effective and feasible, and has strong market adaptability.

1.2 Design background

      Fire is a very serious social disaster that seriously endangers people's property and life safety. If a fire breaks out in some special enterprises, such as chemical and textile enterprises, the losses will be greater and it will be more difficult to put out. If the fire is discovered and extinguished in time, the losses can be greatly reduced. We hope to design an intelligent fire-fighting robot that can be used in daily fire safety inspections. It can conduct inspections day and night, detect fires in time and extinguish them, and reduce the losses caused by fires.

1.3 Design plan

1.3.1 Design ideas

      This product uses multi-sensor information fusion technology to identify the occurrence of fire and locate the ignition point; the smart fire truck is designed to travel automatically based on the AGV guidance method, and quickly reaches the fire point based on the optimization algorithm; upon arrival, the smart fire truck immediately sounds an alarm sound, and at the same time the car Equipped with a variety of fire extinguishers and sensors, it can use multi-sensor information fusion technology to identify the surrounding environment and determine the type of fire based on the location of the fire sensor, and then select the corresponding fire extinguisher to quickly extinguish the fire; the car can use multi-sensor information fusion technology to identify whether there is a fire After the fire is extinguished and the fire is extinguished, the car will continue to inspect and leave work records. When relevant staff arrive, they will replenish the car with corresponding fire-extinguishing media and deal with the losses and related impacts caused by the fire.

Car workflow

1.3.2 Structure of the work

      This product is mainly composed of a motion system, a hydraulic system, a robotic arm system, an identification system, and a control system. The electronic control part uses Arduino as the main control to control the corresponding system.

Developer's work - [S009] Intelligent Fire Fighting Robot - Work Introduction - Special Robot - Mecanum Wheel - Omnidirectional Chassis - Robotic Arm Car - Machine Vision - Artificial Intelligence - Machine Spectrum Robotway - Open Source - Figure 3
Car system structure diagram

2. Scenario research

2.1 Market analysis

2.1.1 Relevant policy support

      According to instructions from relevant government documents, the construction of "smart firefighting" must be promoted. The introduction of "intelligence" and informatization can help accelerate the in-depth integration of modern technology and firefighting work, and better adapt to new forms and new challenges in fire prevention and control.

Government related instruction documents

2.1.2 Huge market potential

      With the steady growth of the national economy, industry has developed rapidly, and the number of intelligent workshops continues to increase. However, fires in various production workshops and accidents caused by fires also continue to occur. Fires and other safety accidents have occurred frequently in our country in recent years. As of 2021, our country has received a total of 748,000 fire reports, a year-on-year increase of 196.83%, causing direct economic losses of 6.75 billion yuan, a year-on-year increase of 68.33%.

Fire scene

      Since 2014, the size of China's fire-fighting robot market has continued to grow, growing to 1.1 billion yuan by 2018, a year-on-year increase of 54%; it is initially estimated that by 2023, the industry size of my country's fire-fighting robot market will reach 3.7 billion yuan, and fire-fighting vehicles have a huge market potential. China's firefighting robots have a small number, limited applications, and are highly regional. They are better equipped in economically developed areas, but the number is also very limited, generally between 2 and 5, and most of the robots currently equipped are imported. Lord. As China intensifies its research and development of fire-fighting robots, it is expected that domestic fire-fighting robots will gradually replace imported fire-fighting robots in the future. China's current major fire-fighting robot manufacturers include Shandong Silicon Rabbit Intelligent Equipment Co., Ltd., Tianchang Ankang Fire Fighting Equipment Co., Ltd., etc.

Firefighting robot sales forecast

2.2 Market research

TAF35 Tomahawk multifunctional firefighting robot

     After investigation, common intelligent fire-fighting equipment on the market has the following characteristics: huge size, high cost, lack of technology, single fire-extinguishing medium, etc. Therefore, if there is a small size, unmanned fire-fighting, equipped with a variety of fire-fighting media, At the same time, robots that can be connected in parallel to the fire protection system will have good market prospects.

3. Innovation points and applications of the work

3.1 Innovation points

1. This product uses multi-sensor information fusion technology to identify the occurrence of fire and locate the ignition point to achieve more accurate and timely identification.

2. Compared with traditional fire extinguishing equipment on the market, this device is smarter and more effective.

3. Complying with the development trend of national robot engineering, it can supplement existing relevant literature and market products and provide new reference.

3.2 Application prospects

      This work is designed to be small in size and compact in structure. It has the advantages of unmanned fire extinguishing and equipped with a variety of firefighting media. It can meet the current needs for fire protection in smart manufacturing factories and greatly improve the safety of people's lives and property. At the same time, the robot can also be connected in parallel to the fire protection system to promptly feedback on-site conditions to the control center, greatly improving the fire safety factor.

2. Technical description

1.Motion system

1.1 Motion system structure

       The motion system is the basis for the robot's work. According to the needs of the use environment, the following requirements are put forward for the robot's motion: smooth and reliable, flexible movement, and a certain load-bearing capacity. Compared with the mobile robot chassis on the market, we chose the four-wheel drive Mecanum wheel. Due to the special structure of the Mecanum wheel, omnidirectional movement can be achieved by controlling the relative rotation directions of the four wheels.

       Its specific structure is shown in the figure below:

Movement system structure diagram

1.2 Establishment of motion system model

      First, the movement of the chassis is described by three independent variables:

      The motion of the chassis can be decomposed into translation speed vt and rotation speed w. The translation speed can be decomposed into X-axis translation and Y-axis translation. Therefore, it can be represented by three motion variables, and these three variables are independent of each other. , as shown in the figure below: In the figure, Vtx represents the speed of the chassis moving along the X-axis, and the positive direction is to the right; Vty represents the speed of the chassis moving along the Y-axis, that is, the front and rear direction, and the positive direction is forward; w represents the rotation speed of the chassis around the yaw axis. Angular velocity, positive direction is counterclockwise. The above three quantities are generally regarded as the speed of the geometric center of the four wheels (the intersection of the diagonals of the rectangle).

Chassis motion breakdown

      Use the three variables decomposed above to express the speed of each wheel at the axis center position; from the figure below, the speed direction of the main wheel is the blue arrow V, and vr is the tangent direction of the center line.

Exploded view of wheel axis position movement

      It can be seen that the total speed v of the main wheel is equal to the sum of the speed vector of the chassis and the speed vector in the tangential direction, that is

      Calculate the components of the X and Y axes respectively:

      In the formula, a is the component Rx along the horizontal direction, b is the component Ry along the vertical direction, and the speed of the other three wheel axes can be calculated in the same way.

Other wheel speed breakdown diagrams

      Calculate the speed of a single wheel in contact with the ground from the axis center speed; according to the wheel axis speed v, the speed along the roller direction vt and perpendicular to the roller direction vn can be decomposed, as shown in the following figure:

Speed ​​breakdown diagram

      Among them, vn is used to make the roller idle and can be ignored. Then the speed vt along the axis can be obtained:

      The true rotational speed of the individual wheels is calculated from the roller speed and thus the rotational speed of the motor is given. The speed of the above roller is as shown in the figure below:

Speed ​​decomposition diagram

      The wheel speed can be calculated as:

title

      To sum up, when the moving state of the chassis is given, the rotation speed of each wheel can be calculated separately by the following formula: 

2. Hydraulic system

      The air compressor works to compress air into the cylinder, which contains the fire extinguishing medium. In the initial state of the solenoid valve, the air path is closed. After the solenoid valve is in the appropriate position, the solenoid valve operates, the air path is opened, and the compressed air in the high-pressure cylinder is output with the fire extinguishing medium, thereby achieving the fire extinguishing function.

Hydraulic schematic diagram

3. Robotic arm system

      In order to cope with the randomness of the fire point, the fire extinguishing terminal needs to change its position in the space in real time according to the location of the fire point. In addition, it outputs high pressure and high flow rate of fire extinguishing media per unit time. Therefore, the reaction force on the device is larger. According to the actual situation, we design the composite linkage mechanism so that the movement range of the terminal angle ẞ is - 90°-120°. The angle transformation relationship between the driving angle α and the terminal angle ẞ is approximately 3:1. We ensure that we use a composite connecting rod structure to fulfill the requirements. The structure has a large load capacity, is not easy to wear and has high transmission efficiency. This device adequately meets our needs.

Simple diagram of composite linkage mechanism

      According to the relevant kinematics software, draw a simplified diagram of the system mechanism and construct its kinematics model for relevant analysis, as shown in the figure below. The output result is obtained. If the system input is stable, the output speed and force are stable. If a disturbance is received, the system stability is better.

kinematic analysis

4. Identification system

     The identification module is mainly composed of the MQ-2 smoke gas sensor installed indoors and the openmv machine vision module mounted on the body of the work: the smoke gas sensor detects whether the indoor smoke concentration exceeds the threshold in real time, achieving rough positioning, that is, determining the fire The room in which it is located; the machine vision module detects whether there is a flame in the current picture and achieves precise positioning, that is, determining the specific location of the flame.

4.1 Smoke detection device

MQ-2 Smoke Gas Sensor
openmv machine vision module

      The MQ-2 smoke sensor is a tin dioxide semiconductor gas-sensitive material and a surface ion N-type semiconductor. At 200 to 300 degrees Celsius, tin dioxide adsorbs oxygen in the air, forming negative ion adsorption of oxygen, which reduces the electron density in the semiconductor, thereby increasing its resistance value. When in contact with smoke, if the potential barrier at the grain boundary changes due to the smoke, it will cause changes in surface conductivity. This can be used to obtain information about the existence of this smoke. The greater the concentration of smoke, the greater the conductivity, and the lower the output resistance, the greater the output analog signal.

      When a fire occurs, the resistance of the gas-sensitive material in MQ-2 decreases as the smoke gas concentration increases, and the analog signal output by the MQ-2 module will also increase. This design chose the AD signal acquisition method, that is, the main control chip converts the voltage signal into a digital signal through a built-in analog-to-digital converter, and then converts it into an accurate smoke concentration value. The internal circuit of the MQ-2 sensor is shown in the figure below:

MQ-2 sensor internal circuit

4.2 Visual recognition system

      The visual recognition system consists of Open MV and a servo pan and tilt: the servo pan and tilt is used to rotate left and right, up and down to enable Open MV to identify whether there is a flame in the room, and Open MV to identify whether there is a flame in the current environment.

    (1) Based on the functional requirements, a two-degree-of-freedom gimbal mechanical structure is set up (as shown in the figure below), with two degrees of freedom in Yaw (swing) and Pitch (pitch) directions. The entire system structure of the gimbal is designed by the Explorer Kit, which is responsible for the rotation device of Open MV and can achieve high rotation and precise positioning of the camera at 160° in the horizontal direction and 90° in the vertical direction. Two M01 standard servo servos are used to control the gimbal, responsible for horizontal rotation and vertical rotation respectively.

Schematic diagram of steering gear gimbal

    (2) The Open MV camera is an open source, compact, low-power, low-cost, and powerful machine vision module. The Open MV4 H7 PLUS uses the STM32H743 processor as the core and integrates the OV5640 photosensitive element. The camera itself has some built-in images. The processing algorithm supports multiple image formats such as RGB565 and grayscale, and introduces interfaces such as UART, I2C, SPI, PWM, ADC, DAC and GPIO to facilitate the expansion of peripheral functions. The full-speed USB interface (12 Mbps) is used to connect to the integrated development environment Open MV IDE on the computer to assist in programming, debugging, and updating firmware. Machine vision applications can be easily completed through the Micro Python language. The TF card slot supports large-capacity TF cards, has a read and write speed of 100 Mbps, and can be used to store programs and save photos.

      The flame recognition function uses a convolutional neural network to train the model of the object that needs to be recognized, and then imports the trained model into Open MV. During training, you first use Open MV IDE to build a data set, upload the data set to Edge Impulse in the cloud, use the Tensor Flow deep learning algorithm for neural network training, and generate a Tensor Flow Lite convolutional neural network (CNN). Will run on Open MV Cam. This data set includes various flame pictures. When the flame picture is displayed in the image, the camera calls the internal neural network library for identification and generates the corresponding degree of confidence. Therefore, when the confidence level is greater than 80%, it is sent to the control board through the serial port. In order to achieve the requirements of flame identification (as shown in the figure below).

openmv identification interface

5. Control system

5.1 Selection of control system

      Since this work requires a large number of IO interfaces, Arduino Mega 2560 was chosen as the controller. Arduino  

      Mega 2560 is a core circuit board using USB interface. Its biggest feature is that it has up to 54 digital inputs and outputs. The processor core of Mega2560 is ATmega2560, which also has 54 digital input/output ports, 16 analog inputs, 4 UART interfaces, a 16MHz crystal oscillator, 1 USB port, a power socket, an ICSP header and a reset button .

5.2 Overall introduction to control

This work uses Arduino Mega 2560 as the control core, selects the steering gear and motor as the power source, and completes it through the cooperation of the steering gear and the mechanical structure. The system structure is shown in the figure below:

System structure diagram

6. Difficulties and solutions

6.1 Stable movement of robot manipulator

      Initially, the robotic arm was designed using the method of connecting and superimposing multiple servos. However, in the final product, the execution end of the robot was shaken violently due to external disturbances.

      In order to solve this problem, relevant information was consulted, and after comparative analysis, a multi-link mechanism was designed so that the output end of the robot can move stably to ensure the accuracy of fire extinguishing. As shown below:

Multi-link robotic arm

6.2 Working environment of micro air compressor

      Due to functional requirements, the robot is equipped with a micro air compressor. However, during actual work, it was found that the compressor vibrated violently during operation, which greatly affected the normal movement of the robot.

      To solve this problem, a cushioning pad can be installed at the installation location of the micro air compressor to offset the severe vibrations generated when the compressor is working. As shown below:

Micro air compressor cushion

3. Program code

1. Sample program

① Intelligent fire robot motion program (main.ino):

#include <SoftwareSerial.h> //蓝牙

SoftwareSerial BT(10, 11);

//Pin10为RX,接HC05的TX针脚

//Pin11为TX,接HC05的RX针脚


char val;

int input1 = 30; // 定义uno的pin 5 向 input1 输出

int input2 = 31; // 定义uno的pin 6 向 input2 输出

int enA = 2; // 定义uno的pin 3 向 输出A使能端输出

int input3 = 32;

int input4 = 33;

int enB = 3;

int input5 = 34;

int input6 = 35;

int enC = 4;

int input7 = 36;

int input8 = 37;

int enD = 5;

int diancifa = 6;




/****************************主卧*****************************/

void bedroom1()

{

digitalWrite(input1,LOW);   //直行

  digitalWrite(input2,HIGH);

  digitalWrite(input3,LOW);

  digitalWrite(input4,HIGH);

  digitalWrite(input5,HIGH);

  digitalWrite(input6,LOW);

  digitalWrite(input7,HIGH);

  digitalWrite(input8,LOW);

  analogWrite(enA,195);

  analogWrite(enB,185);

  analogWrite(enC,210);

  analogWrite(enD,185);

  delay(1400);


//   digitalWrite(input1,LOW);   //矫正

//   digitalWrite(input2,HIGH);

//   digitalWrite(input3,LOW);

//   digitalWrite(input4,HIGH);

//   digitalWrite(input5,HIGH);

//   digitalWrite(input6,LOW);

//   digitalWrite(input7,LOW);

//   digitalWrite(input8,LOW);

//   analogWrite(enA,195);

//   analogWrite(enB,185);

//   analogWrite(enC,210);

//   delay(450);

//

//   digitalWrite(input1,LOW);   //直行

//   digitalWrite(input2,HIGH);

//   digitalWrite(input3,LOW);

//   digitalWrite(input4,HIGH);

//   digitalWrite(input5,HIGH);

//   digitalWrite(input6,LOW);

//   digitalWrite(input7,HIGH);

//   digitalWrite(input8,LOW);

//   analogWrite(enA,195);

//   analogWrite(enB,185);

//   analogWrite(enC,210);

//   analogWrite(enD,185);

//   delay(1000);

//

//   digitalWrite(input1,LOW);   //停止

//   digitalWrite(input2,LOW);

//   digitalWrite(input3,LOW);

//   digitalWrite(input4,LOW);

//   digitalWrite(input5,LOW);

//   digitalWrite(input6,LOW);

//   digitalWrite(input7,LOW);

//   digitalWrite(input8,LOW);

//   delay(5000);

//

//   digitalWrite(input1,LOW);   //直行

//   digitalWrite(input2,HIGH);

//   digitalWrite(input3,LOW);

//   digitalWrite(input4,HIGH);

//   digitalWrite(input5,HIGH);

//   digitalWrite(input6,LOW);

//   digitalWrite(input7,HIGH);

//   digitalWrite(input8,LOW);

//   analogWrite(enA,195);

//   analogWrite(enB,185);

//   analogWrite(enC,210);

//   analogWrite(enD,185);

//   delay(4200);

//

  digitalWrite(input1,LOW);   //向左转

  digitalWrite(input2,HIGH);

  digitalWrite(input3,LOW);

  digitalWrite(input4,HIGH);

  digitalWrite(input5,LOW);

  digitalWrite(input6,HIGH);

  digitalWrite(input7,HIGH);

  digitalWrite(input8,LOW);

  analogWrite(enA,200);

  analogWrite(enB,200);

  analogWrite(enC,200);

  analogWrite(enD,200);

  delay(2800);

//

//   digitalWrite(input1,LOW);   //直行

//   digitalWrite(input2,HIGH);

//   digitalWrite(input3,LOW);

//   digitalWrite(input4,HIGH);

//   digitalWrite(input5,HIGH);

//   digitalWrite(input6,LOW);

//   digitalWrite(input7,HIGH);

//   digitalWrite(input8,LOW);

//   analogWrite(enA,195);

//   analogWrite(enB,185);

//   analogWrite(enC,210);

//   analogWrite(enD,185);

//   delay(1200);

digitalWrite(input1,LOW);   //停止

  digitalWrite(input2,LOW);

  digitalWrite(input3,LOW);

  digitalWrite(input4,LOW);

  digitalWrite(input5,LOW);

  digitalWrite(input6,LOW);

  digitalWrite(input7,LOW);

  digitalWrite(input8,LOW);


//delay(5000);

//   digitalWrite(diancifa,LOW);

//   delay(3000);

//   digitalWrite(diancifa,HIGH);

  //delay(3000);


  }



/****************************主卧————>阳台*****************************/

void balcony()

{

  digitalWrite(input1,HIGH);   //后退

  digitalWrite(input2,LOW);

  digitalWrite(input3,HIGH);

  digitalWrite(input4,LOW);

  digitalWrite(input5,LOW);

  digitalWrite(input6,HIGH);

  digitalWrite(input7,LOW);

  digitalWrite(input8,HIGH);

  analogWrite(enA,195);

  analogWrite(enB,185);

  analogWrite(enC,210);

  analogWrite(enD,185);

  delay(1500);


  digitalWrite(input1,HIGH);   //向右转

  digitalWrite(input2,LOW);

  digitalWrite(input3,HIGH);

  digitalWrite(input4,LOW);

  digitalWrite(input5,HIGH);

  digitalWrite(input6,LOW);

  digitalWrite(input7,LOW);

  digitalWrite(input8,HIGH);

  analogWrite(enA,200);

  analogWrite(enB,200);

  analogWrite(enC,200);

  analogWrite(enD,200);

  delay(2900);


  digitalWrite(input1,HIGH);   //后退

  digitalWrite(input2,LOW);

  digitalWrite(input3,HIGH);

  digitalWrite(input4,LOW);

  digitalWrite(input5,LOW);

  digitalWrite(input6,HIGH);

  digitalWrite(input7,LOW);

  digitalWrite(input8,HIGH);

  analogWrite(enA,195);

  analogWrite(enB,185);

  analogWrite(enC,210);

  analogWrite(enD,185);

  delay(3000);


  digitalWrite(input1,HIGH);   //矫正

  digitalWrite(input2,LOW);

  digitalWrite(input3,HIGH);

  digitalWrite(input4,LOW);

  digitalWrite(input5,LOW);

  digitalWrite(input6,HIGH);

  digitalWrite(input7,LOW);

  digitalWrite(input8,LOW);

  analogWrite(enA,195);

  analogWrite(enB,185);

  analogWrite(enC,210);

  delay(300);


  digitalWrite(input1,HIGH);   //后退

  digitalWrite(input2,LOW);

  digitalWrite(input3,HIGH);

  digitalWrite(input4,LOW);

  digitalWrite(input5,LOW);

  digitalWrite(input6,HIGH);

  digitalWrite(input7,LOW);

  digitalWrite(input8,HIGH);

  analogWrite(enA,195);

  analogWrite(enB,185);

  analogWrite(enC,210);

  analogWrite(enD,185);

  delay(3000);

  digitalWrite(input1,LOW);   //向左转

digitalWrite(input2,HIGH);

  digitalWrite(input3,LOW);

  digitalWrite(input4,HIGH);

  digitalWrite(input5,LOW);

  digitalWrite(input6,HIGH);

  digitalWrite(input7,HIGH);

  digitalWrite(input8,LOW);

  analogWrite(enA,200);

  analogWrite(enB,200);

  analogWrite(enC,200);

  analogWrite(enD,200);

  delay(3350);


  digitalWrite(input1,LOW);   //直行

  digitalWrite(input2,HIGH);

  digitalWrite(input3,LOW);

  digitalWrite(input4,HIGH);

  digitalWrite(input5,HIGH);

  digitalWrite(input6,LOW);

  digitalWrite(input7,HIGH);

  digitalWrite(input8,LOW);

  analogWrite(enA,195);

  analogWrite(enB,185);

  analogWrite(enC,210);

  analogWrite(enD,185);

  delay(3000);


  digitalWrite(input1,LOW);   //矫正

  digitalWrite(input2,HIGH);

  digitalWrite(input3,LOW);

  digitalWrite(input4,HIGH);

  digitalWrite(input5,HIGH);

  digitalWrite(input6,LOW);

  digitalWrite(input7,LOW);

  digitalWrite(input8,LOW);

  analogWrite(enA,195);

  analogWrite(enB,185);

  analogWrite(enC,210);

  delay(300);


  digitalWrite(input1,LOW);   //直行

digitalWrite(input2,HIGH);

  digitalWrite(input3,LOW);

  digitalWrite(input4,HIGH);

  digitalWrite(input5,HIGH);

  digitalWrite(input6,LOW);

  digitalWrite(input7,HIGH);

  digitalWrite(input8,LOW);

  analogWrite(enA,195);

  analogWrite(enB,185);

  analogWrite(enC,210);

  analogWrite(enD,185);

  delay(2500);


  digitalWrite(input1,LOW);   //矫正

  digitalWrite(input2,HIGH);

  digitalWrite(input3,LOW);

  digitalWrite(input4,HIGH);

  digitalWrite(input5,HIGH);

  digitalWrite(input6,LOW);

  digitalWrite(input7,LOW);

  digitalWrite(input8,LOW);

  analogWrite(enA,195);

  analogWrite(enB,185);

  analogWrite(enC,210);

  delay(300);


  digitalWrite(input1,LOW);   //停止

  digitalWrite(input2,LOW);

  digitalWrite(input3,LOW);

  digitalWrite(input4,LOW);

  digitalWrite(input5,LOW);

  digitalWrite(input6,LOW);

  digitalWrite(input7,LOW);

  digitalWrite(input8,LOW);

  }




/****************************厨房*****************************/

void kitchen()

{

  digitalWrite(input1,LOW);   //直行

  digitalWrite(input2,HIGH);

  digitalWrite(input3,LOW);

  digitalWrite(input4,HIGH);

  digitalWrite(input5,HIGH);

  digitalWrite(input6,LOW);

  digitalWrite(input7,HIGH);

  digitalWrite(input8,LOW);

  analogWrite(enA,185);

  analogWrite(enB,185);

  analogWrite(enC,202);

  analogWrite(enD,185);

  delay(600);

  digitalWrite(input1,LOW);   //向左转

  digitalWrite(input2,HIGH);

  digitalWrite(input3,LOW);

  digitalWrite(input4,HIGH);

  digitalWrite(input5,LOW);

  digitalWrite(input6,HIGH);

  digitalWrite(input7,HIGH);

  digitalWrite(input8,LOW);

  analogWrite(enA,200);

  analogWrite(enB,200);

  analogWrite(enC,200);

  analogWrite(enD,200);

  delay(3300);


  digitalWrite(input1,LOW);   //直行

digitalWrite(input2,HIGH);

  digitalWrite(input3,LOW);

  digitalWrite(input4,HIGH);

  digitalWrite(input5,HIGH);

  digitalWrite(input6,LOW);

  digitalWrite(input7,HIGH);

  digitalWrite(input8,LOW);

  analogWrite(enA,185);

  analogWrite(enB,185);

  analogWrite(enC,210);

  analogWrite(enD,150);

  delay(5000);

//   digitalWrite(input1,LOW);   //直行

//   digitalWrite(input2,HIGH);

//   digitalWrite(input3,LOW);

//   digitalWrite(input4,HIGH);

//   digitalWrite(input5,HIGH);

//   digitalWrite(input6,LOW);

//   digitalWrite(input7,LOW);

//   digitalWrite(input8,LOW);

//   analogWrite(enA,195);

//   analogWrite(enB,185);

//   analogWrite(enC,220);

//   delay(400);

  digitalWrite(input1,LOW);   //直行

  digitalWrite(input2,HIGH);

  digitalWrite(input3,LOW);

  digitalWrite(input4,HIGH);

  digitalWrite(input5,HIGH);

  digitalWrite(input6,LOW);

  digitalWrite(input7,HIGH);

  digitalWrite(input8,LOW);

  analogWrite(enA,185);

  analogWrite(enB,185);

  analogWrite(enC,210);

  analogWrite(enD,165);

  delay(3400);


  digitalWrite(input1,LOW);   //停止

  digitalWrite(input2,LOW);

  digitalWrite(input3,LOW);

  digitalWrite(input4,LOW);

  digitalWrite(input5,LOW);

  digitalWrite(input6,LOW);

  digitalWrite(input7,LOW);

  digitalWrite(input8,LOW);


  delay(3000);


  digitalWrite(input1,HIGH);   //返回

  digitalWrite(input2,LOW);

  digitalWrite(input3,HIGH);

  digitalWrite(input4,LOW);

  digitalWrite(input5,LOW);

  digitalWrite(input6,HIGH);

  digitalWrite(input7,LOW);

  digitalWrite(input8,HIGH);

  analogWrite(enA,185);

  analogWrite(enB,185);

  analogWrite(enC,210);

  analogWrite(enD,185);

  delay(3500);

//   digitalWrite(input1,LOW);

//   digitalWrite(input2,HIGH);

//   digitalWrite(input3,LOW);

//   digitalWrite(input4,HIGH);

//   digitalWrite(input5,LOW);

//   digitalWrite(input6,HIGH);

//   digitalWrite(input7,LOW);

//   digitalWrite(input8,LOW);

//   analogWrite(enA,195);

//   analogWrite(enB,185);

//   analogWrite(enC,210);

//   delay(400);

  digitalWrite(input1,HIGH);

  digitalWrite(input2,LOW);

  digitalWrite(input3,HIGH);

  digitalWrite(input4,LOW);

  digitalWrite(input5,LOW);

  digitalWrite(input6,HIGH);

  digitalWrite(input7,LOW);

  digitalWrite(input8,HIGH);

  analogWrite(enA,185);

  analogWrite(enB,185);

  analogWrite(enC,210);

  analogWrite(enD,185);

  delay(5400);
digitalWrite(input1,HIGH);   //转弯

  digitalWrite(input2,LOW);

  digitalWrite(input3,HIGH);

  digitalWrite(input4,LOW);

  digitalWrite(input5,HIGH);

  digitalWrite(input6,LOW);

  digitalWrite(input7,LOW);

  digitalWrite(input8,HIGH);

  analogWrite(enA,200);

  analogWrite(enB,200);

  analogWrite(enC,200);

  analogWrite(enD,200);

  delay(1700);

 

  digitalWrite(input1,LOW);   //停止

  digitalWrite(input2,LOW);

  digitalWrite(input3,LOW);

  digitalWrite(input4,LOW);

  digitalWrite(input5,LOW);

  digitalWrite(input6,LOW);

  digitalWrite(input7,LOW);

  digitalWrite(input8,LOW);

  }


void go()

{

      //测试

digitalWrite(18,LOW);

      delay(3000);

      digitalWrite(18,HIGH);

      delay(6000);

      digitalWrite(18,LOW);

      delay(3000);

      digitalWrite(18,HIGH);

      delay(6000);

      digitalWrite(18,LOW);

      delay(3000);

      digitalWrite(18,HIGH);

      delay(6000);

}



void goo()

{

      //测试

      digitalWrite(18,HIGH);

      delay(3000);

      digitalWrite(18,LOW);

      delay(30000);

}




void setup()

{

      //蓝牙

      Serial.begin(9600);

      Serial.println("Buletooth is ready!");

      BT.begin(9600);

      pinMode(input1,OUTPUT);

      pinMode(input2,OUTPUT);

      pinMode(enA,OUTPUT);

      pinMode(input3,OUTPUT);

      pinMode(input4,OUTPUT);

      pinMode(enB,OUTPUT);

      pinMode(input6,OUTPUT);

      pinMode(enC,OUTPUT);

      pinMode(input7,OUTPUT);

      pinMode(input5,OUTPUT);

      pinMode(input8,OUTPUT);

      pinMode(enD,OUTPUT);

      pinMode(diancifa,OUTPUT);

      pinMode(18,OUTPUT);//电磁阀

     

}


void loop() {

  if (Serial.available()) {

    val = Serial.read();

    BT.print(val);

  }

  if (BT.available()) {

    val = BT.read();

    Serial.print(val);

    switch(val){

      case '1': bedroom1();break;

      case '2': balcony();break;

      case '3':kitchen();break;

//      case '4':kitchen();break;

      case '5':test();break;

      case '6':go();break;

      case '7':goo();break;

    }

  }

}




//void test()

//{

//   digitalWrite(input1,LOW);   //直行

//   digitalWrite(input2,HIGH);

//   digitalWrite(input3,LOW);

//   digitalWrite(input4,HIGH);

//   digitalWrite(input5,HIGH);

//   digitalWrite(input6,LOW);

//   digitalWrite(input7,HIGH);

//   digitalWrite(input8,LOW);

//   analogWrite(enA,165);

//   analogWrite(enB,240);

//   analogWrite(enC,210);

//   analogWrite(enD,185);


//   }


void test()

{

  digitalWrite(input1,LOW);   //直行

  digitalWrite(input2,HIGH);

  digitalWrite(input3,LOW);

  digitalWrite(input4,HIGH);

  digitalWrite(input5,HIGH);

  digitalWrite(input6,LOW);

  digitalWrite(input7,HIGH);

  digitalWrite(input8,LOW);

  analogWrite(enA,195);

  analogWrite(enB,185);

  analogWrite(enC,210);

  analogWrite(enD,185);

  delay(6000);

  digitalWrite(input1,LOW);   //停止

  digitalWrite(input2,LOW);

  digitalWrite(input3,LOW);

  digitalWrite(input4,LOW);

  digitalWrite(input5,LOW);

  digitalWrite(input6,LOW);

  digitalWrite(input7,LOW);

  digitalWrite(input8,LOW);

  }

② Control camera movement program (Untitled.m.ino):

//#include <SoftwareSerial.h>

 Pin10为RX,接HC05的TXD

 Pin11为TX,接HC05的RXD

//SoftwareSerial BT(10, 11);

//

//char val;

//void setup() {

//   Serial.begin(9600);

//   Serial.println("BT is ready!");

//   BT.begin(9600);

//}

//void loop() {

//   if (Serial.available()) {

//    val = Serial.read();

//    BT.print(val);

//  

//   if (BT.available()) {

//    val = BT.read();

//    Serial.print(val);

//   }

//}


#include<Servo.h>


Servo servo_pin_3;//云台竖直           未调整

Servo servo_pin_4;//云台平

Servo servo_pin_7;//竖

Servo servo_pin_8;//平


void setup()

{

  Serial.begin(9600);

  servo_pin_3.attach(3);

  servo_pin_4.attach(4);

  servo_pin_7.attach(7);

  servo_pin_8.attach(8);

  servo_pin_3.write(90);

  servo_pin_4.write(90);

  servo_pin_7.write(135);

  servo_pin_8.write(90);

}


void loop()

{

    delay(3000);//延时

    servo_pin_4.write(90);

    servo_pin_3.write(90);

    servo_pin_7.write(135);

    servo_pin_8.write(90);

    delay(2000);

    move3();//左右摆动

    move1();//固定

    delay(200000);

}

void move1(){

  servo_pin_3.write(80);

  servo_pin_4.write(80);

  servo_pin_7.write(175);

  servo_pin_8.write(95);//偏右

}


void move3(){

  for(int i=0;i<10;i++)//摄像头左右摆动

  {

    servo_pin_4.write(110);

    servo_pin_3.write(110);

    delay(200);

    servo_pin_4.write(70);

    servo_pin_3.write(70);

    }

}

//void move2(){

//   servo_pin_3.write(80);

//   servo_pin_4.write(90);

//   servo_pin_7.write(180);

//   servo_pin_8.write(80);

//   delay(1000000);

//}

#include<Servo.h>



Servo servo_pin_3;



#define ECHOPIN 14

#define TRIGPIN 15

void setup()

{

   Serial.begin(9600);

   pinMode(ECHOPIN, INPUT);

   pinMode(TRIGPIN, OUTPUT);

   servo_pin_3.attach(3);

}



void loop()

{

   float distance;

   for(int i=0;i<300;i++)

   {

    servo_pin_3.write(10);

    digitalWrite(TRIGPIN, LOW);

    delay(2);

    digitalWrite(TRIGPIN, HIGH);

    delay(10);

    digitalWrite(TRIGPIN, LOW);

    distance = pulseIn(ECHOPIN, HIGH);

    distance= distance/58;

    Serial.println(distance);

   }

   if(distance<=70)

   {

    move1();

    Serial.println("已执行");

   }

   else

    Serial.println("未检测到");

}

void move1()

{

        for(int i=0;i<170;i++){

          servo_pin_3.write( 10+i );

          delay(5);

        }

   delay(15000000);

}





//

//

//

#include<Servo.h>

Servo servo_pin_3;

#define hongwai 15

void setup()

{

   Serial.begin(9600);

   pinMode(hongwai, INPUT);

   servo_pin_3.attach(3);

}

void loop()

{

   delay(5000);

   servo_pin_3.write(10);



   if(digitalRead(hongwai)){

    Serial.println("未检测到");

     }

   else

    {

      move1();

    Serial.println("已执行");

   }

}

void move1()

{

   for(int i=1;i<=160;i++)

   {

        servo_pin_3.write( 10+i );

        delay( 10 );

   }

   delay(5000);

}

For details of the program source code and prototype stp diagram, please see Intelligent Fire Fighting Robot

4. References

[1] Xu Bowei, Ma Zhiyong, Li Yue. Research progress and application of multi-sensor information fusion technology in environmental perception [J]. Computer Measurement and Control, 2022, 30(09): 1-7+21.

[2] Zhao Ling. Multi-sensor information fusion technology and its application [J]. Infrared, 2021, 42(01): 21-26.

[3] Wang Wei. Multi-sensor information fusion technology based on intelligent robots [J]. Electronic Testing, 2022, (01): 81-83.

[4] Wang Qiang, Shen Tao, Guo Chao. Research on the application of multi-sensor information fusion technology in robot systems [J]. Science and Technology Wind, 2019, (24): 8.

[5] Wei Hongfei, Zhao Hui. Application of multi-sensor information fusion technology in fire alarm systems [J]. Modern Electronic Technology, 2013, 36(06): 139-140+144.

[6] Sun Chao, Yang Qianming, Wang Fei, Wang Wenlin. Research on stability of four-wheel drive AGV based on collaborative fuzzy control [J]. Machine Tools and Hydraulics, 2020, 48(17): 162-169.

[7] Yan Chenkai, Du Yu, Wu Zhihong. Concept design of omnidirectional mobile fire detection robot based on Mecanum wheel [J]. Industrial Design, 2022, (06): 158-160.

[8] Liu Zhuoyuan, Lu Guiping, Peng Gangju. Research on Mecanum wheel omnidirectional mobile platform based on vector analysis method [J]. Mechanical and Electrical Engineering Technology, 2022, 51(05): 147-149+241.

[9] Yang Pengshuai, Wang Qi, Wang Weixi, Zhou Jingyu, Gao Jinke. Research on tracking control strategy of intelligent vehicles based on Mecanum wheel [J]. Industrial Control Computer, 2022, 35(02): 112-115.

[10] Liu Weibo, Yu Jiarui, Jin Yidan, Ye Hongling. Dynamic analysis of the Mecanum wheel [A]. Beijing Mechanics Society. Proceedings of the 28th Annual Academic Conference of the Beijing Mechanics Society (Part 1) [C] .Beijing Mechanics Society: Beijing Mechanics Society, 2022: 431-432

[11] Yang Junju, Lin Rui, Wang Zhenhua, Sun Lining. Research and design of wheeled mobile robot motion control system [J]. Modern Electronic Technology, 2016, 39(02): 22-27.

[12] Chen Zihao. Development and implementation of fire robot motion control system [D]. Instructor: Dong Hui. Zhejiang University of Technology, 2020.

[13] Xie Yongchao, Yang Li, Yan Jun. Design of smoke detection alarm based on MQ-2 sensor [J]. Computer Measurement and Control, 2021, 29(08): 255-259.

[14] Jiang Bin. Design of automatic fire alarm based on multi-sensors [J]. Automation Application, 2014, (07): 89-90.

[15] Li Siyi, Wang Shaokun. Intelligent line patrol robot based on OpenMV and Arduino [J]. Technology and Innovation, 2020, (22): 50-53.

[16] Li Chengyong, Tan Hanzhong, Wang Sha, Hu Jingjing. Intelligent "seeking" car control system based on OpenMV [J]. Liquid Crystal and Display, 2020, 35(08): 870-876.

Guess you like

Origin blog.csdn.net/Robotway/article/details/131750816