MR. ROIZO PROGRESS REPORT

22
MR. ROIZO PROGRESS REPORT COMPUTER CONTROLLED DANCING ROBOT TEAM 4 PROGRESS REPORT FOR ECSE-4962 CONTROL SYSTEMS DESIGN CHRIS TWAROG JAMES GODLEWSKI KEVIN HORBATT PAUL BASANTES MARCH 24 TH , 2004 RENSSELAER POLYTECHNIC INSTITUE ECSE 4962 – CONTROL SYSTEMS DESIGN

Transcript of MR. ROIZO PROGRESS REPORT

MR. ROIZO PROGRESS REPORT

COMPUTER CONTROLLED DANCING ROBOT

TEAM 4 PROGRESS REPORT FOR ECSE-4962

CONTROL SYSTEMS DESIGN CHRIS TWAROG

JAMES GODLEWSKI KEVIN HORBATT PAUL BASANTES

MARCH 24TH, 2004

R E N S S E L A E R P O L Y T E C H N I C I N S T I T U E E C S E 4 9 6 2 – C O N T R O L S Y S T E M S D E S I G N

2

EXECUTIVE SUMMARY

From movies to music to musicals and dance ensembles, entertainment has many forms.

Entertainment attracts attention, generates interest, and lessens boredom, and for these

reasons entertainment was the driving force behind the development of this project. In our

group’s opinion, designing an entertaining controlled pan/tilt system is far more motivating and

rewarding than opting for a traditional “tracking” or “disturbance rejection” system. The result

on our quest for an entertaining learning experience is small, comical sock-puppet inspired by a

music video and nicknamed Mr. Roizo(2), a puppet who was born to dance.

Mr. Roizo is a small sock-puppet that can dance to a songs rhythm with the help of motors

and motion controllers. The overall goal is a dancing puppet that will twist his body and bob his

head to the tempo of a song. In order to achieve this, the project is broken down into a two

path plan of action: the first path focuses on the music filter and the second path focuses the

controller. Each phase has multiple goals, for example developing a filtering scheme to isolate

the frequency content of the music and developing an algorithm to change music into motion

for phase one. Phase two goals include parameter identification, model development and

system verification. When completed, phase one will output a sine wave trajectory based off

the filtered song and phase two will track that trajectory keeping tracking error to a minimum.

Our team is making satisfactory progress and adhering to the original schedule. We have

identified the necessary parameters to develop equations of motion that govern our system and

have constructed a model with them. All experimental parameters where then verified and a

preliminary controller has been designed. The system model and the controller have been

combined into a working, accurate computer simulation and tweaking is currently underway.

Our team is within the original design schedule and we are confident that at the end of this

semester Mr. Roizo will truly be a dancing machine!

3

TABLE OF CONTENTS

Introduction ………………………………………………………………………………………… pg 4

Objectives ………………………………………………………………………………………… pg 5

Preliminary Results ……………………………………………………………………………… pg 6

Amplifier ………………………………………………………………………………………… pg 8

Coordinate System ……………………………………………………………………….. pg 9

Friction ……………………………………………………………………………………….. pg 10

Velocity ……………………………………………………………………………………….. pg 11

Controller ……………………………………………………………………………………….. pg 15

Summary of Progress …………………………………………………………………………….. pg 19

Cost and Schedule …………………………………………………………………………….. pg 20

Bibliography ..…………………………………………………………………………………….. pg 21

Statement of Contribution …………………………………………………………………… pg 22

4

INTRODUCTION

The overall goal of this project is to create a dancing puppet that will bob its head and twist

its body rhythmically to the music file input into its control system. In order to achieve this, one

must analyze the process to its simplest form of motion and develop goals to control and

generate that trajectory. When simplified, the head bobbing and body twisting follow

trajectories mocking a sine wave, which exposes our main goal; the puppet must be able to

track a sine wave with very little error.

Previous research reveals machines that dance to sound inputs have been around for years

and have existed in many forms, for example, the dancing coke can or dancing flower. These

machines also create the illusion of dancing by tracking the sound wave programmed into it.

Our project will mimic this behavior, except the motions will not be pre-determined so it can

dance to any song with a bass beat. Mr. Roizo will dance in two degrees of freedom (due to

the limitations of a pan/tilt mechanism) by twisting his body and bobbing head.

Because this is essentially a signal tracking problem, there are many ties to real world

applications. This class has had many other groups tackle this type of problem (to varying

degrees of success), and there are myriads of other applications such as tracking satellites to

tracking people with spotlights or security cameras. Therefore, even though our controlled

pan/tilt system implementation is strictly for amusement, the underlying concepts are very

useful and can be applied to many other applications.

We followed the general design approach of identifying the problem, identifying parameters,

developing a model, verifying the model through simulations, and finally tweaking of the

simulation by testing with the physical model. According to the original time sheet, we are on

track and still plan on having a working model by the completion of the class.

Future development work entails fine tuning the simulation and controllers, mounting the

puppet decorations to the physical system, combining the filtering and controllers systems, and

then tweaking the final model.

5

OBJECTIVES

The overall objective is for the puppet to track in input sine wave that is synchronized with

the song. In order to function, this project requires an algorithm to convert music to a

trajectory and a controller than can accurately track a sound wave. The audio is passed

through two filters whose outputs are connected to the motion controllers (one for each axis).

One filter uses a high order low pass filter with a cutoff frequency of 100 Hz. This generates

the tilt (head bobbing) motion frequency between 8 and 14 rad/sec with a maximum angle of

±35° and must be tracked with less than 2% error. The other filter is a high order high pass

with a cutoff frequency of 2000 Hz and a threshold value on the magnitude. Any value over the

threshold triggers a pulse that jolts the pan (body twisting) axis one motion range cycle of ±80°

(with an overshoot of less than 10% to 15%).

The scope of our project can be broken into two major systems: audio processing and

controlling motion. These can be further broken down into smaller subsystems such as audio

filtering, input conditioning (to the controller), and body part positioning. Known and unknown

challenges will be associated with each system, and solving them will be critical to our robots

operation. To complete this project in one semester, accurate simulations must be preformed

in order to engineer the final model parameters.

. .

6

PRELIMINARY RESULTS

As discussed above, this project will be broken down into two separate parts, the audio

portion and the control portion. The two will only be combined at the end when each one is

functioning so they can both be tuned in conjunction with each other. To aide in the general

design approach that was followed (discussed in the introduction), MATLAB, Simulink and Solid

Works were used for parameter generation, parameter calculation, and model simulation and

verification. A summary of the progress so far, broken down by subsystem, follows below.

Preliminary Results: Audio Filter

The purpose of the section of the project is to process the audio and condition it for the

controller input. This is done with a low pass filter to isolate the frequency spectrum, and the

Fourier transform of that signal is analyzed and transformed into the trajectories for the

controllers to follow.

The design specifications for the low pass filter are a cut off frequency of 100Hz with at

least 90dB suppression at 150Hz. This is necessary to isolate the bass peaks in the signal so

the frequency of occurrence can be found and then passed to the controller. These

specifications were met and exceeded as shown by the following Magnitude Response shown

below.

7

The LPF is a 20th order Infinite Impulse Response (IIR) designed using the Butterworth

method. To verify proper operation, both the filtered and unfiltered signals were plotted

together in the frequency domain. Shown below is the frequency spectrum with filtered and

unfiltered signals which clearly demonstrated the low pass filter functioning properly. We were

unable to zoom in on this graph, so the filtered signal exists in the far left region of the graph

and is most noticeable by 0 kHz.

After the signal is filtered, signal content versus time can be analyzed. Distinct peaks are

present, and by measuring the time delay between them a frequency is determined. Then, the

frequency of the sine wave input to the tilt controller is changed to this calculated value, and

the head will bob in a rhythmically synchronized manner. Normally, frequencies between 7.5

rad/sec and 13.5 rad/sec will move the head in a manner close enough to be considered

synchronized by human senses. We feel that the low pass filter design is 90% complete, which

is on schedule.

8

Preliminary Results: Conformation of Amplifier

Modeling a control system involves the identification of several physical parameters in order

to develop an accurate system model. Once the system model has proven to be accurate and

robust, a control system can be designed around the performance criteria. We were given that

the amplifier datasheet (A1), and told that the nominal current constant is .1 Amperes/Volt and

out input voltage range is [-10 10] volts. Our first check is to check this constant knowing the

nominal motor parameter as given in its datasheet (A2). By unplugging the belt, we increased

the voltage applied to the motor and recorded the value that it broke the motor friction Bmc =

2.5E-03 N-m. Using the equation listed below, we can relate the input voltage to the torque on

the motor shaft.

0236.4*/1.* −= EVAυτ (1)

*where Kt = 4.36E-02 N-m/A

Our technique for determining this value was to set the amplifier voltage input in increments

of .005 and then jerk the motor by hand in the same direction of the applied torque. When the

motor would barely remain turning we knew our applied torque was roughly equal to the

frictional torque. Shown below is a simplified system Simulink diagram.

By evaluating equation 1 at .460 we found the torque applied to be .002 N-m. This is 80%

the nominal of the motor torque value supplied by the motor datasheet. This is acceptable,

because we are just making sure our values are not orders of magnitude off.

In addition we could test other parameters of the motor ie: torque constant by attaching a

known mass to fishing wire and attach it the motor driveshaft and adjust the torque accordingly

to suspend the mass in air. This experiment along with others was deemed inappropriate after

review with Ben Potsaid.

9

Preliminary Results: Coordinate System Definition

Before gathering any parameters, a standard coordinate system had to be defined. Using

SOLIDWORKS to model our system, we developed the following model. Included is our

reference of our coordinate system which will be used throughout our development of our

system.

Clockwise = -

Counterclockwise = +

Looking from the top the same directions apply for the movement of the tilt axis.

10

Preliminary Results: Parameter Identification, Friction

Continuing our identification of the physical parameters of our system led us to first model

friction. In order to accurately achieve our friction values we wrote an intelligent MATLAB (m-

file) script (Frictionid.m – Appendix A3). The reason this script is intelligent is because it makes

time-based decisions. Although it is not required to analyze the friction to the extent we did,

we decide to maintain a high level of confidence in our plots.

First, our script executes in the range [-1.2 1.2] V for the step input magnitude to the

motor. This range is representative of currents ranging from [-.12 .12] A. Beyond these values

the motor reaches its maximum angular velocity for the system and thus produces a torque

equal to the resistance torque produced by friction. The script will jolt the system with a

magnitude of 2V for .2s in order to break the stiction and Stribeck friction. We then set our

desired input voltage by setting the tg.s8 signal. After a 1 second pause which allowed the

system to produce some motion the velocity of the system velocity is monitored. When it finds

two sample velocities equal to each other it would begin testing for steady state velocity. To

speed up sampling, it would make sure the current velocity was greater than zero before

entering a 6 second sampling period.

The 6-second sampling period was used to eliminate any quantization error when

calculating the velocity directly in a Simulink model. We considered the effect of timing delays

due to a non-real time pause, but decided that the delay was negligible over the 6 second

period. The velocity was calculated simply by:

sec6/radtotalss θυ = (2)

The following plots show the velocity of the system vs. input voltage for both the pan and

the tilt axis. Unexpectedly we found some non-linearity.

11

Tilt Pan

Preliminary Results: Parameter Identification, Velocity Plots

Sampling velocity may not be as simple as one may think. When introducing a unit delay

high frequency quantization error becomes apparent. Shown below are the time domain and

frequency components of a simple velocity estimation using one unit delay. It is quite clear the

noise caused when sampling. On the right you will notice a large spike at 0 Hz, the DC gain

and the additional noise injected on the signal.

12

In order to eliminate this high frequency noise, we decided to use a 1st order washout filter

with cutoff frequency of 20.5 Hz. Shown below are the velocities after filtering and averaging

of three samples in the positive tilt direction.

Preliminary Results: Parameter Verification, Velocity

The velocity simulation is designed simultaneously with the cad model of our system being

developed. By adjusting the inertia value in our system, to match the rise-time characteristics

of our velocity plots, we are able to establish an approximation of our inertia. To conform our

approximation we will determine the inertia properties of our system through the use of

Solidworks. Below is our our tilt axis simulator.

Starting at the far most left end we insert a step function of magnitude equivalent to

[.86 .88 .90 .92 .94]. The signal then traverses through the amplifier constant and the torque

constant of the motor. The model then makes a decision based on the current angular velocity

of the motor. In the motor datasheet Appendix A2 we are particularly interested in recreating

13

the effects of the Speed vs. Torque saturation line. The Max_Tok_Script is an S-system that

will pass the least of the two inputs thus regulating the torque as a function of speed. The

saturation line is based on the speed intercept of 4*20rad/sec which is the external gear ratio

multiplied by the maximum observed velocity, which happens to be greater that supplied by the

datasheet. The zero-speed torque peak remains at .3 N-m. After the torque applied to the

rotor of the motor is calculated, it is multiplied by N the total gear reduction ration throughout

the system (6.3*4 = 25.2). Once the torque applied to the tilt axis is determined divide it by

the total rotational inertia to obtain angular acceleration

ατ Ι= (3)

Where I is comprised of:

)( 2mL JNJI += (4)

By approximating I graphically through the step response of the motor, we obtained a value

of .0023 kg-m2. Shown below is our 7.5 second simulation compared the 15 second physical

tests when using this value for inertia.

14

Using Solidworks we obtained an Inertia Jl = .0000477 kg*m2 and N2Jm = 1.6E-

6*25.22=.001016 kg*m2. We checked this value by using the following equation:

⎟⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜⎜

−−=

ss

ssv

t

t

IB

θ

θ

θ

θ

ττ )(1

)(1

ln)(

1/2

1

21

(5)

233

*00153.)*2

5.16.1

0163.1

04.1464.121

04.144.11

