Skip to content
andrewroth edited this page Nov 28, 2010 · 16 revisions

vision

To use my sansa mp3 player as a workout guide. I want it to tell me which workout to do, how many reps, how long to rest etc.

To be able to track long-term how I’m doing. Am I working out regularly? Am I lifting more weights than when I started?

To be able to record when I deviate from a workout. Maybe a friend shows up and I work out with him, doing something totally different from what I planned. I want to be able to record that, and be able to make up my original workout on another day and record that too.

To sit down at the start of a month and map out my workout schedule for the month. Or 3 months. Or 6 months. Whatever I find works best. But the point is to have long-term goals and not just go to the gym and see what I feel like doing.

To be able to connect my sansa and run one program/command and have it sync databases.

To integrate with google calendar. Ideally to both edit and read, or read-only if that’s too hard.

technical approach

There will be two components: a database-driven rails app and the sansa app. Since I’m a rails programmer, the idea of a remote device is strange. I’ve come to think of it as a remote computer that has its own database. The databases then will get synced up with another database hosted on a web server (or a local computer, if you don’t have a web server). Mostly, the sansa will be creating rows of exercise logs.

The app will be responsible for managing workouts, exercises, and goals. Synchronizing the goals with exercises in a robust way is proving to be the most difficult part. If you have a goal to work out 2 times per week and increase weight by 5% each time, have you met that if you do one workout one week and two workouts the next? or if you jump 3% one week then 7% the next? If you have a goal to do an exercise 10 times, and you do it 10 times but 5 of those times you did 2 reps instead of 3, have you met it? etc.

I’ve come to divide goals in two parts: time-based and weight-based. I can mark that I want to do a certain number of a certain workout (ex. upper body) or that I want to increase my bench press from 100lb to 140lb.

schema

I’ve come up with a sort of linear goal storage schema, and where I store a # that means simply how many times I’ve done an exercise, and the goal component has a simple formula that can derive a goal amount based on the #.

Workout
name
n updated each time the workout is done ie. a WorkoutLogEntry is made

Exercise
name
n updated each time an exercise is done, ie. an ExerciseLogEntry is made
exercise_type_id

ExerciseType
name
v1, v2, v3, v4, v5, v6, v7

WorkoutExercise
workout_id
exercise_id
position

ExerciseSet
name
position
exercise_id

Function given an input n, returns a value for the variable
type
set_id
variable
base
inc
round_to_nearest
min_n
max_n
min_v
max_v

WorkoutDate
day
workout_id

WorkoutLogEntry sansa writes this
created_at
workout_date_id
workout_id same as workout_date.workout_id if workout_date
n

ExerciseLogEntry sansa writes this
created_at
workout_log_entry_id
exercise_id
n
position

SetLogEntry sansa writes this
created_at
exercise_log_entry_id
exercise_set_id
position
v1, v2, v3, v4, v5, v6, v7

rails app

The rails app will have the standard create-read-update-delete so that workouts, exercises and reps can be managed.

There will also be a section to list/tweak logs that are copied off the sansa, in case I didn’t record it right.

There will be a generator where I can specify days of the week and a start and end date, and have it generate a bunch of WorkoutDate rows for me.

If I get really fancy, some graphs showing the ExerciseGoalRep derived weight amounts for an exercise compared to my actual exercise log entry weight amount.

sansa app

The basic layout I’m thinking of is a list of exercises followed by reps on the top. On the bottom will be a “message” that tells you what to do. Using the scroll wheel and center button, you can get context menus that then allow you to manage any aspect of the exercise. Essentially, it’s a WorkoutLogEntry editor.

Very basic mockups:

Startup screen, choose workout:

  Choose workout
  Today: Aug 22

  Aug 20   Upper body 2
  *Aug 22   Legs 1*
  Aug 24   Back & bicep

  New workout

General workout screen:

Bench Press
12x90   10x100   8x110

Tricep Pushdown
10x60   9x70     8x80

------------------------
Bench Press 100lb

General workout screen:

Bench Press
12x90   10x100   8x110

Tricep Pushdown
10x60   9x70     8x80

------------------------
Rest 30s
Set weight to 110lb

Select 30lb rep with scroll wheel, click middle button:

Bench Press
  --------------------
  | "10x90 rep"     |
  | Mark Done         |
  | Mark Not Done     |
  | Change num        |
  | Change weight     |
  | Delete            |
  | Insert rep after  |
  ---------------------
Tricep Pushdown
10x60   9x70     8x80

------------------------
Rest 30s
Set weight to 110lb

Select bench press with scroll wheel, click middle button:

Bench Press
  ---------------------
  | "Bench Press"     |
  | Mark Done         |
  | Mark Not Done     |
  | Delete            |
  | Insert ex. after  |
  ---------------------
Tricep Pushdown
10x60   9x70     8x80

------------------------
Rest 30s
Set weight to 110lb

things to think about

How to handle cardio? One-rep exercise where weight amount is minutes? Need one additional linear variable “difficulty”?

How to make the app operate like a very simple database? Ex. associations/joins, unique ids. Load everything to memory? How smart should the log writing be, just write everything that’s in memory and repeatedly use that method, or for performance will I need to try to be smarter about it?

v1 restrictions

As I’m working on this I’m realizing I should release v1 with a number of restrictions. There are a number of reasons for this: one, so I can get it out faster, two so that I’m waiting until I want a feature to do it, to avoid doing unnecessary work.

- No ability to add workouts on the fly. Exercises must be recorded to a workout date that’s already been loaded on the pandora.

- No ability to add or remove exercises in a given workout. I’m not sure how that would even work.

- No ability to even add or remove sets in an exercise. This is something I can probably add fairly quickly in another version.

Basically it’s going to be a straight-up workout player that you follow to a T. It records if stuff is done or not, that’s about it.

Clone this wiki locally