mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 08:38:45 +00:00
To be used as workouts and videosync with free Ergo Planet Videos EPM files contain video sync plus geolocation information in XML format Library of free rides: http://wiki.ergoplanet.de/myor/roadmovie-galerie The problem is altitude set to zero in those examples, likely because it is redundant when you resort to the EPP (Ergo Planet Program) for slope data, but the EPP is an unpublished binary format we don't support directly. So the workflow to use the those synchronized videos is: 1) Import the .epm file to GoldenCheetah as an activity 2) Use Fix Elevation and Fix GPS to add and smooth elevation and route data 3) Export the conditioned activity to GoldenCheetah JSON format 4) Import the .json file as Workout and VideoSync files, plus the .avi as media in GC Train mode using Scan Workouts and Media 5) Train using a Video Window with overlay widgets and simulated speed for better experience.
93 lines
3.1 KiB
C++
93 lines
3.1 KiB
C++
/*
|
|
* Copyright (c) 2020 Alejandro Martinez (amtriathlon@gmail.com)
|
|
* Based on TcxParser.cpp
|
|
*
|
|
* Copyright (c) 2008 Sean C. Rhea (srhea@srhea.net),
|
|
* J.T Conklin (jtc@acorntoolworks.com)
|
|
*
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the Free
|
|
* Software Foundation; either version 2 of the License, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
* more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc., 51
|
|
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#include <QString>
|
|
#include <QDebug>
|
|
|
|
#include "EpmParser.h"
|
|
#include "TimeUtils.h"
|
|
#include <cmath>
|
|
|
|
EpmParser::EpmParser(RideFile* rideFile) : rideFile(rideFile)
|
|
{
|
|
lastDist = 0;
|
|
lastSecs = 0;
|
|
}
|
|
|
|
bool
|
|
EpmParser::startElement(const QString&, const QString&,
|
|
const QString& qName,
|
|
const QXmlAttributes& attrs)
|
|
{
|
|
if (qName == "mapping") { // mappings
|
|
|
|
double secs = attrs.value("frame").toDouble() / framerate;
|
|
double dist = attrs.value("distance").toDouble() / 1000.0;
|
|
double speed = 3600.0*(dist - lastDist)/(secs - lastSecs);
|
|
lastSecs = secs;
|
|
lastDist = dist;
|
|
rideFile->appendPoint(secs, 0, 0, dist, speed, 0, 0, 0,
|
|
0, 0, 0, 0.0, RideFile::NA, 0.0,
|
|
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
|
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
|
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
|
|
|
|
} else if (qName == "position") { // positions
|
|
|
|
double dist = attrs.value("distance").toDouble() / 1000.0;
|
|
double lat = attrs.value("lat").toDouble();
|
|
double lon = attrs.value("lon").toDouble();
|
|
double alt = attrs.value("height").toDouble();
|
|
double secs = rideFile->distanceToTime(dist);
|
|
rideFile->appendOrUpdatePoint(secs, 0, 0, dist, 0, 0, 0, alt,
|
|
lon, lat, 0, 0.0, RideFile::NA, 0.0,
|
|
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
|
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
|
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
|
0.0, 0.0, 0, false);
|
|
}
|
|
|
|
// and clear anything left in the buffer
|
|
buffer.clear();
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
EpmParser::endElement(const QString&, const QString&, const QString& qName)
|
|
{
|
|
// METADATA
|
|
if(qName == "name") {
|
|
rideFile->setTag("Route", buffer.trimmed());
|
|
} else if(qName == "framerate") {
|
|
framerate = buffer.trimmed().toDouble();
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
EpmParser::characters(const QString& str)
|
|
{
|
|
buffer += str;
|
|
return true;
|
|
}
|