Rowing software on Linux?

Post questions and issues with Concept2 PM3 SDK
Stephen Nicklin
Paddler
Posts: 8
Joined: September 26th, 2007, 7:16 am
Location: Oxford, UK
Contact:

Rowing software on Linux?

Post by Stephen Nicklin » September 26th, 2007, 8:27 am

I'm trying to run Linux as our main OS, but I have to keep Windows Vista as a dual-boot option so I can run RowPro. I've taken an afternoon to see if there's any options for a Linux solution and there doesn't appear to be much out there for a PM3 (or above) rower.

From what I've found on the web there was a small number of Linux options for the PM2 - for example George Palmer's PC-Rower - but I think these older rowers used a completely different interface compared to the PM3 (serial rather than USB). So I've assumed PC-Rower isn't an option for newer Concept 2's.

I can see posts on this forum by johroo, where he's managed to code a program to get some rowing stats back from a PM3 via the libusb interface. Does anybody know of any other work in this area or any other software for Linux/PM3? From what I can see johroo's work is the latest word for a Linux/PM3 combo.

I'm guessing we could also use the libhid interface to talk to a PM3 which might make things a little simpler. Any advice or pointers anybody has would be much appreciated. All I'm looking for is a piece of software that allows me to record stroke data, times etc for a fixed distance work-out; record this data and allow me to 'race' a past row. A graphical interface is a long way down on the 'wish list'.

