This is a simple indoor bicycle training application, similar to a very stripped-down version of TrainerRoad or Zwift with the following features:
- Creates target-power workout profiles for the user to follow
- Displays and logs ANT+ heartrate and power data
- Uploads your workout to Strava
Installation is still a bit janky due to a number of dependencies. For now, this should work, but YMMV
- Download the repo (either as a zip or via git clone)
- Run
pip install msgpack
- this shouldn't be required, but for some reason python setuptools chokes on it. - Install
libusb
. Note that on MacOS Catalina, I've found that only the Homebrew version works (the ones on pip and Macports do not work). If you have Homebrew installed, runbrew install libusb
. - From the root of the downloaded files, run
python setup.py install
. This should install all the other dependencies needed.
- Configure Strava API access as described below (if you want automatic uploads)
- Plug in your ANT+ dongle and wake up your heartrate and power sensors
- Launch PM trainer:
python src/pmtrainer/pm_trainer.py
- Your ANT+ dongle and sensors should automatically be detected.
- Select a workout:
- Click the gear icon (settings)
- Under the "Workout" section click "Select"
- Click on the profile of the workout you want, then click "Select"
- Click "Save" on the settings dialog
- Ride your heart out!
- When the workout is over, close PM Trainer, and you'll be prompted if you want to save your workout to Strava (if you've configured Strava API access).
- If you don't want to link your Strava account there will be a *.tcx file in the log directory configured in the Settings dialog. You can manually upload this file to Strava.
Each user is expected to set up their own Strava API client, so there are a few annoying steps required to use the Strava integration feature:
- Follow instructions on Strava API Getting Started to configure an app. Briefly:
- Go to Strava API Settings in your Strava account, and fill out the required fields.
- Get the
Client ID
and theClient Secret
from the page after you've registered your API.
- Enter these items in the PM Trainer settings dialog:
- Launch PM Trainer, click the Settings button (gear icon)
- Click the "Strava Connect" button in this dialog
- There will then be a popup window prompting you to enter these values. Enter them in the required fields, and then click "Save"
- That's all folks! At this point, PM Trainer will open a browser window requesting you to authenticate the app with Strava (standard Oauth2 workflow).
If you have an ANT+ dongle connected when PM Trainer is launched, it will automatically select the first heartrate monitor and power meter that it sees. Note that this could cause issues if you have more than one of these active (e.g., if there are two people wearing heartrate monitors in range, it's uncertain which one will be picked up by PM Trainer). This will be fixed someday by Issue #10.
PM Trainer hasn't been tested with many different dongles or sensors, but here are ones it is known to work with:
Dongles:
- ANSELF USB ANT+ dongle
KINOEE USB ANT+ dongle- note that this dongle has been confirmed not to work with the USB and ANT+ libraries used by PM Trainer. Please don't try to use it.
Sensors:
Currently cadence sensors and erg-mode trainers are not supported, although it would be fairly easy to add support for them if needed.
Creating a new workout is as simple as creating a YAML file in the workouts folder. The format of this file is:
name: <workout name goes here>
description: <brief description of the workout>
duration_s: <duration in seconds>
blocks:
- duration: <duration as fraction of total workout>
start: <desired power at the beginning of the block as a fraction of FTP>
end: <desired power at the beginning of the block as a fraction of FTP>
- ... more blocks...
Each "block" element defines a segment of the workout with either constant power, or a power ramp. If the start
and end
values are the same, desired power will be constant. Conversely, if these values are different, desired power will either increase or decrease across the segment. There are a few sample workouts in the workouts folder. Note that the sum of the duration
values across all blocks must be 1.0, or the workout will be rejected.
Once you've created the workout in this folder, launch PM Trainer and the workout will now show up in the workout selection dialog under Settings: