Sei sulla pagina 1di 33

THE 2014 HOEFER PRIZES

FOR EXCELLENCE IN UNDERGRADUATE WRITING

In Recognition of Writing Achievement in the


Undergraduate Field of Study

stanford university
May 22, 2014
If it Swims Like a Duck

Karan Handa, Bryan Lopez, John McMordie, & Marco


Solis

Mechanical Engineering 112


Mechanical Systems Design

Mark Cutkosky
Mechanical Engineering
Handa, Lopez, McMordie, Solis 1

Executive Summary:
Our objective was to design and build a battery-powered robotic duck, capable of paddling itself
half way across the length of a swimming pool at a reasonable duck-like speed between 30 and
50 cm/s. In addition to closely mimicking a realistic duck paddling motion, our robot was
expected to incorporate an additional bio-mimetic feature. Through several prototype iterations,
we arrived at a final design which used two separate four-bar linkages to paddle our polystyrene
duck feet. The left and right foot strokes were positioned out of phase to create an authentic,
alternating paddling motion. We used Matlab and SolidWorks to analyze our four bar linkages,
designing for high velocity and thrust during the power stroke, and low velocity and drag during
the return stroke. Our final bio-mimetic feature consisted of a tail connected to our linkages by a
thin cable thereby causing the tail to swing left and right as the rocker links swayed back and
forth.

The duck was driven by a Mabuchi RE-260RA-2295 DC motor operating with a 74:1 speed-
reducing gear ratio. On board were four AA 1.2V NiMH batteries, from which our robot drew
currents of up to 2.1 amps. Our final prototype succeeded at paddling across choppy pool
waters at a steady 26 cm/s, falling slightly short of our intended speed goal of 30cm/s.

A next stage design might consider a higher gear reduction; this would reduce paddling speed
and minimize splashing to give a more duck-like appearance. Alternatively, we could increase
the stroke length in order to obtain a greater change in momentum and paddle more swiftly
forward.

Autonomous Duck Robot Paddling in a Pool


Handa, Lopez, McMordie, Solis 2

Contents

Background:............................................................................................................................... 3
Design Description ..................................................................................................................... 4
Analysis ....................................................................................................................................11
Re-Design .................................................................................................................................20
Conclusion ................................................................................................................................22
Appendix A: Cad Drawings .......................................................................................................23
Appendix B: Drag Testing .........................................................................................................25
Appendix C: Images of Subsystems..........................................................................................26
Appendix D: MatLab Code ........................................................................................................27
Handa, Lopez, McMordie, Solis 3

Background:

We were tasked with creating an autonomous, battery-powered animatronic duck for a theme
park. From the theme parks point of view, our robot should have all the charm, but none of the
waste of a real duck. The duck needed to propel itself forward in a swimming pool lane using
realistic bio-mimetic motion while paddling at an appropriate speed. The most desired speed
range was between 30 cm/s and 50 cm/s, but speeds between 18 cm/s and 30 cm/s or 50 cm/s
and 65 cm/s were also acceptable. Along with the speed requirement, we also needed to
incorporate a secondary bio-mimetic motion of our choice.

The design team decided that our primary focus and attention would be placed on designing a
appropriate four-bar linkage system. This critical design component would need to trace out a
coupler curve that matched the paddling motion of an actual duck as closely as possible, and it
would need to ensure that our duck traveled at a sufficient speed. Our team chose a design
target of 40 cm/s, which is the middle of the desired speed range and would allow us to account
for any issues that impeded speed on the day of the presentation. An equally important deisgn
task was stability; the duck would need to travel as straight as possible in order to reach this
desired speed.

Once the team had a functional duck with realistic paddling motion and adequate speed, we
could then make finer adjustments as necessary and add a secondary bio-mimetic motion. Our
final goal was to model the chassis to resemble a duck for aesthetic purposes.
Handa, Lopez, McMordie, Solis 4

Design Description

The design consists of the following subsystems: two pontoons for floating, two four bar
linkages connected to a motor with batteries for our paddle drive mechanism, two duck feet, a
tail and a keel for directional stability (as shown in Figure 1.)

Motor and
Batteries Four Bar Linkage
Tail

Foot

Keel Pontoon

Figure 1. Duck Robot Floating on Water with Important Subsystems Highlighted

Linkage Design

In order to achieve a duck-like paddling motion we used two four-bar Hoekens linkages
operating out of phase by 180 degrees. The Hoekens linkage 1 is unique from other four-bar
linkages as it converts the rotational motion of the crank into a straight-line motion of the coupler
point at almost constant speed during the return stroke (see blue region of coupler curve in

1
http://en.wikipedia.org/wiki/Hoekens_linkage
Handa, Lopez, McMordie, Solis 5

Figure 2).The Hoekens linkage also provides higher speed during the power stroke (see red
region of coupler curve in Figure 2), mimicking a strong duck-like kick.

Ground Link
Crank Link

Rocker Link

Coupler Link

Coupler Curve

Figure 2. Hoekens Linkage with Coupler Curve traced by Foot midpoint

After experimenting with different linkage lengths to achieve an appropriate stroke length, we
arrived at our final linkage design above (see Appendix A for detailed CAD Drawings of linkages
with dimensions). These final linkages were constructed with laser-cut acrylic except for the
crank link which was thick (See Appendix C for view of acrylic cranks). Our crank was rigidly
attached to the transmission output by tightly fitting a D-shaped shaft into a D-shaped hole in
the crank (see Figure 3). This prevents the crank from slipping on the shaft. However, it puts the
acrylic crank link under a significant amount of stress. We chose a thicker crank linkage to help
distribute this stress over a wider area and reduce the likelihood of linkage failure.
Handa, Lopez, McMordie, Solis 6

Crank
Link

D-Shaft

Figure 3. D-Shaped Shaft Fit into Crank with D-Shaped Hole

Motor and Transmission

Our drive mechanism consists of a Mabuchi RE-260RA-2295 DC motor coupled with a speed
reducing gear ratio of 74:1 (See Figure 4). We powered the motor with four 1.2-Volt NiMH
rechargeable batteries. In initial testing, we experimented with lower gear ratios; however, at a
low gear ratio the motor torque required was very high. This was undesirable, as the batteries
could not supply both high current and 4.8V simultaneously. We found that slightly increasing
the gear ratio actually allowed the duck feet to paddle faster. At a higher gear ratio, the required
motor torque decreased. This meant that the current draw was less, and the batteries could
provide closer to a nominal 4.8 Volts. Increasing the gear ratio too much would begin to slow the
paddling motion until it was ineffective in the water. This 74:1 gear ratio provided a reasonable
paddling speed given our operating voltage. During our design of the linkages, it was imperative
that we test the paddle in water. After all, the water provides more than 800 times the drag
force of air ( air = 1.2kg/m3, water = 1,000kg/m3). This would cause significantly more load and
current draw from the batteries.

Figure 4. Mabuchi DC Motor with Internal Gear Box


Handa, Lopez, McMordie, Solis 7

Feet

Our duck feet were designed to be squares with an area of 9 in2 and were made out of thick
polystyrene. We created a one-way hinge mechanism to replicate the effect of a ducks ankle.
During the power stroke, a moment provided by the force of the water causes the foot to open
and become fully extended (See Figure 5a). The foot remains approximately perpendicular to
the waterline during the power stroke. On the return stroke, the force of the water causes the
foot to contract (see Figure 5b). In its contracted state, the effective area of the foot
perpendicular to the flow is reduced. In this way, the one-way hinge maximizes thrust on the
power stroke, and minimizes drag on the return stroke.

Figure 5 (a) Extended Foot Figure 5 (b) Contracted Foot

The rigid polystyrene foot (see Figure 6) allows us to get


the most thrust out of our foot and hinge mechanism.
Initially we tested with a flimsier material (cork board), but
determined that a stiffer foot would be a lot more
effective. And since hydrodynamic force is proportional to
surface area, we tested with larger and larger feet until
we obtained sufficient thrust.

Figure 6. Polystyrene Hinged Foot


Handa, Lopez, McMordie, Solis 8

Tail

In addition to our paddling motion, our duck has a tail that sways from side to side as the duck
swims forward. We accomplished this feature by connecting our tail using a pin joint to the base
of the chassis allowing it to rotate freely. We then connecting the tail to each four bar linkages
rocker crank with a thin cable, causing the tail to swing left and right as the rockers swayed back
and forth (See Appendix C for view of integrated tail mechanism). This effect is illustrated in
Figures 7 and 8 below. Since the rockers on opposite sides are offset, when one rocker is
positioned forward then one string is taut while the other is loose (see Figure 7) and the tail
moves to one side. When the rocker positions switch, the tail moves to the other side (See
Figure 8).

Figure 7. Side View of Tail Mechanism

Figure 8. Top View of Tail Mechanism

Stability

Motor and linkage selection was not the only important part of duck design. We needed to
come up with several design solutions to increase stability and guidance in water. Stability was
a key problem in our early prototypes. At one point, our duck capsized and paddled its way to
the bottom of Arrillaga pool! To address these concerns we designed pontoons and a keel for
our duck.
Handa, Lopez, McMordie, Solis 9

Pontoon Design

Our system has pontoons large floatation devices on both sides of our duck for added
stability against rolling (as seen in Figure 9). We made them out of pink foam since this is a
material that floats well and will not absorb water. However introducing the pontoons also
introduced a new source of drag. To reduce the effect of drag, we sanded down curved edges
to streamline our pontoons as much as possible (See Appendix C for view of shaved pontoons).
We also brought the pontoons in as close as possible to the duck body. The narrower the body,
the smaller the turning moment the duck would experience upon contact with an obstacle (i.e.
the pool noodle lanes). However, given the design layout we were limited to the width of our
ducks body as the feet would brush up against the pontoons if the pontoons were placed any
closer.

Figure 9. Top View Layout of Pontoon and all Subsystems


Handa, Lopez, McMordie, Solis 10

Keel Design

Finally, our duck has a rectangular keel, made of duron wood, with dimensions of of 3.25 x
10 inches. The keel is placed lengthwise along the hull of the duck (see Figure 10). It allows
drag forces to provide a moment to counteract the ducks tendency to turn, and keeps the duck
swimming along a straight line.

Figure 10. Duron Keel Contributes Stability to Duck Design


Handa, Lopez, McMordie, Solis 11

Analysis

A real duck provides its propulsive power by paddling its webbed feet through the water
and creating a thrust force that pushes it forward through the water. For the case of our
biomimetic duck, we do not have webbed feet available and we instead resorted to using our
polystyrene paddles to propel us through the water.

Figure 11: Power diagram which shows transfer of power from the batteries to the
paddling feet.

The above diagram (Figure 11) details the transfer of power from the batteries through
the motor, through the transmission, and through the linkages to the paddling feet. As our
primary goals were to both imitate a ducks paddling motion as closely as possible and to have
our duck swim at a reasonable speed, we placed heavy emphasis on the type of linkage system
that we used and the coupler curve that it traced. Using a Hoekens linkage, we obtained the
following coupler curve displayed in Figure 12.
Handa, Lopez, McMordie, Solis 12

Coupler
Coupler Curve
Curve forfor
ourHoekens
HoekensLinkage
Linkage

0.02

-0.02
Vertical Position

-0.04

-0.06

-0.08
water level
-0.1

-0.12

-0.05 0 0.05 0.1


Horizontal Position

Figure 12: Coupler curve for our Hoekens linkage. Red region represents power stroke
(higher velocities) and blue region represents return stroke (lower velocities).

The coupler curve not only gives us a paddling motion that closely mimics that of a duck,
but more importantly, it provides a motion that is much faster on the power stroke than on the
return stroke. This is exemplified both by the increased distance between neighboring points in
Figure 12 (the red region of curve) as well as the velocity data plotted in Figures 13 and 14 on
the next page. (Figure 13 represents one foot and Figure 13 represents the other foot paddling
180 degrees out of phase.) This graph demonstrates both the x and y components of the
velocity of our coupler point, which we take to be at the center of our paddling foot (Note: these
velocities are relative to the duck and not a ground reference frame.) One can see that the x-
component of coupler velocity reaches a peak of about 1.46 m/s during the power stroke, while
going only about 0.37 m/s on the return stroke.
Handa, Lopez, McMordie, Solis 13

Vx and Vy of Coupler Point, Foot 1 Vx and Vy of Coupler Point, Foot 2 (180 deg out of phase
0.5 0.5

0 0
Velocity [m/s]

Velocity [m/s]
-0.5 -0.5

-1 -1

Vxc Vxc
Vyc Vyc
-1.5 -1.5
0 50 100 150 200 250 300 350 0 50 100 150 200 250 300 350
Degrees Degrees
Figure 13: X-velocity and Y-velocity of Figure 14: x-velocity and y-velocity of
coupler point, Foot 1. coupler point, Foot 2 (180 degrees out of
phase with Foot 1).

This difference in speeds on the return and power stroke are crucial for our design as it
means that our duck will create much more forward thrust than backward thrust, ensuring that it
is moving forward as fast as possible. This is especially true because we know that the force
produced by the paddles is proportional to the velocity squared. With this information, we are
now prepared to ask ourselves how much force and power our paddles are producing and thus
how much torque will be required from the motor/transmission stage.

To perform this analysis, we made the following assumptions:

1) Our hinged foot is going through the water on the power stroke with an effective area
of 1 in x 3 in.

2) This effective area remains constant throughout the power stroke.

3) Each point on our paddle is thereby moving at the same speed.

4) Simplifying assumption that the paddle is moving along a perpendicular direction in


the water.

5) The angular velocity of the crank is constant.

6) We will be using a thrust coefficient, C t , of 2.5 for our calculations.


Handa, Lopez, McMordie, Solis 14

To calculate the thrust produced by our paddles we make use of the equation for the
thrust force of a rotating paddle in water 2:

1
() = (2 )2
2
where C t is the thrust coefficient, is the density of the water (1000 kg/m3), 2 is the radius of
gyration, is the instantaneous angular velocity about coupler points center of rotation, and S
is the area of our paddle in the water.

Making use of assumptions (2), (3), (4) we can simplify this equation to give:

1
= 2
2
where V is the velocity of our coupler point with respect to a ground frame of reference. With
this equation, we were then able to calculate the thrust produced by each foot individually
(Figures 15 and 16) as well as the total thrust produced by both feet paddling through the water
at the same, 180 degrees out of phase with each other (Figure 17).

Thrust Produced
Thrust DuringCurve
Along Coupler Cycle Thrust
ThrustProduced During
Along Coupler Cycle
Curve
3.5 3.5

3 3

2.5 2.5
Force [N]
Force [N]

2 2

1.5 1.5

1 1

0.5 0.5

0 0
0 50 100 150 200 250 300 350 0 50 100 150 200 250 300 350
Degrees Degrees
Figure 5: Thrust
Figureproduced by Foot
15: Thrust 1
Produced by Foot 1. Figure 16: Thrust Produced Foot 2.

2
Johansson, L.C., & Norberg, R.A. (2003). Delta-wing function of webbed feet gives hydrodynamic lift for
swimming propulsion in birds. Nature, 424(6944), 6568.
Handa, Lopez, McMordie, Solis 15

Total Thrust Produced by Both Feet


4.5

3.5

Force[N]
2.5

1.5

0.5

0
0 50 100 150 200 250 300 350
Degrees

Figure 17: Combined Thrust Produced by Both Feet.

Examining both Figures 15 and 16, we notice that each of our paddles produce peak
thrusts of approximately 3.5 N. When comparing these plots against the velocity plots (Figures
13 and 14), we also see that the moments of peak velocity and thrust all match up, again
verifying that our coupler point moves faster, our paddles will produce more thrust. Since this
occurs doing our power stroke, we thereby verify that our duck will be producing forward
momentum.

Knowing the force produced by our two paddles working together, we can calculate the
power produced by multiplying the thrust produced with the velocity of the coupler point relative
to the lab reference frame. In a given operation cycle, we are primarily concerned with the point
where the most power is being produced. From Figure 17, the peak thrust produced by both feet
combined is about 4.41 N and occurs at a peak velocity of 1.46 m/s. Assuming that the forward
velocity of the duck is 0.26 m/s, we calculate maximum power produced as:


, = , (, ) = (4.41 ) 1.46 0.26 = 5.56

At this point, we refer back to the power diagram in Figure 11 and see that we require our motor
to output more than 5.56 W in order to account for power losses in the transmission and
linkages. Based our ducks performance as well as voltage and current testing, we can verify
this calculation by characterizing our motor.
Handa, Lopez, McMordie, Solis 16

Motor Characterization

Our Tamiya Gearbox used a Mabuchi RE-260RA-2295 DC motor. The datasheet provided the
motors internal resistance, R, as well as its motor constant, k. Using the motor equations:

