Skip to content
Snippets Groups Projects
Commit 4f3366a1 authored by Gerald Mösenlechner's avatar Gerald Mösenlechner
Browse files

Cleanup of duplicate files

parent 65d85a9b
No related branches found
No related tags found
No related merge requests found
/**
* @file HFS_Wrapper.cpp
* @author Gerald Mösenlechner (gerald.moesenlechner@univie.ac.at)
* @date May, 2022
*
* @copyright
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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.
* @brief Code for the Matlab Simulink S-function implementation example
*
*
* ## Overview
* This file contains functions to be used for the implementation of the HFS
* using the Matlab legacy code tool
*
*/
#include "../src/HFS_API.hpp"
FGS* fgsSim;
/**
* @brief Method to be used in legacy code tool of Matlab for creating FGS obj.
*
* @param config: Configuration file
*
*/
void createFGS()
{
fgsSim = new FGS("./HFS_config_model.xml");
}
/**
* @brief Method to be used in legacy code tool of Matlab for deleting FGS obj.
*
*/
void deleteFGS()
{
delete fgsSim;
}
/**
* @brief Method to be used in legacy code tool of Matlab
*
* @param fgs: FGS object to store state of simulation
* @param update: hfs parameters for update of state
*
* @return centroid packet containing the measurement
*/
void updateFGS(hfs_parameters *update, centroid_packet *output)
{
hfs_parameters u_new;
u_new.mode = update -> mode;
u_new.channel = update -> channel;
u_new.ang_rate[0] = update -> ang_rate[0];
u_new.ang_rate[1] = update -> ang_rate[1];
u_new.ang_rate[2] = update -> ang_rate[2];
u_new.position_quat[0] = update -> position_quat[0];
u_new.position_quat[1] = update -> position_quat[1];
u_new.position_quat[2] = update -> position_quat[2];
u_new.position_quat[3] = update -> position_quat[3];
u_new.time = update -> time;
u_new.reset = update -> reset;
u_new.save = update -> save;
u_new.set_invalid = update -> set_invalid;
u_new.validation_signal = update -> validation_signal;
u_new.set_error = update -> set_error;
u_new.add_shift_x = update -> add_shift_x;
u_new.add_shift_y = update -> add_shift_y;
u_new.mult_shift_x = update -> mult_shift_x;
u_new.mult_shift_y = update -> mult_shift_y;
u_new.target_pos_x = update -> target_pos_x;
u_new.target_pos_y = update -> target_pos_y;
fgsSim -> set_params(u_new, output);
}
#include "../src/HFS_API.hpp"
extern FGS *fgsSim;
extern void createFGS();
extern void deleteFGS();
extern void updateFGS(hfs_parameters*, centroid_packet*);
%% Example Simulink S-Function block of the HFS using the legacy code tool.
% The function block will have an input and an output bus that are based on the
% hfs_parameters and centroid_packet structs definded in the HFS_API. The buses
% are imported from HFS_bus.mat. The definition of the methos 'createFGS()',
% 'updateFGS' and 'deleteFGS' are given in HFS_Wrapper.cpp and HFS_Wrapper.hpp.
% Note that this example was tested in Matlab Version 2019a under Ubuntu 20.4
% and might need modification of include paths to work.
evalin('base','load HFS_bus.mat');
def = legacy_code('initialize');
def.SFunctionName = 'FGS_HFS';
def.StartFcnSpec = 'createFGS()';
def.OutputFcnSpec = 'void updateFGS(hfs_parameters u1[1], centroid_packet y1[1])';
def.TerminateFcnSpec = 'deleteFGS()';
def.HeaderFiles = {'HFS_Wrapper.hpp'};
def.SourceFiles = {'HFS_Wrapper.cpp'};
def.IncPaths = {'/usr/include'};
def.SrcPaths = {'./'};
def.HostLibFiles = {'libHFS_API.so'}
def.Options.language = 'C++';
def.Options.useTlcWithAccel = false;
legacy_code('generate_for_sim', def);
legacy_code('rtwmakecfg_generate', def);
legacy_code('slblock_generate', def);
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment