Begin path recording trials
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
/*
|
||||
* Length in bytes: 20
|
||||
*
|
||||
* UINT16 | UINT16 | DOUBLE | DOUBLE |
|
||||
* ---------+-------------+----------+-----------+
|
||||
* ALTITUDE | GROUNDSPEED | LATITUDE | LONGITUDE |
|
||||
*/
|
||||
class PathSegment
|
||||
{
|
||||
private:
|
||||
std::uint16_t altitude;
|
||||
std::uint16_t groundSpeed;
|
||||
double latitude;
|
||||
double longitude;
|
||||
std::vector<std::uint8_t> file;
|
||||
|
||||
public:
|
||||
PathSegment(std::uint16_t altitude,
|
||||
std::uint16_t groundSpeed,
|
||||
double latitude,
|
||||
double longitude)
|
||||
{
|
||||
this->altitude = altitude;
|
||||
|
||||
|
||||
file = std::vector<std::uint8_t>(20, 0);
|
||||
std::uint8_t *bufPtr = file.data();
|
||||
memcpy(bufPtr, &this->altitude, sizeof(this->altitude));
|
||||
bufPtr += sizeof(this->altitude);
|
||||
memcpy(bufPtr, &this->groundSpeed, sizeof(this->groundSpeed));
|
||||
bufPtr += sizeof(this->groundSpeed);
|
||||
memcpy(bufPtr, &this->latitude, sizeof(this->latitude));
|
||||
bufPtr += sizeof(this->latitude);
|
||||
memcpy(bufPtr, &this->longitude, sizeof(this->longitude));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "pathSegment.hpp"
|
||||
|
||||
class Path
|
||||
{
|
||||
private:
|
||||
std::vector<PathSegment> segments;
|
||||
|
||||
public:
|
||||
void addSegment(PathSegment segment) { segments.push_back(segment); }
|
||||
};
|
||||
Reference in New Issue
Block a user