= 0 (1)

= (2)

Per the motors datasheet, at a nominal voltage of V = 3V the stall current, i s , is 2.7A. Using this
information, we can calculate an internal resistance for our motor using equation (1) knowing
that at stall, = 0:


0 = 0 = = 1.1

Next, we can use the no-load specifications of the motor to calculate what our motor constant is
by again using equation (1), given that at no-load the current, i nl , is 0.15 A and the no-load
speed, nl, is 9400 rpm:


= 0 = = 2.9 103 /

With these values now known, we can characterize our motor for our ducks specifications
(Figure 18).
Handa, Lopez, McMordie, Solis 17

Tamiya Gear Box at 4.63V


12
Efficiency*10
Efficiency, Torque Load, Power Out Torque Load (mNm)
10 Power Out(W)

8
Animatronic Duck

Operating Point
6

0
0 5000 10000 15000
angular speed (rpm)
Figure 18: Motor Characterization Plot Detailing Efficiency, Torque Load, and Power
Output as a Function of Angular Speed.

We characterized our motor at 4.63 volts to account for loses due to the resistance of
the each battery, R batt , which was measured at 0.020 . When testing our duck in the small pool
of water, we measured a current of 2.1 Amp using the ammeter in a power supply. Therefore,
although our nominal voltage was 4.8V, the actual voltage across our motor comes out to be:

= = 4.8 4 0.020 2.1 = 4.63

With our voltage and current known, and our motor fully characterized, we can now
define our operating point (which is specified above in Figure 18) by using the motor equations
above, and defining output power and efficiency as so:


, = = =

Handa, Lopez, McMordie, Solis 18

V motor (V) i motor (A) T l (mNm) (rad/s) (rpm) P out (W) P in (W) Efficiency
4.63 2.1 5.7 801 7646 4.53 9.73 46.6%
Table 1: All of the information regarding our motors
operating point and power output.

Looking at our results in Table 1, we notice that our motor output power of 4.53 W is less
than our previously calculated paddle-produced power of 5.56 W. What this tells us is that
because our motor can only output so much power, it will inevitably slow down whenever the
required paddle power is too high. This will invariably slow the paddle down and thereby reduce
the power required by the paddle. Since power goes as velocity cubed, even a small reduction
in paddle velocity will result in a significant reduction in the required paddle power. In our
analysis, we assumed a constant angular velocity, so this error is understandable.

Drag Testing

Figure 19: Force Body Diagram of Duck

The team conducted simple drag testing on the duck body. We applied a known force to (by
hanging a weight from a pulley), and measured the velocity of the duck. Then, we calculated
the drag coefficient of the duck using Eq (3):

F drag = *C d *V2S (3)


Handa, Lopez, McMordie, Solis 19

Where: is the density of water, V is the measured velocity of the duck, C d is the drag
coefficient, and S is the estimate submerged surface area of the duck.

The coefficient of drag of the ducks hull is C d = 1.719. Data from our testing can be found in
Appendix B. Note that this is higher than the coefficient of drag for a cube in water (C d = 1), and
lower than the C d for a flat plate in water (C d = 3). We concluded that our pontoons and hull
were adequately streamlined for the water flow.
Handa, Lopez, McMordie, Solis 20

Re-Design
Our design teams duck performed well during preliminary testing the duck paddled along at
42 cm/sec in a straight path. We were pleased with the performance of the DC motor, the
paddling motion of the 4 bar linkage, and the robustness of the laser cut acrylic structure.
However, our preliminary testing was conducted in a controlled environment the baby pool
provided to us for testing. Furthermore the duck was not operated for long periods of time, wind
and waves were negligible, and there were no significant obstacles. These additional variables
reduced our ducks final tested speed down to 26 cm/sec. We could improve a Duck 3.0 in two
significant ways.

1) Redesign the motor gearbox. After several long rounds of testing, our motor gearbox
experienced catastrophic failure. One of the compound gears wore through its housing
causing gears to grind and rendering the motor
useless (see Figure 20). Our engineering team
can speculate regarding the causes of this
failure. This gear and its housing are in close
proximity to the DC motor. The motor, under
high loads and for long periods of time could
have generated significant amounts of heat; this
could have heated the ABS housing and
reduced material strength. Also, we are fairly
certain that the yellow compound gear (see
Figure 20) was not fully seated in its housing,
due to an over-tightened screw. This would
have caused significant wear around the thinner
lip of the housing. With an extra 100 dollars, we
could easily purchase gears on longer, metal
axles, or we could purchase a new housing and
ensure that all gears are fully seated.

