Select Git revision
example.cpp
example.cpp 6.11 KiB
#include "../src/HFS_API.hpp"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
int main()
{
using std::chrono::high_resolution_clock;
using std::chrono::duration;
using std::chrono::milliseconds;
char path[] = "./src/HFS_config.xml";
char* real_path = realpath(path, NULL);
hfs_parameters update = hfs_parameters();
outputHfs outPacket = outputHfs();
unsigned int i, ctr_tra, ctr_acq;
double time;
double sum_x_tra, sum_y_tra, sum_x_acq, sum_y_acq; /*Values for mean*/
/*Quaternion to put WASP-11 in the center of the DRF*/
/*The resuling measurement of the */
//double quat[4] = {0.8689485897529942 , 0.36411458356110155 , -0.3351849018145181, 0.0};
double vel[3] = {0.0, 0.0, 0.0};
double quat[4] = {0.8549310535429379 , -0.3147579459933313 , -0.4123352145063788 , 0.0};
/*Initialise FGS simulator by calling constructor*/
FGS fgs(real_path);
free(real_path);
sum_x_acq = 0.;
sum_y_acq = 0.;
sum_x_tra = 0.;
sum_y_tra = 0.;
ctr_acq = 0;
ctr_tra = 0;
outPacket.time = 0.;
time = 0.;
/*Parameters of the hfs_parameters input packet*/
/*Reset FGS to original state of config*/
update.reset = 0;
/*set FGS channel*/
update.channel = 1;
/*
set FGS mode: In the 'set_params function' modes are set using integers.
This is done as Simulink doesn't support the char datatype
The equiviliant modes and numbers are:
1: Acquisition
2: Tracking
Other: Standby (will result in mode 0 in the output)
*/
update.mode = 1;
/*create xml file with current state*/
update.save = 0;
/*current simulation time of the update*/
//update.time = 0;
/*mark all cantroid packets as invalid*/
update.set_invalid = 0;
update.set_error = 0;
update.time = time;
/*set shifts*/
update.add_shift_x = 0;
update.add_shift_y = 0;
update.mult_shift_x = 1;
update.mult_shift_y = 1;
update.target_pos_x = 0;