Introduction: Lunariem Team's Rover

Team member introduction


Kim Si-hoo: Programming and Circuit (Team Leader)


Jang Yu-rim: Video processing (vision processing) (vice team leader)


Cho Seung-yoon, Park Tae-young: Equipment Manufacturing


Choi Ho-yeon, Seo-ni: Production and recording of equipment (in charge of records related to production of equipment)

Supplies

material


2 straight pipes (used to build outstretched part from the frame of the rover, 7 cm)


6 straight sockets (used to connect between pipes, 3.5 to 4 cm)


2 90 degree pipes (used to make corners in the rover frame, 5cm)


6 T-shaped pipes (put multiple sockets in several branches, approximately 7 cm)


12 bearings (used to manufacture rotary shafts, approximately 2 cm)


4 wheels (connected to motor and used to drive rovers)


4 TT GEARED MOTOR (connected to wheels and used to turn wheels to drive rovers)


1 amber colored container (used to form circuits and connect and fabricate suspensions)


2 rod and joints (used to prevent too much rotation of the axis of rotation)


15 M8 nuts (used to manufacture rotary shafts)


8 M6 nuts (used to fix rod and joints)


5 M8 bolts (used to manufacture rotary shafts)


4 M6 bolts (used to secure rod and joints)


One Arduino Mega (acting as the main board of the circuit)


One lithium-ion battery (used for overall power supply of a rubber, 7.4 V)


1 FPV camera (used to observe forward after attachment to rover)


1 camera receiver (used to receive data from the camera)


1 flysky transceiver (used to receive signals from the controller)


1 L298N motor driver (used to supply current to TT-gear motors and current to Arduino and transceiver)

Step 1: Suspension[Person in Charge: Choi Ho-yeon, Seo-ni, Cho Seung-yoon, Park Tae-young]

1. To reduce the volume of the rover, cut the straight socket to about 3.5~4cm.

2. Making 2 pieces of motor and wheel connected one by one

3. One of them is connected to the 90° pipe, and the other is attached to the 2 of the T-shaped pipe.

4. Attach the T-shaped pipe to the straight socket in the middle of the T-shaped pipe and attach another one to the opposite side of the 90 degree pipe.

5. Attach the two connecting parts to the straight pipe and drill two facing holes on the left side of the T-shaped pipe. Insert bolts, nuts, rod and joints.

6. Make it one more time in the same way.


1. Hang the axis of rotation on both sides and attach a straight pipe in the middle.


How to make a rotating shaft is


1. Bring one M8 bolt and prepare four bearings and five M8 nuts.

2. Insert bearings and nuts in order. (Repeat twice)

3. And repeat it once more, with an interval of 1 to 2 cm.


4. And to secure it tighter, align the axis and use metal instantaneous glue to secure it tighter.



This is how the lower body part is completed. The way it works is to make the rod and joints shake a little so that both wheels can turn.


It is connected by rod and joints and requires two straight pipes, one T-shaped pipe and two straight sockets.


Place the T-shaped pipe in the center, remove the center, and insert two straight sockets. And around it, too


Insert the straight pipe. And drill the hole as shown in the picture and insert rod and joints, bolts, and nuts.


The reason for doing this is to make sure that all the wheels touch the ground.

Step 2: Code [Person in Charge: Kim Si-hoo]


Default Settings

#include <IBusBM.h> //IBusBM 라이브러리 생성

#define motorW1_IN1 3 //모터드라이버의 motorW1_IN1부분을 3번에 연결했다고 알려줌
#define motorW1_IN2 4 //모터드라이버의 motorW1_IN2부분을 4번에 연결했다고 알려줌
#define motorW1_IN3 5 //모터드라이버의 motorW2_IN1부분을 5번에 연결했다고 알려줌
#define motorW1_IN4 6 //모터드라이버의 motorW2_IN2부분을 6번에 연결했다고 알려줌

IBusBM IBus; //IBusBm IBus를 지정함
IBusBM IBusSensor; //IBusBm IBusSensor를 지정함

int ch0, ch1, ch2, ch3, ch6 = 0; //변수 ch0, ch1, ch2, ch3, ch6의 값을 0으로 정함
float speed1PWM= 0; //변수 speed1PWM을 0으로 정함

void setup() {

Serial.begin(115200); //시리얼통신을 115200으로 개봉함
IBus.begin(Serial1, IBUSBM_NOTIMER); // Servo iBUS
IBusSensor.begin(Serial2, IBUSBM_NOTIMER); // Sensor iBUS
IBusSensor.addSensor(IBUSS_INTV); // add voltage sensor
}