Would anybody else be interested in this? All code/programs would be released under the GPL, so free to all. I get the feeling the only way to get this is to fire up the g++ compiler and try to code it myself :(

Steve

User avatar
johnlvs2run
Half Marathon Poster
Posts: 4012
Joined: March 16th, 2006, 1:13 pm
Location: California Central Coast
Contact:

Post by johnlvs2run » September 26th, 2007, 11:53 am

I'm interested but don't know anything about creating a program.
bikeerg 75 5'8" 155# - 18.5 - 51.9 - 568 - 1:52.7 - 8:03.8 - 20:13.1 - 14620 - 40:58.7 - 28855 - 1:23:48.0
rowerg 56-58 5'8.5" 143# - 1:39.6 - 3:35.6 - 7:24.0 - 18:57.4 - 22:49.9 - 7793 - 38:44.7 - 1:22:48.9 - 2:58:46.2

Stephen Nicklin
Paddler
Posts: 8
Joined: September 26th, 2007, 7:16 am
Location: Oxford, UK
Contact:

Post by Stephen Nicklin » September 27th, 2007, 4:23 pm

I've managed to write the code that does a similar job to what johroo reported - basically checks for a connected PM3 USB device, probes for some basic info (firmware version etc), then collects 20 samples of the time and distance of a JustRow session. The sample time was deliberately set to one second intervals.

So this is all 'do-able' in Linux. It should be too much to add the code to put the PM3 into a 5km session, up the resolution of the sampling, add more info to the samples and print out final stats once the session is over. Obviously as basic as it gets, but it's a start.

Steve
  • debian:/home/stephen/Rowing/RowTrainer# ./RowTrainer

    RowTrainer, libusb tests. Sept 2007.
    [ Probing for version info. Command sent: 01 F1 91 91 F2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ]
    [ Frame received: 01 F1 89 91 07 16 02 03 B1 01 63 00 DB F2 00 00 00 00 00 00 00 ]
    This PM3 is running Firmware version: 99
    This Concept 2 is hardware version: 433
    [ Probing for odometer info. Command sent: 01 F1 9B 9B F2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ]
    [ Frame received: 01 F1 09 9B 05 91 06 02 00 24 26 F2 DB F2 00 00 00 00 00 00 00 ]
    This PM3 has covered 132753 meters.

    Monitoring a JustRow ...

    [Sample 0 ]; Work Time: 0 hours, 1 minutes, 30 seconds. Current Distance: 118
    [Sample 1 ]; Work Time: 0 hours, 1 minutes, 30 seconds. Current Distance: 118
    [Sample 2 ]; Work Time: 0 hours, 1 minutes, 30 seconds. Current Distance: 118
    [Sample 3 ]; Work Time: 0 hours, 1 minutes, 30 seconds. Current Distance: 118
    [Sample 4 ]; Work Time: 0 hours, 1 minutes, 30 seconds. Current Distance: 118
    [Sample 5 ]; Work Time: 0 hours, 1 minutes, 30 seconds. Current Distance: 118
    [Sample 6 ]; Work Time: 0 hours, 1 minutes, 30 seconds. Current Distance: 118
    [Sample 7 ]; Work Time: 0 hours, 1 minutes, 30 seconds. Current Distance: 118
    [Sample 8 ]; Work Time: 0 hours, 1 minutes, 32 seconds. Current Distance: 119
    [Sample 9 ]; Work Time: 0 hours, 1 minutes, 33 seconds. Current Distance: 120
    [Sample 10 ]; Work Time: 0 hours, 1 minutes, 34 seconds. Current Distance: 121
    [Sample 11 ]; Work Time: 0 hours, 1 minutes, 35 seconds. Current Distance: 123
    [Sample 12 ]; Work Time: 0 hours, 1 minutes, 36 seconds. Current Distance: 124
    [Sample 13 ]; Work Time: 0 hours, 1 minutes, 37 seconds. Current Distance: 125
    [Sample 14 ]; Work Time: 0 hours, 1 minutes, 38 seconds. Current Distance: 126
    [Sample 15 ]; Work Time: 0 hours, 1 minutes, 39 seconds. Current Distance: 127
    [Sample 16 ]; Work Time: 0 hours, 1 minutes, 40 seconds. Current Distance: 128
    [Sample 17 ]; Work Time: 0 hours, 1 minutes, 41 seconds. Current Distance: 129
    [Sample 18 ]; Work Time: 0 hours, 1 minutes, 42 seconds. Current Distance: 130
    [Sample 19 ]; Work Time: 0 hours, 1 minutes, 43 seconds. Current Distance: 132


    debian:/home/stephen/Rowing/RowTrainer#
[/list]

smocking
Paddler
Posts: 1
Joined: October 13th, 2007, 11:00 am

got source?

Post by smocking » October 13th, 2007, 11:39 am

Looks promising. With that framework it's not difficult to use any other command from the PM3 specification. I'm coaching a freshmen's eight and would like to interface the PM3's in our club with a Linux box. Hacking together something to keep track of progress based on your code should be easy.

I understand it's written in C++ and uses libusb? Could you e-mail me the source at s.j.t.mocking@students.uu.nl? Perhaps with a little work we may be able to adapt pm2d to support the pm3 and upwards.

Stephen Nicklin
Paddler
Posts: 8
Joined: September 26th, 2007, 7:16 am
Location: Oxford, UK
Contact:

Post by Stephen Nicklin » October 13th, 2007, 12:37 pm

The code is nearly there (see below). Most of the time is being spent getting the UI/logging/database modules in place so the foundations at least exist.

Image

In a couple of weeks I think the code will be ready for a 0.1 version. Then I release the SVN details etc.

My current goal is to get this tool to configure a set piece - say 5km - monitor the row and record stoke information to a database. Then we can worry about how to race against past rows and putting some graphs into the display.

Steve

User avatar
johnlvs2run
Half Marathon Poster
Posts: 4012
Joined: March 16th, 2006, 1:13 pm
Location: California Central Coast
Contact:

Post by johnlvs2run » October 13th, 2007, 4:26 pm

Great progress. :)
bikeerg 75 5'8" 155# - 18.5 - 51.9 - 568 - 1:52.7 - 8:03.8 - 20:13.1 - 14620 - 40:58.7 - 28855 - 1:23:48.0
rowerg 56-58 5'8.5" 143# - 1:39.6 - 3:35.6 - 7:24.0 - 18:57.4 - 22:49.9 - 7793 - 38:44.7 - 1:22:48.9 - 2:58:46.2

User avatar
Citroen
SpamTeam
Posts: 8062
Joined: March 16th, 2006, 3:28 pm
Location: A small cave in deepest darkest Basingstoke, UK

Post by Citroen » October 14th, 2007, 4:02 am

Stephen Nicklin wrote:My current goal is to get this tool to configure a set piece - say 5km - monitor the row and record stoke information to a database.
I've run Chris Brett's ActiveX PMI stuff http://concept2.co.uk/forum/viewtopic.php?t=14482
http://www.concept2.co.uk/software/pmi.php

I could get you a log with Snoopy of the USB traffic to set a distance (not 5K, 100m may be more sensible for a sample) and row it using that ActiveX control with Excel.

Stephen Nicklin
Paddler
Posts: 8
Joined: September 26th, 2007, 7:16 am
Location: Oxford, UK
Contact:

Post by Stephen Nicklin » October 14th, 2007, 4:35 am

Thanks, but I think the commands are documented in the Interface Defintion so it's just a case of getting my head around the 'long' format commands. Doesn't look that difficult.

Steve

emaros
Paddler
Posts: 1
Joined: November 25th, 2006, 8:14 pm

Post by emaros » February 6th, 2008, 12:18 am

Stephen Nicklin wrote:The code is nearly there (see below). Most of the time is being spent getting the UI/logging/database modules in place so the foundations at least exist.

In a couple of weeks I think the code will be ready for a 0.1 version. Then I release the SVN details etc.

My current goal is to get this tool to configure a set piece - say 5km - monitor the row and record stoke information to a database. Then we can worry about how to race against past rows and putting some graphs into the display.

Steve
You have done a great job! I would be very interested in seeing the source code so I can understand how you used libusb to interface with the PM3. Do you have an estimation as to when you will be allowing at read access to the svn repository?

Thanks
Ed

Stephen Nicklin
Paddler
Posts: 8
Joined: September 26th, 2007, 7:16 am
Location: Oxford, UK
Contact:

Post by Stephen Nicklin » February 6th, 2008, 7:34 am

Hi Ed,

This mini-project got shelved towards the end of last year when my son was born - free time became a luxury. The interface into the PM3/4 was working fine and the basic display does what you'd expect, but I was getting bogged down in the database link - a lot of work went into trying to decide the format of the stroke info we save (eg a compressed stream of distance, speed every tenth of a second), making sure things could be upgraded in this area and being able to edit/save/add user info.

Anyway, this is the link to the site that has an overview of the project. There's SVN details and a step by step guide to compiling this on Linux, but feel free to contact me if you need any help?

http://www.rowing.nicklin.name/wiki

I'll probably pick this up again in the near future, so let me know if you want to actually start using this program? It should take too much work to get a basic monitor up to a usable state and the windows port of the libusb library may have moved on allowing us to run this 'natively' on Windows.

A major problem is being able to run this program on Linux whilst not being the root user. You can setup the system to change this behaviour and grant write access to USB devices to normal users, but diffent Linux distributions are at a different stage of implementing the udev method (which I think is the agreed modern Linux 'way'). Please read the setup section on the Wiki and let me know if you need any help?

I also removed a number of the display elements (estimated time, average split etc). The PM device appears to be doing some non-trivial calculations/smoothings to get it's numbers - mine just didn't seem to work as well.

Hope this helps,

Steve
rowing@nicklin.name

Stephen Nicklin
Paddler
Posts: 8
Joined: September 26th, 2007, 7:16 am
Location: Oxford, UK
Contact:

Post by Stephen Nicklin » February 6th, 2008, 7:44 am

PS Just in case more than one person decides to try this program out, I've quickly put up a forum at:

http://www.rowing.nicklin.name/forum/

If you have any specific questions about how the code works, problems compiling, features you need, bugs etc probably best to post there. I'll do my best to help.

Steve

longrowtohoe
Paddler
Posts: 2
Joined: April 7th, 2007, 12:29 am

Post by longrowtohoe » February 7th, 2008, 6:50 pm

What's the possibility of this code compiling for Mac OS X?

Stephen Nicklin
Paddler
Posts: 8
Joined: September 26th, 2007, 7:16 am
Location: Oxford, UK
Contact:

Post by Stephen Nicklin » February 8th, 2008, 6:47 am

There are a few places in the code where we have different calls depending on whether it's compiling on a Windows machine or Linux. There's only a couple of these but they will need to be changed. Given that Mac OS X is a BSD derivative that should be an easy(ish) step.

The Qt library that provides the UI works on Max OS X and so does the libusb library that we use to talk to the PM. And the open source compilers also run on MaxOS (gcc etc). I was also using the bzip2 code to compress the log files this program generated (they are huge otherwise, recording all the data sent to/from the PM). That might not work without change as I hard-coded some of the processor assumptions in the makefile.

If there's a Mac programmer out there, I'd say it would take much to get the code to work. But it won't work as it stands now, sorry.

Steve

Peewee1963
Paddler
Posts: 5
Joined: May 8th, 2007, 5:03 am

Post by Peewee1963 » February 11th, 2008, 2:12 pm

Stephen Nicklin wrote:There are a few places in the code where we have different calls depending on whether it's compiling on a Windows machine or Linux. There's only a couple of these but they will need to be changed. Given that Mac OS X is a BSD derivative that should be an easy(ish) step.

The Qt library that provides the UI works on Max OS X and so does the libusb library that we use to talk to the PM. And the open source compilers also run on MaxOS (gcc etc). I was also using the bzip2 code to compress the log files this program generated (they are huge otherwise, recording all the data sent to/from the PM). That might not work without change as I hard-coded some of the processor assumptions in the makefile.

If there's a Mac programmer out there, I'd say it would take much to get the code to work. But it won't work as it stands now, sorry.

Steve
If there is no change in 10.5 Leopard, this software would not run on OS X-the problem is that usb_detach_kernel_driver_np is not supported so that the PM4 is not detected on OS X.

User avatar
Citroen
SpamTeam
Posts: 8062
Joined: March 16th, 2006, 3:28 pm
Location: A small cave in deepest darkest Basingstoke, UK

Post by Citroen » February 12th, 2008, 4:04 pm

Steve,

I've had a go at running this on OpenSuSE 10.2 (which I just installed over SuSE9.3 on my server last weekend).

I think I've got all the pre-requisites (Qt4, Qt4-sql, etc.) installed.

I don't have a rower, but I do have a PM4 (with V101 beta2 firmware). It was a lot of fun getting the udev stuff to a) recognise a PM4 and b) set-up /dev/concept2 with perms 0666.

When I run Rowtrainer.debug it gets

Code: Select all

dougie@jerry:~/RowTrainer> ./RowTrainer.debug
./RowTrainer.debug: /usr/local/lib/libpng12.so.0: no version information available (required by /usr/lib/libQtGui.so.4)
QSqlDatabasePrivate::addDatabase: duplicate connection name 'qt_sql_default_connection', old connection removed.
QSqlDatabasePrivate::addDatabase: duplicate connection name 'qt_sql_default_connection', old connection removed.
Interface Claimed !!
Segmentation fault
dougie@jerry:~/RowTrainer>
So I ran it under gdb.

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1235915888 (LWP 11231)]
0xb7242c4e in memcpy () from /lib/libc.so.6
(gdb) info stack
#0  0xb7242c4e in memcpy () from /lib/libc.so.6
#1  0xb74b3ea8 in QString::append () from /usr/lib/libQtCore.so.4
#2  0x08054a2e in QString::operator+= (this=0xb655618c, s=@0xb6556138)
    at /usr/include/QtCore/qstring.h:212
#3  0x0805a525 in print_hex_string (string_start=0xb655623f "\001ñ\221\221ò",
    string_length=21) at RowTrainer.cpp:72
#4  0x0805a5eb in PMThread::sendReceiveFromPM (this=0xbff84970,
    sendString=0xb655623f "\001ñ\221\221ò", sendStringLength=21,
    receiveString=0xb65561e0 "`\035\033\bpIø¿hbU¶\224ä\005\b|Iø¿\025",
    receiveStringLength=@0xb6556238, command=@0xb6556234) at RowTrainer.cpp:116
#5  0x0805e566 in PMThread::PM3_extract_version_info (this=0xbff84970)
    at RowTrainer.cpp:169
#6  0x0805ef95 in PMThread::run (this=0xbff84970) at RowTrainer.cpp:730
#7  0xb74811f2 in QThread::wait () from /usr/lib/libQtCore.so.4
#8  0xb741ef8a in start_thread () from /lib/libpthread.so.0
#9  0x00000002 in ?? ()
#10 0x00000002 in ?? ()
#11 0x00000000 in ?? ()
(gdb)
The stuff I added to udev is:

Code: Select all

SUBSYSTEMS=="usb", ATTRS{idVendor}=="17a4", ATTRS{idProduct}=="0001", NAME="concept2"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="17a4", ATTRS{idProduct}=="0002", NAME="concept2", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="17a4", ATTRS{idProduct}=="0001", MODE="0666"
#SUBSYSTEMS=="usb", ATTRS{idVendor}=="17a4", ATTRS{idProduct}=="0002", MODE="0666"
PM4 has an idProduct of 0002. PM3 is 0001.

Post Reply