Figure 20. Gearbox Failure and Unseated Gear

2) Decrease the width of the body, and the turning moment. The duck slowed down
when it contacted obstacles (pool noodles) and turned into them. Our current design has
a relatively wide body, with pontoons 12.75 inches apart. If we decreased the body width
of Duck 3.0 by 70% (to 9 inches), we would also decrease the magnitude of the turning
moment by 70% (see Figure 21). The magnitude of the turning moment is given by the
equation:
=
Handa, Lopez, McMordie, Solis 21

where M is magnitude of the turning moment, r is the distance from pontoon to center of
the duck, and F thrust is the magnitude of the thrust force produced by paddling.
If we redesigned, our duck would be less likely to turn into obstacles. Apart from
decreasing total body width we could also achieve this effect by tapering down the front
of the design, as this is the portion that will likely hit an obstacle.

Figure 21. Shorter body width results in lower turning moment when hitting lanes
Handa, Lopez, McMordie, Solis 22

Conclusion

Our bio-inspired duck robot was capable of mimicking the paddling motion of a ducks feet very
closely. It successfully managed to cross 5 meters by paddling in a narrow lane of a swimming
pool within 19 seconds. Our ducks successful paddling motion can primarily be attributed to our
four-bar linkage design - specifically our choice to use a Hoekens linkage - and its resulting
coupler curve. The Hoekens linkage allowed us to achieve higher velocities during the front
stroke i.e. the part of the coupler curve when the paddle is in the water (see highlighted region
in coupler curve Figure 2) resulting in a powerful thrust which swiftly propels the duck forward.
At the same time the Hoekens linkage gives us slower speeds on the return stroke reducing
any back thrust. Additionally, since our ducks feet are for the most part submerged into the
water on the front stroke and mostly above the water surface on the return stroke, we also have
reduced drag on the return stroke. Ultimately, strong pin joint connections and a thicker crank
with reinforcing spacers provided us with reliable and consistent linkage movements which were
essential to our ducks durability and consistency.

The main drawback of our design would be the ducks inability to steer directly forward. Despite
our smooth pontoons, constant brushing against the lane markers due to turning certainly
reduced our robots overall speed. A next design stage would ideally focus on tapering down the
front width of the robot to prevent the amount of turning when it hits a pool lane. Additionally our
ducks inability to resist oncoming waves and wind tend to steer it away from its path. A future
iteration could attempt to address this issue by increasing the overall mass of our duck by using
a heavier and longer keel. To reduce the likelihood of gear box failure, a new design would use
a gear box housing that is stronger, and has gears seated on longer and stronger metal axles to
prevent gears from slipping out of position. Finally if we were to redesign linkages, one might
consider a longer stroke length in the water to maximize the impulse of the thrust force and get
the most change in momentum.

Figure 22. Final Duck Design in Foreground, Baby Pool Testing Grounds in Background.
Handa, Lopez, McMordie, Solis 23

Appendix A: Cad Drawings

CAD Drawing of Final Hoekens Linkage


Handa, Lopez, McMordie, Solis 24

Links, from top to bottom Coupler, Ground, Rocker, and Crank.


Handa, Lopez, McMordie, Solis 25

Appendix B: Drag Testing


2 3 2
Mass (kg) g (m/s ) (kg/m ) V (m/s) S (m ) Cd
0.0697 9.81 1000 .3036 .00863 =1.719
Handa, Lopez, McMordie, Solis 26

Appendix C: Images of Subsystems

Engraved Faces of Team Members Pontoons and Base

Acrylic Hoekens Linkage Streamlined Pontoon

Motor Mount Tail Mechanism


Handa, Lopez, McMordie, Solis 27

Appendix D: MatLab Code

%%Plotting Coupler Curves, Velocity Graphs, and Thrust Graphs

clear all
close all

Ft1 = ThrustDuck(0); % All plots for Foot 1


points = 1:1:360;
Ft2 = ThrustDuck(pi);% All plots for Foot 2 (180 degrees out of phase)

