Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code to resemble a rowing stroke

I'm working on a small program displaying moving rowing boats. The following shows a simple sample code (Python 2.x):

import time
class Boat:
    def __init__(self, pace, spm):
        self.pace = pace  #velocity of the boat in m/s
        self.spm = spm    #strokes per minute
        self.distance = 0 #distance travelled

    def move(self, deltaT):
        self.distance = self.distance + (self.pace * deltaT)

boat1 = Boat(3.33, 20)
while True:
    boat1.move(0.1)
    print boat1.distance
    time.sleep(0.1)

As you can see a boat has a pace and rows with a number of strokes per minute. Everytime the method move(deltaT) is called it moves a certain distance according to the pace.

The above boat just travels at a constant pace which is not realistic. A real rowing boat accelerates at the beginning of a stroke and then decelerates after the rowing blades left the water. There are many graphs online which show a typical rowing curve (force shown here, velocity looks similar):

Rowing Stroke Graph Source: highperformancerowing.net

The pace should be constant over time, but it should change during the stroke.

What is the best way to change the constant velocity into a curve which (at least basically) resembles a more realistic rowing stroke?

Note: Any ideas on how to tag this question better? Is it an algorithm-problem?

like image 321
MOnsDaR Avatar asked Jan 05 '15 19:01

MOnsDaR


People also ask

What is the stroke called in rowing?

Stroke seat When the boat has more than one rower, the rower closest to the stern of the boat is referred to as "stroke".

What does S M mean in rowing?

On your Performance Monitor, the number in the upper right corner on every workout display is “Strokes Per Minute” ("s/m" or "spm"). Athletes see this number on every stroke, so it must be important.

What is SPM in rowing?

SPM stands for Strokes Per Minute. As the stroke rate increases, the split should naturally drop because you will be rowing faster and working harder. At a slower stroke rate you should be able to maintain your splits for longer.

How many strokes are in a 1000 meter row?

The commentators make a point to highlight the fact that the US is only rowing at 35 strokes when they cross the 1000 meter mark.


1 Answers

If your goal is to simply come up with something visually plausible and not to do a full physical simulation, you can simply add a sine wave to the position.

class Boat:
    def __init__(self, pace, spm, var=0.5):
        self.pace = pace    #average velocity of the boat in m/s
        self.sps = spm/60.0 #strokes per second
        self.var = var      #variation in speed from 0-1
        self.totalT = 0     #total time
        self.distance = 0   #distance traveled

    def move(self, deltaT):
        self.totalT += deltaT
        self.distance = self.pace * (self.totalT + self.var * math.sin(self.totalT * self.sps * 2*math.pi)

You need to be careful with the variation var, if it gets too high the boat might go backwards and destroy the illusion.

like image 128
Mark Ransom Avatar answered Sep 30 '22 07:09

Mark Ransom