turning code

void loop() {

IBus.loop();
ch0 = IBus.readChannel(0); //채널 1 좌우방향
ch1 = IBus.readChannel(1); //채널 2 전진후진
ch2 = IBus.readChannel(2); //채널 3 현재 기능 없음
ch3 = IBus.readChannel(3); //채널 4 현재 기능 없음
ch6 = IBus.readChannel(6); //채널 7 현재 기능 없음

if (ch0 > 1600)//우회전
{

int R=map(ch1,1600,2000,30,50); //변수 R의 값을 ch1 변수값에서 나오는 1600~2000의 값을 30~50의 값으로 변환한 값으로 정함
delay(100);
speed1PWM=map(ch1,1500,1000,0,255);
analogWrite(motorW1_IN1, speed1PWM);
digitalWrite(motorW1_IN2, LOW);
digitalWrite(motorW1_IN3, LOW);
analogWrite(motorW1_IN4, speed1PWM);


}

else if (ch0 <1300)//좌회전
{
int R=map(ch1,1600,2000,30,50); //변수 R의 값을 ch1 변수값에서 나오는 1600~2000의 값을 30~50의 값으로 변환한 값으로 정함
delay(100);

speed1PWM=map(ch1,1600,2000,0,255);

digitalWrite(motorW1_IN1, LOW);
analogWrite(motorW1_IN2, speed1PWM);
analogWrite(motorW1_IN3, speed1PWM);
digitalWrite(motorW1_IN4, LOW);

}

//From the bottom, forward and backward codes

else if (ch1 < 1500) //전진
{
speed1PWM=map(ch1,1600,2000,0,255);

 analogWrite(motorW1_IN1, speed1PWM);
 digitalWrite(motorW1_IN2, LOW);
 analogWrite(motorW1_IN3, speed1PWM);
 digitalWrite(motorW1_IN4, LOW);


}


else if (ch1 > 1600) //후진
{


 speed1PWM=map(ch1,1500,1000,0,255);
 digitalWrite(motorW1_IN1, LOW);
 analogWrite(motorW1_IN2, speed1PWM);; 
 digitalWrite(motorW1_IN3, LOW);
 analogWrite(motorW1_IN4, speed1PWM);


}
else
{


 analogWrite(motorW1_IN1, 0);
 digitalWrite(motorW1_IN2, LOW); 
 analogWrite(motorW1_IN3, 0);
 digitalWrite(motorW1_IN4, LOW);


}


}



Step 3: Vision Processing Configuration [Person in Charge: Jang Yourim]


import cv2
import numpy as np

font = cv2.FONT_HERSHEY_SIMPLEX
def facedetect():

face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') # 괄호 안의 코드는 파일 명이다.

try:
cap = cv2.VideoCapture(1) # 끝에 괄호 안의 번호는 카메라ID 번호이다.
except:
print("Video Error")
return

while True:
ret, frame = cap.read()
if not ret:
break

gray = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
# gray = 분석될 이미지 또는 영상 프레임
# scaleFactor = 이미지에서 얼굴 크기가 서로 다른 것을 보상해주는값
# minNeighbors = 얼굴 사이의 최소 간격( 픽셀 )
# minSize = 얼굴의 최소 크기
faces = face_cascade.detectMultiScale(gray,scaleFactor=1.3,minNeighbors=5,minSize=(30,30))

for (x,y,w,h) in faces:
cv2.rectangle(frame, (x,y), (x+w, y+h), (0,255,0), 2)
cv2.putText(frame,'faces',(x-5,y-5),font,0.5,(255,0,0),2)
# faces는 인식을 했을 때 상자 위에 나오는 글자이다. 물체 구분을 위한 글

cv2.imshow('frame',frame)

k = cv2.waitKey(1)
if k == 27:
break

cap.release()
cv2.destroyAllWindows()

facedetect()

‘Install the haarcascade_fronyalface_default.xml' file and put it into the Python file.


And if you add the above code, you can recognize the face.


If the 'haarcascade_fronyalface_default.xml' file is not installed, download the 'opencv-master.zip' file and decompress it.


When it is completely decompressed, go into the file, find 'haarcascade_fronyalface_default.xml' and insert it into the Python file according to the path 'data/haarcascades/haarcascade_frontalface_default.xml'.


Step 4: Circuit