ln)185.35.2(

1/

mkgII

eeB

IB

v

v

==+

=

=⎟⎟⎟⎟

⎜⎜⎜⎜

−−=

−−

In both cases I does not match the I requirement in the velocity simulation. Needless to

say some additional review of the controller is necessary to reduce this discrepancy of I.

15

Preliminary Results: Controller

The purpose of this section of the project is to control the motion of each axis with two

controllers. Before any controller design was started, a model was generated and verified, and

then controllers were created using good design practices rather than trial and error. The

following process was followed to aid the design:

- Create a linear model based on a specified linearization point

- Design a controller to met specifications

- Implement controller into non-linear simulation

- Tweak controller parameters for desired response.

The controller for the pan axis has a primary purpose of minimizing error when tracking its

input, a sine wave. The sine wave frequency is varied by the audio filter, and the controller

must respond to these changes in a smooth, orderly manner. Interruptions in trajectory will

appear out of sync with the music.

The controller for the tilt axis has a primary purpose of responding to a high amplitude,

short duration pulse triggered by the audio filter, and rotating the pan body one motion cycle

(±80°). Signal tracking is not required, but a very fast rise time is so an overshoot of 10 to 15

percent is acceptable.

Because of its complexity, the tilt controller was designed first. This controller must be very

accurate in order to keep the tracking error to less than two percent. First, the tilt model is

linearized about the points 0,0 (0 radians for both axes) and a open loop transfer function is

generated. Based on this transfer function, a compensator can be developed and a feedback

loop is added as shown below.

From the linearized model a simple PID controller was built. However, it was unsuccessful

in tracking signals with frequencies over 10 rad/sec. Other controllers were researched and a

phase compensator controller was built. This controlled behaved nicely with an input frequency

of 13.5 rad/sec and met the requirements of rise time and settling time. The design of this

filter was aided by MATLABs rltool, and allowed zeros to be placed in the s-place to cancel out

+ -

Controller

C(s)

Plant

G(s) Input Output

16

the systems poles. New poles were added at about s = -14 to ensure the compensator could

accurately track frequencies up to that value. Also, phase lag was minimized because of its

negative effects on a systems tracking ability. Then, the gains were adjusted to ensure a crisp

rise time and settling time. For the tilt motor, the transfer function below was developed and

shown with a gain K = 0.022.

:= ( )C s 634.9K + s2 0.9841s

Adding this compensator to the closed loop transfer function produces a frequency response

and root locus diagram as shown below. From the step response, it can be seen that our

overshoot is less than 5% which is within original design specifications. The settling time is

slightly longer than originally desired, however the system worked reasonably well in a test run.

Frequency Response of Tilt Controller

17

Root Locus of Tilt Controller

The pan and tilt controllers placed into the “Controller” block in the overall pan/tilt simulation,

shown below. The “Trajectory Generation” block will pass the outputs from the filters to the

controller’s inputs, and the position error is quantized and then passed into the controller

inputs. The model dynamics block contains the simulation model in the previous section,

Velocity Simulation. The block diagrams of the controller and the overall simulation are shown

below.

18

19

SUMMARY OF PROGRESS

Up to this point, our group is pleased with the progress being made. We are adhering to

the original schedule shown below and have completed all the goals up through today.

Week Assignments Goal

2/15 Formal project proposal Finalize design, develop specifications, identify parameters

2/22 Develop filtering and control algorithms

2/29 Working simulation. Start construction

3/7

3/14 Working alpha version. Friction parameters identified

3/24 Mid – Cycle Review Audio filter 90% complete. Controller 50% complete.

3/28 Working beta version. Improvements in performance.

4/4 Fine tuning and optimization of filter and controller

4/11 Project Demonstration Final working version of project. Last second tweaks

4/18 Final Presentation Final flawless version of project

4/25 Final Report Due

In the future weeks, we will have new challenges to overcome in order to complete our

ultimate goal. However, unseen problems have arisen in every major part of out project in the

past. For our filter, processing delays were the biggest unanticipated event, and these will be

overcome by preprocessing. This delay is not acceptable in our final model because it results in

significant phase shift that is noticeable by your ears and eyes when the movement is not in

sync with the audio.

Parameter identification and verification gave our group the most trouble, mostly because it

was also a learning experience with MATLAB as well as trying to complete a task. Executing

real time code and S-Functions (C-code) frequently gave errors (sometimes because of bugs in

the code). Network delays also hindered our results sometimes, as commands would take ~3

seconds to execute. Hopefully as we become better acquainted with MATLAB, these delays will

be lessened.

Our future agenda includes building the pan audio filter, which is basically based off the tilt

filter so that task is trivial. The pan axis simulation will also be built, but as above, the task is

20

trivial. The two major hurdles to overcome are conditioning the audio input to a format

acceptable by the controller, and designing the pan controller to respond quickly to a short

pulse. However, based on our previous experience, our group is confident we can figure out

any programs, anticipated or unanticipated.

Our group is also on track with the projected cost schedule. A breakdown of materials not

supplied to our group is listed below. Since this is a relatively low-cost project, it should be of

no surprise that the budget was not over run.

Fur $7.95 per Yard http://shop.store.yahoo.com/phoenixtextiles/w-352.html

Styrofoam Ball 3” diameter for head $5.25

http://www.barnardltd.com/ Batting $7.99

http://www.craft-n-fabric.com/ Needles and Thread ~ $5.00

http://www.craft-n-fabric.com/ Plastic Wrap to protect equipment $1.99

Price Chopper Labor: $20/hr/pp x 12 hrs/week/pp x 15 weeks x 4 people = $14,400

In conclusion, our group is confident we have the necessary working and validated

components for the tilt axis, and can quickly apply these techniques to the pan axis. This

progress meets the 50% controller design goal listed in our schedule, and we are happy with

our progress so far.

21

BIBLOGRAPHY

(1) Wen, John T. , http://www.cat.rpi.edu/~wen/ECSE4962S03/

(2) Mr. Ozio, “Flat Beat” MTV Productions.

(3) http://www.monachos.gr/eng/resources/thermo/density.htm

22

STATEMENT OF CONTRIBUTION

Group Member Contributions Signature

Kevin Horbatt Velocity Simulation, Parameter Measurement

Paul Basantes Presentation, Summary and Conclusion

James Godlewski Abstract, Audio Filter

Chris Twarog Editor, Intro, Controller