Getting real-time data
-
- Paddler
- Posts: 3
- Joined: December 15th, 2016, 6:22 am
Getting real-time data
I have an idea I'd like to spike out with my Concept2. However, I cannot find any information if I can get real-time rowing data. Is this possible? Everything I see indicates you can only download logs after the fact.
- Citroen
- SpamTeam
- Posts: 8077
- Joined: March 16th, 2006, 3:28 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: Getting real-time data
That's precisely what the CSAFE protocol gives you. You can get stroke by stroke data.
-
- Paddler
- Posts: 3
- Joined: December 15th, 2016, 6:22 am
Re: Getting real-time data
Fantastic, thank you!
- Citroen
- SpamTeam
- Posts: 8077
- Joined: March 16th, 2006, 3:28 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: Getting real-time data
There's even a Visual Basic ActiveX plugin that lets you read C2 data directly into a VB macro (which can run in an Excel spreadsheet). It's been a while since I played with that piece.
- tijmenvangulik
- 500m Poster
- Posts: 64
- Joined: November 25th, 2012, 10:24 am
Re: Getting real-time data
Most data updates on every stroke. The state changes are a bit more accurate, you can spot the beginning and ending of a stroke. The power curve can be updated live while your doing the stroke. You can see this if you enable the live power chart on my website:
http://ergometer-space.org/#
If you want to experiment with this. you can change the code behind the plugins within the website, (so no development environment required)
Tijmen
http://ergometer-space.org/#
If you want to experiment with this. you can change the code behind the plugins within the website, (so no development environment required)
Tijmen
Re: Getting real-time data
Hi tijmenvangulik,
is it possible to export to a file the data your data server records and sends to the web page ?
thanks
is it possible to export to a file the data your data server records and sends to the web page ?
thanks
- tijmenvangulik
- 500m Poster
- Posts: 64
- Joined: November 25th, 2012, 10:24 am
Re: Getting real-time data
The monitor already files some history data. This data can be viewed in the history chart widget. I have not yet made an export of the data like the power chart does do. You can alter the History widget and add an export to it. You can alter the history widget example and add an export to it.
However the history functionality stores a limited set of data:
export interface HistoryStroke {
splitTime : Date;
power : number;
strokesPerMinute : number;
workTime : Date;
workDistance : number;
}
it is possible make a widgets which stores its own history data (this way you can store more properties). If you look at the examples a widgets subscribes it selves to the data ergometer stream and then display's / stores the data when it is changed.
public visibleChanged() {
if (this.visible)
pm3.monitor.pubsubs.subStrokeDataUpdate(this, this.strokeDataUpdate)
else
pm3.monitor.pubsubs.unsubStrokeDataUpdate(this.strokeDataUpdate);
}
}
You can write your own plugins / widgets from the plugin menu (it provides a typescript/javascript based development environment for you) The easiest way to start is to install one of the example plugins and modify the code.
I have placed some documentation here:
https://ergometerspace.codeplex.com/documentation
Tijmen
However the history functionality stores a limited set of data:
export interface HistoryStroke {
splitTime : Date;
power : number;
strokesPerMinute : number;
workTime : Date;
workDistance : number;
}
it is possible make a widgets which stores its own history data (this way you can store more properties). If you look at the examples a widgets subscribes it selves to the data ergometer stream and then display's / stores the data when it is changed.
public visibleChanged() {
if (this.visible)
pm3.monitor.pubsubs.subStrokeDataUpdate(this, this.strokeDataUpdate)
else
pm3.monitor.pubsubs.unsubStrokeDataUpdate(this.strokeDataUpdate);
}
}
You can write your own plugins / widgets from the plugin menu (it provides a typescript/javascript based development environment for you) The easiest way to start is to install one of the example plugins and modify the code.
I have placed some documentation here:
https://ergometerspace.codeplex.com/documentation
Tijmen
- tijmenvangulik
- 500m Poster
- Posts: 64
- Joined: November 25th, 2012, 10:24 am
Re: Getting real-time data
Since it was only a view lines of code, I have added an simple export for you in the history widget.
The code is as simple as this:
You can convert JSON to csv using this website.
https://konklone.io/json/
It would be nice to have a direct csv export but I do not yet have time for this
The code is as simple as this:
Code: Select all
public exportData() {
if (pm3.monitor.historyCount>0) {
let exportData = [];
for(let i =0; i<pm3.monitor.historyCount;i++ ) {
let c=pm3.monitor.getHistory(i);
exportData.push(
{ "workTime": utilities.formatRelativeTime(c.workTime),
"power": c.power,
"strokesPerMinute":c.strokesPerMinute ,
"workDistance":c.workDistance,
"splitTime":utilities.formatRelativeTime(c.splitTime)
})
}
let blob = new Blob([JSON.stringify(exportData)], {type: "data:application/json;charset=utf-8"});
saveAs(blob, "History.JSON");
}
else app.showTopError("No data to export.")
}
https://konklone.io/json/
It would be nice to have a direct csv export but I do not yet have time for this
- tijmenvangulik
- 500m Poster
- Posts: 64
- Joined: November 25th, 2012, 10:24 am
Re: Getting real-time data
Just found a simple javascript json exporter. The history and the power curve widget now export in csv.
Tijmen
Tijmen