Commit 19833c24 authored by TASTE User's avatar TASTE User

Sample for communication between quadcopter and ground

parent f670bab1
This diff is collapsed.
TASTE-Dataview DEFINITIONS ::=
BEGIN
IMPORTS T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean FROM TASTE-BasicTypes;
-- A few simple types to start with ASN.1
MyInteger ::= T-UInt8
MyReal ::= REAL (0.0 .. 1000.0)
MyBool ::= BOOLEAN
MyEnum ::= ENUMERATED { hello, world, howareyou }
MySeq ::= SEQUENCE {
input-data MyInteger,
output-data MyInteger,
validity ENUMERATED { valid, invalid }
}
MyChoice ::= CHOICE {
a BOOLEAN,
b MySeq
}
MySeqOf ::= SEQUENCE (SIZE (2)) OF MyEnum
MyOctStr ::= OCTET STRING (SIZE (3))
-- You can also declare constants
myVar MySeqOf ::= { hello, world }
-- Packet structure
ANGLE ::= REAL(-360.0 .. 360.0)
RATE ::= REAL(-100000.0 .. 100000.0)
T-UInt16 ::= INTEGER (0 .. 65535)
GYROSCOPE ::= REAL(-100000.0 .. 100000.0)
ACCELERATION ::= REAL(-16.0 .. 16.0)
HEIGHT ::= INTEGER (0 .. 8191)
GYRO-SEQ ::= SEQUENCE {
x GYROSCOPE,
y GYROSCOPE,
z GYROSCOPE
}
ACC-SEQ ::= SEQUENCE {
x ACCELERATION,
y ACCELERATION,
z ACCELERATION
}
TM-T ::= SEQUENCE {
gyro GYRO-SEQ,
acc ACC-SEQ,
z HEIGHT
}
TC-T ::= SEQUENCE {
roll ANGLE,
pitch ANGLE,
yaw RATE,
thrust T-UInt16
}
sampleMeasurement TM-T ::= { gyro { x 0.0, y 0.0, z 0.0 }, acc { x 0.0, y 0.0, z 1.0 }, z 0 }
sampleCommand TC-T ::= { roll 0.0, pitch 0.0, yaw 0.0, thrust 0 }
END
---------------------------------------------------
-- AADL2.0
-- TASTE
--
--
---------------------------------------------------
PACKAGE deploymentview::DV::Node1
PUBLIC
WITH Taste;
WITH Deployment;
WITH TASTE_DV_Properties;
PROCESS x86_partition
END x86_partition;
PROCESS IMPLEMENTATION x86_partition.others
END x86_partition.others;
END deploymentview::DV::Node1;
PACKAGE deploymentview::DV
PUBLIC
WITH ocarina_processors_x86;
WITH deploymentview::DV::Node1;
WITH Taste;
WITH Deployment;
WITH interfaceview::IV;
WITH TASTE_DV_Properties;
SYSTEM Node1
END Node1;
SYSTEM IMPLEMENTATION Node1.others
SUBCOMPONENTS
IV_Function1 : SYSTEM interfaceview::IV::Function1.others {
Taste::coordinates => "826 959 1298 1421";
Taste::FunctionName => "Function1";
};
IV_Function2 : SYSTEM interfaceview::IV::Function2.others {
Taste::coordinates => "1441 969 1949 1395";
Taste::FunctionName => "Function2";
};
x86_partition : PROCESS deploymentview::DV::Node1::x86_partition.others {
Taste::coordinates => "676 764 2186 1556";
Deployment::Port_Number => 0;
};
x86_linux32 : PROCESSOR ocarina_processors_x86::x86.linux32 {
Taste::coordinates => "487 538 2375 1669";
};
PROPERTIES
Taste::APLC_Binding => (reference (x86_partition)) APPLIES TO IV_Function1;
Taste::APLC_Binding => (reference (x86_partition)) APPLIES TO IV_Function2;
Actual_Processor_Binding => (reference (x86_linux32)) APPLIES TO x86_partition;
END Node1.others;
SYSTEM deploymentview
END deploymentview;
SYSTEM IMPLEMENTATION deploymentview.others
SUBCOMPONENTS
Node1 : SYSTEM Node1.others {
Taste::coordinates => "251 215 2611 1831";
};
interfaceview : SYSTEM interfaceview::IV::interfaceview.others;
END deploymentview.others;
PROPERTIES
Taste::coordinates => "0 0 2970 2100";
Taste::version => "1.3.19";
Taste::interfaceView => "InterfaceView.aadl";
Taste::HWLibraries => ("../../tool-inst/share/ocarina/AADLv2/ocarina_components.aadl");
END deploymentview::DV;
---------------------------------------------------
-- AADL2.0
-- TASTE
--
--
---------------------------------------------------
PACKAGE interfaceview::FV::Function1
PUBLIC
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_tick
END PI_tick;
SUBPROGRAM IMPLEMENTATION PI_tick.others
END PI_tick.others;
SUBPROGRAM PI_TM_from_CF
FEATURES
tm_data : IN PARAMETER DataView::TM_T {
Taste::encoding => NATIVE;
};
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_TM_from_CF;
SUBPROGRAM IMPLEMENTATION PI_TM_from_CF.others
END PI_TM_from_CF.others;
SUBPROGRAM RI_TC_from_TASTE
FEATURES
tc_data : IN PARAMETER DataView::TC_T {
Taste::encoding => NATIVE;
};
END RI_TC_from_TASTE;
SUBPROGRAM IMPLEMENTATION RI_TC_from_TASTE.others
END RI_TC_from_TASTE.others;
END interfaceview::FV::Function1;
PACKAGE interfaceview::FV::Function2
PUBLIC
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_TC_from_TASTE
FEATURES
tc_data : IN PARAMETER DataView::TC_T {
Taste::encoding => NATIVE;
};
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_TC_from_TASTE;
SUBPROGRAM IMPLEMENTATION PI_TC_from_TASTE.others
END PI_TC_from_TASTE.others;
SUBPROGRAM RI_TM_from_CF
FEATURES
tm_data : IN PARAMETER DataView::TM_T {
Taste::encoding => NATIVE;
};
END RI_TM_from_CF;
SUBPROGRAM IMPLEMENTATION RI_TM_from_CF.others
END RI_TM_from_CF.others;
END interfaceview::FV::Function2;
PACKAGE interfaceview::IV
PUBLIC
WITH interfaceview::FV::Function1;
WITH interfaceview::FV::Function2;
WITH interfaceview::FV;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SYSTEM Function1
FEATURES
PI_tick : PROVIDES SUBPROGRAM ACCESS interfaceview::FV::Function1::PI_tick.others {
Taste::coordinates => "939 344";
Taste::RCMoperationKind => cyclic;
Taste::RCMperiod => 100 ms;
Taste::Deadline => 0 ms;
Taste::InterfaceName => "tick";
};
PI_TM_from_CF : PROVIDES SUBPROGRAM ACCESS interfaceview::FV::Function1::PI_TM_from_CF.others {
Taste::coordinates => "1390 1185";
Taste::RCMoperationKind => sporadic;
Taste::RCMperiod => 0 ms;
Taste::Deadline => 999 ms;
Taste::InterfaceName => "TM_from_CF";
};
RI_TC_from_TASTE : REQUIRES SUBPROGRAM ACCESS interfaceview::FV::Function2::PI_TC_from_TASTE.others {
Taste::coordinates => "1390 657";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "TC_from_TASTE";
Taste::labelInheritance => "true";
};
PROPERTIES
Source_Language => (C);
END Function1;
SYSTEM IMPLEMENTATION Function1.others
SUBCOMPONENTS
tick_impl : SUBPROGRAM interfaceview::FV::Function1::PI_tick.others {
Compute_Execution_Time => 0 ms .. 0 ms;
};
TM_from_CF_impl : SUBPROGRAM interfaceview::FV::Function1::PI_TM_from_CF.others {
Compute_Execution_Time => 0 ms .. 999 ms;
};
CONNECTIONS
OpToPICnx_tick_impl : SUBPROGRAM ACCESS tick_impl -> PI_tick;
OpToPICnx_TM_from_CF_impl : SUBPROGRAM ACCESS TM_from_CF_impl -> PI_TM_from_CF;
END Function1.others;
SYSTEM Function2
FEATURES
PI_TC_from_TASTE : PROVIDES SUBPROGRAM ACCESS interfaceview::FV::Function2::PI_TC_from_TASTE.others {
Taste::coordinates => "1888 687";
Taste::RCMoperationKind => sporadic;
Taste::RCMperiod => 0 ms;
Taste::Deadline => 0 ms;
Taste::InterfaceName => "TC_from_TASTE";
};
RI_TM_from_CF : REQUIRES SUBPROGRAM ACCESS interfaceview::FV::Function1::PI_TM_from_CF.others {
Taste::coordinates => "1888 1149";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "TM_from_CF";
Taste::labelInheritance => "true";
};
PROPERTIES
Source_Language => (GUI);
END Function2;
SYSTEM IMPLEMENTATION Function2.others
SUBCOMPONENTS
TC_from_TASTE_impl : SUBPROGRAM interfaceview::FV::Function2::PI_TC_from_TASTE.others {
Compute_Execution_Time => 0 ms .. 0 ms;
};
CONNECTIONS
OpToPICnx_TC_from_TASTE_impl : SUBPROGRAM ACCESS TC_from_TASTE_impl -> PI_TC_from_TASTE;
END Function2.others;
SYSTEM interfaceview
END interfaceview;
SYSTEM IMPLEMENTATION interfaceview.others
SUBCOMPONENTS
Function1 : SYSTEM interfaceview::IV::Function1.others {
Taste::coordinates => "441 344 1390 1580";
};
Function2 : SYSTEM interfaceview::IV::Function2.others {
Taste::coordinates => "1888 364 2698 1585";
};
CONNECTIONS
Function1_TM_from_CF_Function2_TM_from_CF : SUBPROGRAM ACCESS Function1.PI_TM_from_CF -> Function2.RI_TM_from_CF {
Taste::coordinates => "1888 1149 1636 1149 1636 1185 1390 1185";
};
Function2_TC_from_TASTE_Function1_TC_from_TASTE : SUBPROGRAM ACCESS Function2.PI_TC_from_TASTE -> Function1.RI_TC_from_TASTE {
Taste::coordinates => "1390 657 1636 657 1636 687 1888 687";
};
END interfaceview.others;
PROPERTIES
Taste::dataView => ("DataView");
Taste::dataViewPath => ("DataView.aadl");
Taste::coordinates => "0 0 2970 2100";
Taste::version => "1.3.19";
END interfaceview::IV;
PACKAGE interfaceview::FV
PUBLIC
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
END interfaceview::FV;
4ee6d9fccbe5005c3133226797bdf1a3 InterfaceView.aadl
This diff is collapsed.
This diff is collapsed.
#!/bin/bash -e
# This script will build your TASTE system.
# You should not change this file as it was automatically generated.
# If you need additional preprocessing, there are three hook files
# that you can provide and that are called dring the build:
# user_init_pre.sh, user_init_post.sh and user_init_last.sh
# These files will never get overwritten by TASTE.'
# Inside these files you may set some environment variables:
# C_INCLUDE_PATH=/usr/include/xenomai/analogy/:${C_INCLUDE_PATH}
# unset USE_POHIC
CWD=$(pwd)
if [ -t 0 ] ; then
COLORON="\e[1m\e[32m"
COLOROFF="\e[0m"
else
COLORON=""
COLOROFF=""
fi
INFO="${COLORON}[INFO]${COLOROFF}"
if [ -f user_init_pre.sh ]
then
echo -e "${INFO} Executing user-defined init script"
source user_init_pre.sh
fi
# Use PolyORB-HI-C runtime
USE_POHIC=1
# Detect models from Ellidiss tools v2, and convert them to 1.3
INTERFACEVIEW=InterfaceView.aadl
grep "version => \"2" InterfaceView.aadl >/dev/null && {
echo -e "${INFO} Converting interface view from V2 to V1.3"
TASTE --load-interface-view InterfaceView.aadl --export-interface-view-to-1_3 __iv_1_3.aadl
INTERFACEVIEW=__iv_1_3.aadl
};
if [ -z "$DEPLOYMENTVIEW" ]
then
DEPLOYMENTVIEW=DeploymentView.aadl
fi
# Detect models from Ellidiss tools v2, and convert them to 1.3
grep "version => \"2" "$DEPLOYMENTVIEW" >/dev/null && {
echo -e "${INFO} Converting deployment view from V2 to V1.3"
TASTE --load-deployment-view "$DEPLOYMENTVIEW" --export-deployment-view-to-1_3 __dv_1_3.aadl
DEPLOYMENTVIEW=__dv_1_3.aadl
};
SKELS="./"
# Check if Dataview references existing files
taste-extract-asn-from-design.exe -i "$INTERFACEVIEW" -j /tmp/dv.asn
cd "$SKELS" && rm -f function1.zip && zip function1 function1/* && cd $OLDPWD
[ ! -z "$CLEANUP" ] && rm -rf binary*
if [ -f ConcurrencyView.pro ]
then
ORCHESTRATOR_OPTIONS+=" -w ConcurrencyView.pro "
fi
if [ -f user_init_post.sh ]
then
echo -e "${INFO} Executing user-defined post-init script"
source user_init_post.sh
fi
if [ ! -z "$USE_POHIC" ]
then
OUTPUTDIR=binary.c
ORCHESTRATOR_OPTIONS+=" -p "
elif [ ! -z "$USE_POHIADA" ]
then
OUTPUTDIR=binary.ada
else
OUTPUTDIR=binary
fi
cd "$CWD" && assert-builder-ocarina.py \
--fast \
--debug \
--aadlv2 \
--keep-case \
--interfaceView "$INTERFACEVIEW" \
--deploymentView "$DEPLOYMENTVIEW" \
-o "$OUTPUTDIR" \
--subC function1:"$SKELS"/function1.zip \
$ORCHESTRATOR_OPTIONS
if [ -f user_init_last.sh ]
then
echo -e "${INFO} Executing user-defined post-build script"
source user_init_last.sh
fi
#!/bin/bash -e
# This script will build your TASTE system.
# You should not change this file as it was automatically generated.
# If you need additional preprocessing, there are three hook files
# that you can provide and that are called dring the build:
# user_init_pre.sh, user_init_post.sh and user_init_last.sh
# These files will never get overwritten by TASTE.'
# Inside these files you may set some environment variables:
# C_INCLUDE_PATH=/usr/include/xenomai/analogy/:${C_INCLUDE_PATH}
# unset USE_POHIC
CWD=$(pwd)
if [ -t 0 ] ; then
COLORON="\e[1m\e[32m"
COLOROFF="\e[0m"
else
COLORON=""
COLOROFF=""
fi
INFO="${COLORON}[INFO]${COLOROFF}"
if [ -f user_init_pre.sh ]
then
echo -e "${INFO} Executing user-defined init script"
source user_init_pre.sh
fi
# Use PolyORB-HI-C runtime
USE_POHIC=1
# Detect models from Ellidiss tools v2, and convert them to 1.3
INTERFACEVIEW=InterfaceView.aadl
grep "version => \"2" InterfaceView.aadl >/dev/null && {
echo -e "${INFO} Converting interface view from V2 to V1.3"
TASTE --load-interface-view InterfaceView.aadl --export-interface-view-to-1_3 __iv_1_3.aadl
INTERFACEVIEW=__iv_1_3.aadl
};
if [ -z "$DEPLOYMENTVIEW" ]
then
DEPLOYMENTVIEW=DeploymentView.aadl
fi
# Detect models from Ellidiss tools v2, and convert them to 1.3
grep "version => \"2" "$DEPLOYMENTVIEW" >/dev/null && {
echo -e "${INFO} Converting deployment view from V2 to V1.3"
TASTE --load-deployment-view "$DEPLOYMENTVIEW" --export-deployment-view-to-1_3 __dv_1_3.aadl
DEPLOYMENTVIEW=__dv_1_3.aadl
};
SKELS="./"
# Check if Dataview references existing files
taste-extract-asn-from-design.exe -i "$INTERFACEVIEW" -j /tmp/dv.asn
cd "$SKELS" && rm -f function1.zip && zip function1 function1/* && cd $OLDPWD
[ ! -z "$CLEANUP" ] && rm -rf binary*
if [ -f ConcurrencyView.pro ]
then
ORCHESTRATOR_OPTIONS+=" -w ConcurrencyView.pro "
fi
if [ -f user_init_post.sh ]
then
echo -e "${INFO} Executing user-defined post-init script"
source user_init_post.sh
fi
if [ ! -z "$USE_POHIC" ]
then
OUTPUTDIR=binary.c
ORCHESTRATOR_OPTIONS+=" -p "
elif [ ! -z "$USE_POHIADA" ]
then
OUTPUTDIR=binary.ada
else
OUTPUTDIR=binary
fi
cd "$CWD" && assert-builder-ocarina.py \
--fast \
--debug \
--aadlv2 \
--keep-case \
--interfaceView "$INTERFACEVIEW" \
--deploymentView "$DEPLOYMENTVIEW" \
-o "$OUTPUTDIR" \
--subC function1:"$SKELS"/function1.zip \
$ORCHESTRATOR_OPTIONS
if [ -f user_init_last.sh ]
then
echo -e "${INFO} Executing user-defined post-build script"
source user_init_last.sh
fi
This diff is collapsed.
/* User code: This file will not be overwritten by TASTE. */
#include <stdio.h>
#include "function1.h"
void function1_startup()
{
/* Write your initialization code here,
but do not make any call to a required interface. */
}
void function1_PI_tick()
{
static int cnt = 0;
asn1SccTC_T commands;
commands.roll = 0.0;
commands.pitch = 0.0;
commands.yaw = 0.0;
commands.thrust = 1000;
/* Write your code here! */
function1_RI_TC_from_TASTE(&commands);
}
void function1_PI_TM_from_CF(const asn1SccTM_T *IN_tm_data)
{
/* Write your code here! */
asn1SccTM_T tm_data = *IN_tm_data;
printf("Gyro : (%.6f | %.6f | %.6f)\n", tm_data.gyro.x, tm_data.gyro.y, tm_data.gyro.z);
printf("Acc : (%.6f | %.6f | %.6f)\n", tm_data.acc.x, tm_data.acc.y, tm_data.acc.z);
printf("Height : (%d)\n\n", tm_data.z);
//fflush(stdout);
}
/* This file was generated automatically: DO NOT MODIFY IT ! */
/* Declaration of the functions that have to be provided by the user */
#ifndef __USER_CODE_H_function1__
#define __USER_CODE_H_function1__
#include "C_ASN1_Types.h"
#ifdef __cplusplus
extern "C" {
#endif
void function1_startup();
void function1_PI_tick();
void function1_PI_TM_from_CF(const asn1SccTM_T *);
extern void function1_RI_TC_from_TASTE(const asn1SccTC_T *);
#ifdef __cplusplus
}
#endif
#endif
MyReal_REQUIRED_BYTES_FOR_ENCODING = 13
MyReal_REQUIRED_BYTES_FOR_ACN_ENCODING = 13
MyReal_REQUIRED_BYTES_FOR_XER_ENCODING = 67
MyBool_REQUIRED_BYTES_FOR_ENCODING = 1
MyBool_REQUIRED_BYTES_FOR_ACN_ENCODING = 1
MyBool_REQUIRED_BYTES_FOR_XER_ENCODING = 30
MyEnum_REQUIRED_BYTES_FOR_ENCODING = 1
MyEnum_REQUIRED_BYTES_FOR_ACN_ENCODING = 1
MyEnum_REQUIRED_BYTES_FOR_XER_ENCODING = 30
MySeqOf_REQUIRED_BYTES_FOR_ENCODING = 1
MySeqOf_REQUIRED_BYTES_FOR_ACN_ENCODING = 1
MySeqOf_REQUIRED_BYTES_FOR_XER_ENCODING = 55
MyOctStr_REQUIRED_BYTES_FOR_ENCODING = 3
MyOctStr_REQUIRED_BYTES_FOR_ACN_ENCODING = 3
MyOctStr_REQUIRED_BYTES_FOR_XER_ENCODING = 27
ANGLE_REQUIRED_BYTES_FOR_ENCODING = 13