%Sums up the thrust contribution from each foot in order to get a grand
%total that we can then plot.
Ft_total = Ft1 + Ft2;

figure

% Total thrust plot


plot(points,Ft_total)
xlabel('Degrees');
ylabel('Force[N]');
title('Total Thrust Produced by Both Feet');
axis([0 360 0 4.5]);
grid on
plotfixer

function Ft = ThrustDuck(theta2initial)

%This function takes in the initial angle of the crank, theta2, and then
%outputs a vector that contains the thrust produced by the fourbar linkage
%along a 360 degree cycle. It also plots the coupler curve, the velocity
%data, and the thrust data.

% Set number of points and initial angle


N = 360;

in_to_m = .0254; %Conversion factor from inches to meters

% Set link lengths, orientation angle theta1 and assembly (1 or -1)


%
r1 = 1.89*in_to_m;
r2 = 1*in_to_m;
r3 = 2.22*in_to_m;
r4 = 2.52*in_to_m;
theta1 = 0; %units of radians
assem = -1; % either 1 or -1

% Set angle and length associated with the coupler point


gammac = 0; %units of radians
r5 = (2.22 + 2.22)*0.0254;

% Loop through N points (representing 2*pi radians of rotation in


% theta2), solve the linkage equations at each point and keep track
% of angles and coupler curve points.
Handa, Lopez, McMordie, Solis 28

xca1 = zeros(1,length(N));
yca1 = zeros(1,length(N));
theta2a1 = zeros(1,length(N));
theta3a1 = zeros(1,length(N));
theta4a1 = zeros(1,length(N));
points = 1:N;

for i = 1:N
theta2a1(i) = (2*pi/N)*(i-1) + theta2initial;
if (theta2a1(i) > 2*pi)
theta2a1(i) = theta2a1(i) - 2*pi;
end

[theta3a1(i),theta4a1(i)]=fourbar(theta2a1(i),theta1,r1,r2,r3,r4,assem);

% Optionally display the coupler coordinates, xca1 and yca1


xca1(i) = r2*cos(theta2a1(i)) + r5*cos(theta3a1(i) + gammac);
yca1(i) = r2*sin(theta2a1(i)) + r5*sin(theta3a1(i) + gammac);

end;

% Animate linkage. Wait until the user hits a key to start.


% Plot each of the N configurations.

theta2a1 = theta2a1(end:-1:1);
theta3a1 = theta3a1(end:-1:1);
theta4a1 = theta4a1(end:-1:1);
xca1 = xca1(end:-1:1);
yca1 = yca1(end:-1:1);

figure;
pause;

for i=1:N;
clf

% coordinates of the joints


x1 = 0;
y1 = 0;
x2 = x1 + r2*cos(theta2a1(i));
y2 = y1 + r2*sin(theta2a1(i));
x3 = x2 + r3*cos(theta3a1(i));
y3 = y2 + r3*sin(theta3a1(i));
x4 = x1 + r1*cos(theta1);
y4 = y1 + r1*sin(theta1);

% Plot Coupler and connector line


plot(xca1(1:i),yca1(1:i),'bo')
line([x2;xca1(i)],[y2;yca1(i)],'Color','m','LineWidth',3);

% Set the axis


axis([-0.05 0.1 -0.13 0.03]);
Handa, Lopez, McMordie, Solis 29

axis square;

% Plot the links


line([x1;x2],[y1;y2],'Color','g','LineWidth',3); %input crank
line([x2;x3],[y2;y3],'Color','r','LineWidth',3); %coupler
line([x3;x4],[y3;y4],'Color','b','LineWidth',3); %rocker
line([x1;x4],[y1;y4],'Color','k','LineWidth',3); %ground
plotfixer

% Change this line to 'pause;' if you want the program to stop


% after each configuration.
pause(0.00000001);

end;

hold on
grid on

A = -r3*sin(theta3a1);
B = r4*sin(theta4a1);
C = r2*sin(theta2a1);
D = r3*cos(theta3a1);
E = -r4*cos(theta4a1);
F = -r2*cos(theta2a1);

w3_w2 = (B.*F - E.*C)./(D.*B - E.*A);


