【S108】进击的智能化可控四足机器人
作品说明 |
作者:刘军生 蒋京渝 金增辉 来红 李正强 刘涛
单位:杭州师范大学钱江学院
指导老师:孙红梅
1. 作品内容简介
本项目作品设计的主题是:娱乐性的四足机器人。利用探索者套件,拼搭出由四个舵机控制及其它部件组成的四足机器人;利用Arduino软件,编程实现由遥控器控制机器人的运动方式,将我们课上的学习融会贯通,同时又加入自己的理念与创新。
作品说明
四足机器人的实物
2. 作品结构设计
2.1 设计要求
① 具备轮动功能:4个驱动轮动的直流减速电机,带动与其固定的输出轴,实现动力传输功能,达到行走的目的。
② 具备遥控功能:通过遥控器控制机器人的动作,实现前进、后退等多个指令。
2.2 结构及设计
3. 动力控制程序
#include <Servo.h> #include <IRremote.h>
int RECV_PIN = 13;
IRrecv irrecv(RECV_PIN);
decode_results results;
Servo gj14; Servo gj23; Servo gj1; Servo gj2; Servo gj3; Servo gj4; int i,j,k; void setup() { gj14.attach(3); gj23.attach(4); gj1.attach(7); gj2.attach(8); gj3.attach(11); gj4.attach(12);// put your setup code here, to run once: Serial.begin(9600); irrecv.enableIRIn(); }
void loop() { if (irrecv.decode(&results)) { Serial.println(results.value, HEX); irrecv.resume();} gj14.write(90); gj23.write(30); gj1.write(30); gj2.write(63); gj3.write(33); gj4.write(105); delay(500); switch(results.value) { case 0xFF18E7 :{qian();}break;//2 case 0xFF10EF :{zuidi();}break;//4 case 0xFF5AA5 :{zuigao();}break;//6 case 0xFF4AB5 :{hou();}break;//8 case 0xFF38C7 :{fuwei();}break;//5 } }
void qian() { for(i=63,j=33;i<=90&&j>=6;i++,j--) { gj2.write(i); gj3.write(j); delay(10); } for(i=90;i<=120;i++) { gj14.write(i); delay(10); } for(i=90,j=6;i>=36&&j<=60;i--,j++) { gj2.write(i); gj3.write(j); delay(10); } for(i=120,j=30,k=90;i>=90&&j>=0&&k<=120;i--,j--,k++) { gj14.write(i); gj1.write(j); gj4.write(k); delay(10); } for(i=36,j=60;i<=63&&j>=33;i++,j--) { gj2.write(i); gj3.write(j); delay(10); } for(i=0,j=120;i<=30&&j>=90;i++,j--) { gj1.write(i); gj4.write(j); delay(10); } }
void hou() { for(i=63,j=33;i<=90&&j>=6;i++,j--) { gj2.write(i); gj3.write(j); delay(10); } for(i=90;i>=60;i--) { gj14.write(i); delay(10); } for(i=90,j=6;i>=36&&j<=60;i--,j++) { gj2.write(i); gj3.write(j); delay(10); } for(i=60,j=30,k=90;i<=90&&j>=0&&k<=120;i++,j--,k++) { gj14.write(i); gj1.write(j); gj4.write(k); delay(10); } for(i=36,j=60;i<=63&&j>=33;i++,j--) { gj2.write(i); gj3.write(j); delay(10); } for(i=0,j=120;i<=30&&j>=90;i++,j--) { gj1.write(i); gj4.write(j); delay(10); } }
void zuidi() { for(i=63,j=33;i>=36&&j<=60;i--,j++) { gj2.write(i); gj3.write(j); delay(10); } for(i=30,j=105;i<=60&&j>=60;i++,j--) { gj1.write(i); gj4.write(j); delay(10); } for(i=75;i>=60;i--) { gj4.write(i); delay(10); } } void zuigao() { for(i=63,j=33;i<=90&&j>=6;i++,j--) { gj2.write(i); gj3.write(j); delay(10); } for(i=30,j=105;i>=0&&j<=120;i--,j++) { gj1.write(i); gj4.write(j); delay(10); } for(i=15;i<=30;i++) { gj1.write(i); delay(10); } } void fuwei() { gj14.write(90); gj23.write(30); gj1.write(30); gj2.write(63); gj3.write(33); gj4.write(105); delay(500); } |
4. 作品图片
四足机器人俯视图
四足机器人侧视图
四足机器人腿部结构实物图
四足机器人底部结构实物图
5. 基于手柄控制的二驱智能小车
5.1 作品图片
遥控小车实物图
遥控小车俯视图
5.2 动力程序控制
void setup() { pinMode(10,OUTPUT); pinMode(9,OUTPUT); pinMode(5,OUTPUT); pinMode(6,OUTPUT); Serial.begin(9600); } void loop() { Serial.print(analogRead(14)); Serial.println(); Serial.print(analogRead(17)); Serial.println(); if(analogRead(14)<=521&&analogRead(14)>=506&&analogRead(17)<=521&&analogRead(17)>=506) { digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(5,LOW); digitalWrite(6,LOW); } if(analogRead(14)<521&&analogRead(14)>=0) { analogWrite(9,map(analogRead(14),521,0,0,255)); digitalWrite(10,LOW);
analogWrite(5,map(analogRead(14),521,0,0,255)); digitalWrite(6,LOW); } if( analogRead(14)<=1023&&analogRead(14)>521) { analogWrite(10,map(analogRead(14),521,1023,0,255)); digitalWrite(9,LOW); analogWrite(6,map(analogRead(14),521,1023,0,255)); digitalWrite(5,LOW); } if(analogRead(14)<506&&analogRead(14)>=0&&analogRead(17)<506&&analogRead(17)>=0)//左后 { analogWrite(9,map(analogRead(17),506,0,0,255)); digitalWrite(10,LOW); analogWrite(6,map(analogRead(14),506,0,0,255)); digitalWrite(5,LOW); } if(analogRead(14)<506&&analogRead(14)>=0&&analogRead(17)<=1023&&analogRead(17)>521)//右后 { analogWrite(10,map(analogRead(17),506,0,0,255)); digitalWrite(9,LOW); analogWrite(5,map(analogRead(14),521,0,0,255)); digitalWrite(6,LOW); } if(analogRead(14)<=1023&&analogRead(14)>521&&analogRead(17)<506&&analogRead(17)>=0)//左前 { analogWrite(10,map(analogRead(17),521,1023,0,255)); digitalWrite(9,LOW); analogWrite(5,map(analogRead(14),521,1023,0,255)); digitalWrite(6,LOW); } if( analogRead(14)<=1023&&analogRead(14)>521&&analogRead(17)<=1023&&analogRead(17)>521)//右前 { analogWrite(9,map(analogRead(14),521,1023,0,255)); digitalWrite(10,LOW); analogWrite(6,map(analogRead(17),521,1023,0,255)); digitalWrite(5,LOW); } } |
* 本项目未获得作者开源授权,无法提供资料下载。
|