91.548 Robots
Assignment Paper

Course: 91.548 Robots 2003 Spring

Student: Jianping Zhou

Instructor: Prof. Fred Martin

Botfes Project

Mr. Worm Jackson

 

Introduction

Mr. Worm Jackson Worm is a devastating pop fan. His body is a four-consecutive segments. The two middle segments contain a passive gear, Lego motor and driving gear set separately, the base segment is mount on a chassis, which has a Lego motor and driving gear set, and the head segment contains only a single passive gear. For every moving segment, there are two position switches for limiting leftmost and rightmost swing positions. Since every moving segments swings individually, the combination of segment positions forms a diversifying gesture of Mr. Worm ‘s body. Mr. Worm is able to collect the sound level around through his microphone sensor. Different sound levels decide the combination of moving segment’s positions. So when audio signal comes in, Mr. Jackson Worm waves his body following the signal.(see picture)

(picture set)

Mr. Worm Jackson

For the current version project, the frame of Mr. Worm is made of Lego bricks; hardware is handy cricket and compatible position switch. Total four crickets are used, one as master, three as slaves. The master is in charge of sampling sound signal in an interval of 0.5 second for standby state, 2 seconds for active state, and selecting the combination of segment controls according to the sampled sound level from a predefined pattern dataset, finally sending control signals to all slaves through its IR channel. The three slave crickets individually monitor their left and right end position switches,as well as control the rotations of their lego motor in response to control signals sent from master and local end position switch signals

Development Process

In the earliest sketch (see drawing) for this project, I intended to implement the modularized segment concept, which means every segment has the same mechanical and hardware structure, such that we can easily extend or cut Mr. Worm body length during the buildup in order to show more diversity.

original sketch


Original sketch for the project


But when I built up several segments using Lego brick, gear and motor to test, I realized the Lego motor doesn’t have enough power capacity to drive up to two segments. Then for eagerly seeing the prototype I gave up the attempt without trying using lighter material to build up the frame. Instead of this, I used different gear transmission set at acceptable simplicity and power capacity for current version.

Even though I gave up the modularity implementation, I still used the segment built for above purpose as the base segment of current version. Constructing the segment took me several hours to work out in the condition of limited available Lego parts. It has a sturdy and well balanced kinetic gear transmission structure with a ratio 1: 7.3

(picture 2)

Base segment gear transmission set picture

Since the Lego are not intended for position control, its time control cannot guarantee it rotate at fixed angle for same time elapse. At the beginning when I considered this problem, I tried to use one position switch to make segment hold in the center position when the motor power is removed (see illustration).

one switch

One position switch approach

Since the toy doesn’t care whether the left swing and right swing are precisely equal, but it does need at least one poison to be controlled, e.g. the switch position, for preventing from the accumulated rotation error, therefore this approach will not make the toy wild. Unfortunately the Lego motor doesn’t have constant brake, so this approach only works in the condition that the friction of gear transmission set is big enough to prevent the segments rotate due to gravity of any parts above it when the motor doesn’t have power. Through experiment, I felt very difficult to reach this point since the lab conditions. Finally I used two position switches for leftmost and rightmost end positions separately. In this approach, the time control is still used for swing segment, even the holding of segment, which is a tiny swing cycle instead of removal of motor power. When the accumulation error makes the segment reach the end switch, the system control makes a correction, which forces the swing center to the segment position center. For a reward of this approach due to time control, we get an extra amusing factor, named swing strength or amplitude. It can also correspond to certain sound level. This approach indeed increase the fun of Mr. Worm although the control procedures become more complicated, which costs using up to 5 state variables.

Followings are Mr. Worm Jackson’s anatomy diagram, separate slave code, and master code for the latest version.


Mr. Worm

Structure diagram of Mr. Worm Jakson

Two comments are mentioned for the code development. All are for the sake of efficiency

1. using a single byte to encode slave id, expected hold position, and swing strength, the format is

ir: - - -- -- - -

idpositionstrength

position -- expected hold position; 0 - center, 1 - leftother - right

strength -- swing amplitude

2. using ifelse instead of if although the codes are less readable.

;;;; slave 1

glabal[data strength count first right position]

;;;ir: - - -- -- - -

;;;idpositionstrength

;;; position -- expected hold position 0 - center, 1 - leftother - right

;;; strength -- swing am

to go

setstrength 0 

setposition 0

setfirst 1 

setright 1

when [newir?] 

[setdata ir

if (leftshift data -5) = 1

[setstrength (leftshift (leftshift data 13) -13) 

setposition (leftshift (leftshift data 11) -14)

setfirst 1 

setright 1]]

loop 

[ifelse strength=0 

[ifelse switcha 

[ifelse position = 0

[goright 5]

[ifelse position = 1

[goright 2]

[goright 7]]]

[ifelse switchb 

[ifelse position = 0

[goleft 5]

[ifelse position = 1

[goleft 2]

[goleft 7]]]

[ifelse right = 1

[goright 1 setright 0]

[goleft 1 setright 1]]]]

[ifelse switcha 

[goright 2*strength+2 setfirst 0 setright 0]

[ifelse switchb 

[goleft 2*strength+2 setfirst 0 setright 1]

[ifelse right = 1

[ifelse first =1 

[goright strength setfirst 0 setright 0]

[goright 2*strength setright 0]]

[ifelse first =1 

[goleft strength setfirst 0 setright 1]

[goleft 2*strength setright 1]]]]]

end

to goright :distance

setcount 0

a, setpower 8 thisway on

loop [ifelse switcha or (count > :distance) [brake stop] [wait 1 setcount 1+count]]

end

to goleft :distance

setcount 0

a, setpower 8 thatway on

loop [ifelse switchb or (count > :distance) [brake stop] [wait 1 setcount 1+count]]

end

;;;;master—detector and commander

global [sample] 

to go

loop

[setsample sensora

ifelse sample < 5 [send $20 beep wait 2

send $40 beep wait 2

send $60 beep wait 2]

[ifelse sample < 5 [send $20 beep wait 2

send $40 beep wait 2

send $60 beep wait 2]

[[send $27 beep wait 2

send $47 beep wait 2

send $67 beep wait 2]]]]

ifelse sample < 5 [wait 5][wait 30]

]

end

Milestone

2/22/03Constructed and experimented the modularized segment protocol. Failed

2/28/03Constructed and experimented the one position switch approach. Failed

2/4/03Reached the current version structure

2/11/03Developed the code

Future work

For potential future development of this toy, I may use a single logochip to replace the four crickets. A single logochip has enough bit ports to control 4 motor’ rotations and collect 6 position switch’s inputs. Or if possible, I may use step motors or servo motors to control every segment without using position switch, even extra gear set. These improvements will dramatically reduce the complexity of hardware and mechanical structures. However they will lose the transparency of educational purpose for cricket communication and gear set movement.