w_motor = 800; %Angular Velocity of the Motor Output (rad/s)
GearRatio = 74; %Gear Ratio of our Transmission
w2 = (w_motor/GearRatio); %Angular Velocity of our Crank (rad/s)

%x-component velocity of the coupler point (m/s)


vxc = (-r2.*sin(theta2a1)*w2 - r5.*sin(theta3a1 + gammac).*(w3_w2)*w2);

%y-component velocity of the coupler point (m/s)


vyc = -(r2.*cos(theta2a1)*w2 + r5.*cos(theta3a1 + gammac).*(w3_w2)*w2);

figure

%Plotting the velocity data


plot(points,vxc,'r');
hold on
grid on
plot(points,vyc,'g');
xlabel('Degrees')
ylabel('Velocity [m/s]');
title('Vx and Vy of Coupler Point');
axis([0 360 -1.5 0.5]);
legend('Vxc','Vyc','Location','SE');
plotfixer

figure

V_duck = 0.26; % Velocity of our duck in the pool (m/s)


Ct = 2.5; %assumed value for thrust coefficient
Handa, Lopez, McMordie, Solis 30

Area = (3*in_to_m)*(1*in_to_m); %assumed paddle area in the water


Ft = 0.5*Ct*1000*(vxc + V_duck).^2*Area; %Thrust Force (Newtons)
%Thrust Plot
plot(points,Ft);
grid on
xlabel('Degrees')
ylabel('Force [N]');
title('Thrust Along Coupler Curve');
axis([0 360 0 3.5]);
plotfixer

end

function [theta3,theta4] = fourbar(theta2,theta1,r1,r2,r3,r4,assem)

%This function takes in the lengths of all the linkages, the initial crank
%angle, and an input to determine whether or not to invert the solution,
%and outputs the relative angles of the coupler, theta3, and the rocker,
%theta4, during a 360 degree cycle.

%r1 ground
%r2 crank
%r3 coupler
%r4 rocker

r7 = sqrt(r1^2 + r2^2 - 2*r1*r2*cos(theta2-theta1));


gamma = acos((r4^2 + r7^2 - r3^2)/(2*r4*r7));

if(theta2 >= theta1 && theta2 <= (theta1 + pi))


alpha = acos((r1^2 + r7^2 - r2^2)/(2*r1*r7));
else
alpha = -acos((r1^2 + r7^2 - r2^2)/(2*r1*r7));
end

if (assem == 1)
theta4 = pi - alpha + theta1 - gamma;
else
theta4 = pi - alpha + theta1 + gamma;
end

theta3T = asin((r4*sin(theta4) + r1*sin(theta1) - r2*sin(theta2))/r3);

if ((r4*cos(theta4) + r1*cos(theta1) + - r2*cos(theta2)) > 0)


theta3 = theta3T;
else
theta3 = pi - theta3T;
end

end
Handa, Lopez, McMordie, Solis 31

%% Motor Characterization Plot

clear all
close all

i_actual = 2.1; %The actual amount of current that we drew through our motor
NumBatteries = 4;
R_Batt = 0.02; %Internal Resistance of Batteries
V_Nom = 4.8;
V_actual = V_Nom - NumBatteries*R_Batt*i_actual;

V = V_actual;
inl=0.15;
is=(V/1.1);
R = 1.1;
k=2.9*10^-3;
Tf=k*inl;
i = linspace(inl,is,500);
w = (V-i.*R)/k;
wrpm = (w.*60)/(2*pi);
pin = V.*i;
Tl = k.*i-Tf;
pout = Tl.*w;
efficiency = pout./pin;

Tl_actual = k*i_actual-Tf;
w_actual = (V - i_actual*R)/k;
w_actual_rpm = w_actual*(60/(2*pi));
pout_actual = Tl_actual*w_actual;
pin = V*i_actual;
efficiency_actual = pout_actual/pin;

plot(wrpm, efficiency*10)
xlabel('angular speed (rpm)'); ylabel('Efficiency, Torque Load, Power Out');
title('Tamiya Gear Box at 4.63V');
hold on
grid on
plot(wrpm,Tl*1000,'r')
plot(wrpm,pout,'g')
scatter(w_actual_rpm,efficiency_actual*10,'filled','r');
legend('Efficiency*10','Torque Load (mNm)','Power Out(W)','Location','NE');
plotfixer

Potrebbero piacerti anche