表情机器人 android,表情机器人示例作品

参加过表情机器人培训讲座的同学们可能就对这个机器人有印象,这是表情机器人培训团队的澳大利亚籍讲师制作的。

1)设计图如下:

152743rjzwmm7xmqopjwmo.jpg 

1351648253_e0ca8a89.jpg

2)结构完成后的样品

140004u6zsr8tyop821i83.jpg

140142aatfinrl0r3aiy6a.jpg

140145z5okk5p6slckze40.jpg

140148rfqvfqqg72qjqzif.jpg

140151khwsqsqqhkvn0qks.jpg

140154k63ssoc50s36dm86.jpg

1351648657_4ac0e68e.jpg

3.)完成外表修饰

当这个机器人加上各种面具的时候,就显得更加生动。

140925dowy4kx8z5ii4554.jpg

1351648685_f5d3b999.jpg

作品视频:

开源程序(使用软件arduino1.0.1):

#include

// define global variables

byte transitionsteps=20;                                                             // controls the speed of face transformation: more steps = slower transition

byte emotion=0;

Servo servo[12];                                                                     // define servos as an array for easy control

int uSmin=600;                                                                       // minimum servo position in uS - adjust this value to suit your brand of servo.

int uSmax=2400;                                                                      // maximum servo position in uS - adjust this value to suit your brand of servo.

int servoposition[]={1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500};   // this array stores the current position of each servo in uS (typically 1000 - 2000 uS)

int servotransition[12];                                                             // this array stores the speed and direction for each servo as it moves

int servopin[]={17,6,15,11,3,2,4,5,13,12,14,16};                                     // digital pins used for servos

// servo  0 = D17  neck                       17

// servo  1 =  D6  mouth    right             06

// servo  2 = D15  teeth / tongue             15

// servo  3 = D11  mouth    left              11

// servo  4 =  D3  eyebrow  left  inside      03

// servo  5 =  D2  eyebrow  right inside      02

// servo  6 =  D4  eyebrow  left  outside     04

// servo  7 =  D5  eyebrow  right outside     05

// servo  8 = D13  eye      right tilt        13

// servo  9 = D12  eye      blink             12

// servo 10 = D14  eye      right pan         14

// servo 11 = D16  eye      left  pan         16

int expression[]={                                                                   // this array stores the servo positions for different facial expressions

// 0    1    2    3    4    5    6    7    8    9   10   11

1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,                         // 0 NEUTRAL

1500,1600,1500,1300, 600,2400, 800,2300,1200,2000,1500,1500,                         // 1 SAD

1500, 800,1500,2000,1500,1500,1500,1500,1600,1300,1500,1500,                         // 2 HAPPY

1500,1600,1500,1300,2200, 600,2400, 600,1500,1500,1500,1500,                         // 3 ANGRY

1500,1500,1500,1500,1100,1000,1900,1700,1500,1500,1500,1500,                         // 4 CURIOUS

1500,1600,1500,2000,1200,1800,1800,1200,1500,1500,1500,1500,                         // 5 SURPRISED

1500,1500,1500,2000,2000,1000,2000,1000,1500,1500, 800, 800,                         // 6 MISCHEVIOUS

1500, 750,1500,2000,1000,2000,1500,1500,1700,1300, 800,2200                          // 7 SILLY

};

void setup()

{

for (int i=0;i<12;i++)                                                             // loop to initialize servos and arrays

{

servo[i].attach(servopin[i],uSmin,uSmax);                                        // initialize servos starting at D53 and counting backward (limit travel between uSmin & uSmax)

servo[i].writeMicroseconds(expression[emotion*12+i]);                            // set servos to initial expression

delay(50);                                                                       // delay limits power surge by initializing the servos one at a time.

}

//delay(1000);

}

void loop()

{

//return;

for(emotion=0;emotion<8;emotion++)

{

Transition();

delay(2000);

}

}

//===================================================================================== face transforms from one expression to the next =============================

void Transition()

{

for(int i=0;i<12;i++)                                                              // scan through servo positions

{

servotransition[i]=(expression[emotion*12+i]-servoposition[i])/transitionsteps;  // calculate servo speed and direction required to transform expression

}

for(int j=0;j

{

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

{

servoposition[i]+=servotransition[i];                                          // adjust the servos position

servo[i].writeMicroseconds(servoposition[i]);                                  // update the servos position

}

delay(30);    // limits speed to suit servo electronics

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值