From e83fc2052b6e731439da1bf8f6dcdd4cb379c0dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 9 Dec 2021 18:07:28 +0900 Subject: [PATCH 01/80] health_pubsub app created --- workspace/health_pubsub/Makefile.inc | 27 ++++ workspace/health_pubsub/README.md | 68 ++++++++++ workspace/health_pubsub/app.cdl | 122 +++++++++++++++++ workspace/health_pubsub/app.cfg | 14 ++ workspace/health_pubsub/app.cpp | 48 +++++++ workspace/health_pubsub/app.h | 84 ++++++++++++ .../config/autosar_os_ext_asp3_user_config.c | 24 ++++ .../config/autosar_os_ext_asp3_user_config.h | 10 ++ .../config/autosar_os_ext_user_config.c | 75 +++++++++++ .../config/autosar_os_ext_user_config.h | 22 +++ .../health_pubsub/config/mros2_user_config.c | 10 ++ workspace/health_pubsub/config/task.cfg | 24 ++++ .../health_pubsub/health_msgs/msg/Health.msg | 3 + workspace/health_pubsub/msg_settings.json | 7 + workspace/health_pubsub/task_impl.c | 126 ++++++++++++++++++ workspace/health_pubsub/task_impl.h | 54 ++++++++ 16 files changed, 718 insertions(+) create mode 100644 workspace/health_pubsub/Makefile.inc create mode 100644 workspace/health_pubsub/README.md create mode 100644 workspace/health_pubsub/app.cdl create mode 100644 workspace/health_pubsub/app.cfg create mode 100644 workspace/health_pubsub/app.cpp create mode 100644 workspace/health_pubsub/app.h create mode 100644 workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.c create mode 100644 workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.h create mode 100644 workspace/health_pubsub/config/autosar_os_ext_user_config.c create mode 100644 workspace/health_pubsub/config/autosar_os_ext_user_config.h create mode 100644 workspace/health_pubsub/config/mros2_user_config.c create mode 100644 workspace/health_pubsub/config/task.cfg create mode 100644 workspace/health_pubsub/health_msgs/msg/Health.msg create mode 100644 workspace/health_pubsub/msg_settings.json create mode 100644 workspace/health_pubsub/task_impl.c create mode 100644 workspace/health_pubsub/task_impl.h diff --git a/workspace/health_pubsub/Makefile.inc b/workspace/health_pubsub/Makefile.inc new file mode 100644 index 0000000..f807ac1 --- /dev/null +++ b/workspace/health_pubsub/Makefile.inc @@ -0,0 +1,27 @@ +# +# Makefile definition for mros2 application +# + +# name of main application +APPLNAME = app + +# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) +# NOTE: also check `initLogMask` in app.cdl for syslog setting +CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 + +# information for directory tree +APPLDIR := $(APPDIR) +APPLDIR += $(APPDIR)/config + +# link option for C++ code +SRCLANG = c++ +APPL_CXXLIBS += -specs=nano.specs + +# compile switch +CDEFS += -DUSE_ASP3_FOR_STM + +# additional files for configuration +APPL_COBJS := task_impl.o +APPL_COBJS += autosar_os_ext_user_config.o +APPL_COBJS += autosar_os_ext_asp3_user_config.o +APPL_COBJS += mros2_user_config.o diff --git a/workspace/health_pubsub/README.md b/workspace/health_pubsub/README.md new file mode 100644 index 0000000..a6ee6cb --- /dev/null +++ b/workspace/health_pubsub/README.md @@ -0,0 +1,68 @@ +### EmbeddedRTPS動作確認用アプリ + +EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 +利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 + +#### LINUX側の準備 +1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします +``` +git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 +``` +2. 通信用アプリをビルドします +``` +cd embeddedRTPS-STM32 +cd linux +mkdir build +cd build +cmake -DTHIRDPARTY=ON .. +make +``` +3. PC上のファイヤウォールの設定を切ります + +#### STM側の設定 +1. IPアドレスを設定します。 +`application/src/lwip.c L69-L80` +``` + IP_ADDRESS[0] = 192; + IP_ADDRESS[1] = 168; + IP_ADDRESS[2] = 11; + IP_ADDRESS[3] = 2; + NETMASK_ADDRESS[0] = 255; + NETMASK_ADDRESS[1] = 255; + NETMASK_ADDRESS[2] = 255; + NETMASK_ADDRESS[3] = 0; + GATEWAY_ADDRESS[0] = 192; + GATEWAY_ADDRESS[1] = 168; + GATEWAY_ADDRESS[2] = 11; + GATEWAY_ADDRESS[3] = 1; + ``` +`embeddedRTPS/include/rtps/config.h L36-L37` +``` +const std::array IP_ADDRESS = { + 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. +``` +2. 本アプリをビルドします + +#### 実行 +1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します +2. ビルドしたlinuxのアプリを実行します +3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です +``` +Conducting new Test... +Send message to the STM32. +Received message from STM32 with len:10 +0 : 10 +1 : 10 +2 : 10 +3 : 10 +4 : 10 +5 : 10 +6 : 10 +7 : 10 +8 : 10 +9 : 10 + +Conducting new Test... +Send message to the STM32. + +``` diff --git a/workspace/health_pubsub/app.cdl b/workspace/health_pubsub/app.cdl new file mode 100644 index 0000000..176c5a6 --- /dev/null +++ b/workspace/health_pubsub/app.cdl @@ -0,0 +1,122 @@ +/* + * サンプルプログラム(1)のコンポーネント記述ファイル + * + * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ + */ +/* + * カーネルオブジェクトの定義 + */ +import(); + +/* + * ターゲット非依存のセルタイプの定義 + */ +import("syssvc/tSerialPort.cdl"); +import("syssvc/tSerialAdapter.cdl"); +import("syssvc/tSysLog.cdl"); +import("syssvc/tSysLogAdapter.cdl"); +import("syssvc/tLogTask.cdl"); +import("syssvc/tBanner.cdl"); + +/* + * ターゲット依存部の取り込み + */ +import("target.cdl"); + +/* + * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" + * の行までのことを言う. + */ + +/* + * システムログ機能のアダプタの組上げ記述 + * + * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー + * スのシステムログ機能を呼び出すためのセルである.システムログ機能の + * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び + * 出さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSysLogAdapter SysLogAdapter { + cSysLog = SysLog.eSysLog; +}; + +/* + * シリアルインタフェースドライバのアダプタの組上げ記述 + * + * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー + * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための + * セルである.シリアルインタフェースドライバのサービスコールを呼び出 + * さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSerialAdapter SerialAdapter { + cSerialPort[0] = SerialPort1.eSerialPort; +}; + +/* + * システムログ機能の組上げ記述 + * + * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ + * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, + * システムログタスクはシステムログ機能を使用するため,それも外すこと + * が必要である.また,システムログ機能のアダプタも外さなければならな + * い.tecsgenが警告メッセージを出すが,無視してよい. + */ +cell tSysLog SysLog { + logBufferSize = 32; /* ログバッファのサイズ */ + initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); + /* ログバッファに記録すべき重要度 */ + initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); + /* 低レベル出力すべき重要度 */ + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * シリアルインタフェースドライバの組上げ記述 + * + * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 + * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー + * スドライバを使用するため,それも外すことが必要である.また,シリア + * ルインタフェースドライバのアダプタも外さなければならない. + */ +cell tSerialPort SerialPort1 { + receiveBufferSize = 256; /* 受信バッファのサイズ */ + sendBufferSize = 256; /* 送信バッファのサイズ */ + + /* ターゲット依存部との結合 */ + cSIOPort = SIOPortTarget1.eSIOPort; + eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ +}; + +/* + * システムログタスクの組上げ記述 + * + * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ + * ばよい. + */ +cell tLogTask LogTask { + priority = 3; /* システムログタスクの優先度 */ + stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ + + /* シリアルインタフェースドライバとの結合 */ + cSerialPort = SerialPort1.eSerialPort; + cnSerialPortManage = SerialPort1.enSerialPortManage; + + /* システムログ機能との結合 */ + cSysLog = SysLog.eSysLog; + + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * カーネル起動メッセージ出力の組上げ記述 + * + * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 + * を削除すればよい. + */ +cell tBanner Banner { + /* 属性の設定 */ + targetName = BannerTargetName; + copyrightNotice = BannerCopyrightNotice; +}; diff --git a/workspace/health_pubsub/app.cfg b/workspace/health_pubsub/app.cfg new file mode 100644 index 0000000..eb0495d --- /dev/null +++ b/workspace/health_pubsub/app.cfg @@ -0,0 +1,14 @@ +/* + * サンプルプログラム(1)のシステムコンフィギュレーションファイル + */ +INCLUDE("tecsgen.cfg"); +INCLUDE("asp3ext.cfg"); +INCLUDE("task.cfg"); + +#include "app.h" +#include "stm32f7xx_it.h" +CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); +CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); +CFG_INT(77, {TA_EDGE, -4}); + +CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/health_pubsub/app.cpp b/workspace/health_pubsub/app.cpp new file mode 100644 index 0000000..4244c24 --- /dev/null +++ b/workspace/health_pubsub/app.cpp @@ -0,0 +1,48 @@ +#include "app.h" +#include "mros2.h" +#include "health_msgs/msg/health.hpp" + +#include "stm32f7xx_nucleo_144.h" + +mros2::Subscriber sub; +mros2::Publisher pub; + +void userCallback(health_msgs::msg::Health *msg) +{ + if (63 < msg->weight && msg->weight < 64) { + MROS2_INFO("subscribed msg: { name: '%s', height: %d cm, weight: 63.5 kg }", msg->name.c_str(), msg->height); + } else { + MROS2_INFO("subscribed msg: { name: '%s', height: %d cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); + MROS2_INFO("publishing msg: { name: '%s', height: %d cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); + } + pub.publish(*msg); +} + +int main(int argc, char * argv[]) +{ + MROS2_INFO("mROS 2 application is started"); + + mros2::init(argc, argv); + MROS2_DEBUG("mROS 2 initialization is completed"); + BSP_LED_Toggle(LED1); + + mros2::Node node = mros2::Node::create_node("mros2_node"); + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + health_msgs::msg::Health msg; + + MROS2_INFO("ready to pub/sub message"); + mros2::spin(); + BSP_LED_Toggle(LED3); +} + +void main_task(void) +{ + main(0, NULL); +} + +void +led_cyclic_handler(intptr_t exinf) +{ + BSP_LED_Toggle(LED2); +} \ No newline at end of file diff --git a/workspace/health_pubsub/app.h b/workspace/health_pubsub/app.h new file mode 100644 index 0000000..36eb6cf --- /dev/null +++ b/workspace/health_pubsub/app.h @@ -0,0 +1,84 @@ +/* + * TOPPERS/ASP Kernel + * Toyohashi Open Platform for Embedded Real-Time Systems/ + * Advanced Standard Profile Kernel + * + * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory + * Toyohashi Univ. of Technology, JAPAN + * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory + * Graduate School of Information Science, Nagoya Univ., JAPAN + * + * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ + * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 + * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. + * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 + * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー + * スコード中に含まれていること. + * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 + * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 + * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 + * の無保証規定を掲載すること. + * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 + * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ + * と. + * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 + * 作権表示,この利用条件および下記の無保証規定を掲載すること. + * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに + * 報告すること. + * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 + * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. + * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 + * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを + * 免責すること. + * + * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お + * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 + * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ + * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ + * の責任を負わない. + * + * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ + */ + +/* + * header file for the mros2 application + */ + +#include + +/* + * Priorities for TOPPERS tasks + */ + +#define MAIN_PRIORITY 5 + +#define HIGH_PRIORITY 9 +#define MID_PRIORITY 10 +#define LOW_PRIORITY 11 + +/* + * Constants that may depend on the target + */ + +#ifndef TASK_PORTID +#define TASK_PORTID 1 +#endif /* TASK_PORTID */ + +#ifndef STACK_SIZE +#define STACK_SIZE 4096 +#endif /* STACK_SIZE */ + +/* + * Declaration of prototyle functions + */ +#ifndef TOPPERS_MACRO_ONLY +#ifdef __cplusplus +extern "C" { +#endif +void main_task(void); +extern void led_cyclic_handler(intptr_t exinf); +#ifdef __cplusplus +} +#endif +void Error_Handler(); +#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.c b/workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.c new file mode 100644 index 0000000..41ef1da --- /dev/null +++ b/workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.c @@ -0,0 +1,24 @@ +#include "autosar_os_ext_asp3_user_config.h" + +const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), +}; + +const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) +{ + return autosar_os_ext_flag_user_map; +} + +int cmsis_get_flag_user_num(void) +{ + return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; +} diff --git a/workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.h b/workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.h new file mode 100644 index 0000000..7ad08bf --- /dev/null +++ b/workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.h @@ -0,0 +1,10 @@ +#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ + +#include "cmsis_config_utl.h" + +#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) + +extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; + +#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/health_pubsub/config/autosar_os_ext_user_config.c b/workspace/health_pubsub/config/autosar_os_ext_user_config.c new file mode 100644 index 0000000..940941b --- /dev/null +++ b/workspace/health_pubsub/config/autosar_os_ext_user_config.c @@ -0,0 +1,75 @@ +#include "cmsis_os.h" +#include "autosar_os_ext_user_config.h" + +extern void tcpip_thread(void *arg); +extern void ethernetif_set_link(void* argument); +extern void ethernetif_input(void* argument); +extern void callHbPubFunc(void *arg); +extern void callHbSubFunc(void *arg); +extern void StartDefaultTask(void * argument); +extern void callWriterThreadFunction(void *arg); +extern void callReaderThreadFunction(void *arg); +extern void callRunBroadcast(void *args); +extern void mros2_init(void *args); + + +UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { + { + .taskID = AutosarOsExtTcpTask, + .func = tcpip_thread, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthIfLinkTask, + .func = ethernetif_set_link, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthInputTask, + .func = ethernetif_input, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBPubTask, + .func = callHbPubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBSubTask, + .func = callHbSubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtSPDPTask, + .func = callRunBroadcast, + .argument = NULL, + }, + { + .taskID = AutosarOsExtWriterTask, + .func = callWriterThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtReaderTask, + .func = callReaderThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtMROS2Task, + .func = mros2_init, + .argument = NULL, + }, +}; + +UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) +{ + return user_thread_autosar_ostask_map; +} +int cmsis_get_app_heap_size(void) +{ + return APP_HEAP_SIZE; +} +int cmsis_get_user_thread_num(void) +{ + return USER_THREAD_NUM; +} diff --git a/workspace/health_pubsub/config/autosar_os_ext_user_config.h b/workspace/health_pubsub/config/autosar_os_ext_user_config.h new file mode 100644 index 0000000..bab78d3 --- /dev/null +++ b/workspace/health_pubsub/config/autosar_os_ext_user_config.h @@ -0,0 +1,22 @@ +#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ + +#include "cmsis_os.h" +#include "cmsis_config_utl.h" + +/*********************************************** + * + * MEMORY + * + ***********************************************/ +#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ + + +/*********************************************** + * + * THREAD + * + ***********************************************/ +#define USER_THREAD_NUM 9U + +#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/health_pubsub/config/mros2_user_config.c b/workspace/health_pubsub/config/mros2_user_config.c new file mode 100644 index 0000000..7d2c110 --- /dev/null +++ b/workspace/health_pubsub/config/mros2_user_config.c @@ -0,0 +1,10 @@ + + +#define SUB_MSG_COUNT 10 + +int mros2_get_submsg_count(void) +{ + return SUB_MSG_COUNT; +} + + diff --git a/workspace/health_pubsub/config/task.cfg b/workspace/health_pubsub/config/task.cfg new file mode 100644 index 0000000..f577110 --- /dev/null +++ b/workspace/health_pubsub/config/task.cfg @@ -0,0 +1,24 @@ +#include "task_impl.h" + +CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); +CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); +CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); +CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); +CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); +CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); +CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); +CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); +CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); +CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); + +CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/health_pubsub/health_msgs/msg/Health.msg b/workspace/health_pubsub/health_msgs/msg/Health.msg new file mode 100644 index 0000000..b22ff81 --- /dev/null +++ b/workspace/health_pubsub/health_msgs/msg/Health.msg @@ -0,0 +1,3 @@ +string name +uint16 height +float32 weight \ No newline at end of file diff --git a/workspace/health_pubsub/msg_settings.json b/workspace/health_pubsub/msg_settings.json new file mode 100644 index 0000000..7096df7 --- /dev/null +++ b/workspace/health_pubsub/msg_settings.json @@ -0,0 +1,7 @@ +{ + "includingMsgs": [ + "health_msgs/msg/Health.msg" + ], + "dependingPkgs": [ + ] +} \ No newline at end of file diff --git a/workspace/health_pubsub/task_impl.c b/workspace/health_pubsub/task_impl.c new file mode 100644 index 0000000..afb9fca --- /dev/null +++ b/workspace/health_pubsub/task_impl.c @@ -0,0 +1,126 @@ +#include "cmsis_os.h" +#include "cmsis_config_utl.h" +#include "task_impl.h" + +TASK(AutosarOsExtTcpTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthIfLinkTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthInputTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBPubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBSubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtSPDPTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtWriterTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtReaderTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtUserDefaultTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtMROS2Task) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} diff --git a/workspace/health_pubsub/task_impl.h b/workspace/health_pubsub/task_impl.h new file mode 100644 index 0000000..11e7a81 --- /dev/null +++ b/workspace/health_pubsub/task_impl.h @@ -0,0 +1,54 @@ +#ifndef _AUTOSAR_OS_EXT_TEST_H_ +#define _AUTOSAR_OS_EXT_TEST_H_ + +#include "cmsis_config_utl.h" + +extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); + +/* + * priorities of mROS 2 tasks for RTPS + * + * TODO: We assigned relatevely lower priorities for EthIfLinkTask and + * EthInputTask than the application. Check whether these are appropriate. + */ +#define MROS2_HIGH_PRIORITY MAIN_PRIORITY +#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 + +/* + * experimental: stack size of mROS 2 tasks for RTPS + * Each comment refers the location of original definition + */ +// application/include/lwipopt.h +// #define TCPIP_THREAD_STACKSIZE 1024 +#define MROS2_STACK_SIZE_TcpTask 1024 +// application/src/lwip.c +// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) +#define MROS2_STACK_SIZE_EthIfLinkTask 1024 +// application/src/ethernet.c +// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) +#define MROS2_STACK_SIZE_EthInputTask 350 +// embeddedRTPS/include/config.h +// const int HEARTBEAT_STACKSIZE = 1200; // byte +#define MROS2_STACK_SIZE_HBPubTask 1200 +#define MROS2_STACK_SIZE_HBSubTask 1200 +// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte +#define MROS2_STACK_SIZE_SPDPTask 550 +// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte +#define MROS2_STACK_SIZE_WriterTask 1100 +// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte +#define MROS2_STACK_SIZE_ReaderTask 1600 +// embeddedRTPS-STM32/stm32/Src/main.cpp +// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); +#define MROS2_STACK_SIZE_UserDefaultTask 250 + + +#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ From 76a444f339a29c9b11c66b88dbcb79971dc183f9 Mon Sep 17 00:00:00 2001 From: Yoichiro Hibara <51713871+Hibagon1go@users.noreply.github.com> Date: Thu, 9 Dec 2021 18:07:54 +0900 Subject: [PATCH 02/80] Delete settings.json --- .vscode/settings.json | 64 ------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 9d3c022..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "files.associations": { - "__bit_reference": "cpp", - "__config": "cpp", - "__debug": "cpp", - "__errc": "cpp", - "__functional_base": "cpp", - "__hash_table": "cpp", - "__locale": "cpp", - "__mutex_base": "cpp", - "__node_handle": "cpp", - "__nullptr": "cpp", - "__split_buffer": "cpp", - "__string": "cpp", - "__threading_support": "cpp", - "__tuple": "cpp", - "algorithm": "cpp", - "array": "cpp", - "atomic": "cpp", - "bit": "cpp", - "bitset": "cpp", - "cctype": "cpp", - "chrono": "cpp", - "cmath": "cpp", - "complex": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdint": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "exception": "cpp", - "functional": "cpp", - "initializer_list": "cpp", - "ios": "cpp", - "iosfwd": "cpp", - "istream": "cpp", - "iterator": "cpp", - "limits": "cpp", - "locale": "cpp", - "memory": "cpp", - "mutex": "cpp", - "new": "cpp", - "optional": "cpp", - "ostream": "cpp", - "ratio": "cpp", - "sstream": "cpp", - "stdexcept": "cpp", - "streambuf": "cpp", - "string": "cpp", - "string_view": "cpp", - "system_error": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "typeinfo": "cpp", - "unordered_map": "cpp", - "utility": "cpp", - "vector": "cpp", - "iostream": "cpp" - } -} \ No newline at end of file From 365f8dc4583dc174316ffb314dcb11206ae413a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 9 Dec 2021 18:50:32 +0900 Subject: [PATCH 03/80] health_pubsub app fixed --- workspace/health_pubsub/app.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workspace/health_pubsub/app.cpp b/workspace/health_pubsub/app.cpp index 4244c24..34f2f3a 100644 --- a/workspace/health_pubsub/app.cpp +++ b/workspace/health_pubsub/app.cpp @@ -10,10 +10,10 @@ mros2::Publisher pub; void userCallback(health_msgs::msg::Health *msg) { if (63 < msg->weight && msg->weight < 64) { - MROS2_INFO("subscribed msg: { name: '%s', height: %d cm, weight: 63.5 kg }", msg->name.c_str(), msg->height); + MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: 63.5 kg }", msg->name.c_str(), msg->height); } else { - MROS2_INFO("subscribed msg: { name: '%s', height: %d cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); - MROS2_INFO("publishing msg: { name: '%s', height: %d cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); + MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); + MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); } pub.publish(*msg); } From db1a8acfbc7125b1d5cd0790af0f8d022bd9caad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 9 Dec 2021 19:55:14 +0900 Subject: [PATCH 04/80] health_pubsub app fixed --- workspace/health_pubsub/app.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/health_pubsub/app.cpp b/workspace/health_pubsub/app.cpp index 34f2f3a..607a30c 100644 --- a/workspace/health_pubsub/app.cpp +++ b/workspace/health_pubsub/app.cpp @@ -9,7 +9,7 @@ mros2::Publisher pub; void userCallback(health_msgs::msg::Health *msg) { - if (63 < msg->weight && msg->weight < 64) { + if (msg->weight==63.5) { MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: 63.5 kg }", msg->name.c_str(), msg->height); } else { MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); From 929b226303fcaa0a38f512d2274d52ea1475ee83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 9 Dec 2021 20:26:37 +0900 Subject: [PATCH 05/80] health_pubsub app fixed --- workspace/health_pubsub/app.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/workspace/health_pubsub/app.cpp b/workspace/health_pubsub/app.cpp index 607a30c..afff2ab 100644 --- a/workspace/health_pubsub/app.cpp +++ b/workspace/health_pubsub/app.cpp @@ -11,6 +11,7 @@ void userCallback(health_msgs::msg::Health *msg) { if (msg->weight==63.5) { MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: 63.5 kg }", msg->name.c_str(), msg->height); + MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: 63.5 kg }", msg->name.c_str(), msg->height); } else { MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); From 8df880607e4a7a314ac2ee7ed36df1d2ac37dcbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 9 Dec 2021 23:03:13 +0900 Subject: [PATCH 06/80] health_pubsub app modified for debug --- workspace/health_pubsub/app.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/health_pubsub/app.cpp b/workspace/health_pubsub/app.cpp index afff2ab..505bea7 100644 --- a/workspace/health_pubsub/app.cpp +++ b/workspace/health_pubsub/app.cpp @@ -16,7 +16,7 @@ void userCallback(health_msgs::msg::Health *msg) MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); } - pub.publish(*msg); + //pub.publish(*msg); } int main(int argc, char * argv[]) From d04653c63ae4dd0b8df95a6ece2f7471d0c18551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 9 Dec 2021 23:30:23 +0900 Subject: [PATCH 07/80] health_pubsub app modified for debug --- workspace/health_pubsub/app.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/health_pubsub/app.cpp b/workspace/health_pubsub/app.cpp index 505bea7..afff2ab 100644 --- a/workspace/health_pubsub/app.cpp +++ b/workspace/health_pubsub/app.cpp @@ -16,7 +16,7 @@ void userCallback(health_msgs::msg::Health *msg) MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); } - //pub.publish(*msg); + pub.publish(*msg); } int main(int argc, char * argv[]) From 1b7db4efcd63b60c5715c932e48cfd90569fbb44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Fri, 10 Dec 2021 09:19:09 +0900 Subject: [PATCH 08/80] location_pubsub app created --- workspace/location_pubsub/Makefile.inc | 27 ++++ workspace/location_pubsub/README.md | 68 ++++++++++ workspace/location_pubsub/app.cdl | 122 +++++++++++++++++ workspace/location_pubsub/app.cfg | 14 ++ workspace/location_pubsub/app.cpp | 44 ++++++ workspace/location_pubsub/app.h | 84 ++++++++++++ .../config/autosar_os_ext_asp3_user_config.c | 24 ++++ .../config/autosar_os_ext_asp3_user_config.h | 10 ++ .../config/autosar_os_ext_user_config.c | 75 +++++++++++ .../config/autosar_os_ext_user_config.h | 22 +++ .../config/mros2_user_config.c | 10 ++ workspace/location_pubsub/config/task.cfg | 24 ++++ .../location_msgs/msg/Location.msg | 3 + workspace/location_pubsub/msg_settings.json | 7 + workspace/location_pubsub/task_impl.c | 126 ++++++++++++++++++ workspace/location_pubsub/task_impl.h | 54 ++++++++ 16 files changed, 714 insertions(+) create mode 100644 workspace/location_pubsub/Makefile.inc create mode 100644 workspace/location_pubsub/README.md create mode 100644 workspace/location_pubsub/app.cdl create mode 100644 workspace/location_pubsub/app.cfg create mode 100644 workspace/location_pubsub/app.cpp create mode 100644 workspace/location_pubsub/app.h create mode 100644 workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.c create mode 100644 workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.h create mode 100644 workspace/location_pubsub/config/autosar_os_ext_user_config.c create mode 100644 workspace/location_pubsub/config/autosar_os_ext_user_config.h create mode 100644 workspace/location_pubsub/config/mros2_user_config.c create mode 100644 workspace/location_pubsub/config/task.cfg create mode 100644 workspace/location_pubsub/location_msgs/msg/Location.msg create mode 100644 workspace/location_pubsub/msg_settings.json create mode 100644 workspace/location_pubsub/task_impl.c create mode 100644 workspace/location_pubsub/task_impl.h diff --git a/workspace/location_pubsub/Makefile.inc b/workspace/location_pubsub/Makefile.inc new file mode 100644 index 0000000..f807ac1 --- /dev/null +++ b/workspace/location_pubsub/Makefile.inc @@ -0,0 +1,27 @@ +# +# Makefile definition for mros2 application +# + +# name of main application +APPLNAME = app + +# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) +# NOTE: also check `initLogMask` in app.cdl for syslog setting +CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 + +# information for directory tree +APPLDIR := $(APPDIR) +APPLDIR += $(APPDIR)/config + +# link option for C++ code +SRCLANG = c++ +APPL_CXXLIBS += -specs=nano.specs + +# compile switch +CDEFS += -DUSE_ASP3_FOR_STM + +# additional files for configuration +APPL_COBJS := task_impl.o +APPL_COBJS += autosar_os_ext_user_config.o +APPL_COBJS += autosar_os_ext_asp3_user_config.o +APPL_COBJS += mros2_user_config.o diff --git a/workspace/location_pubsub/README.md b/workspace/location_pubsub/README.md new file mode 100644 index 0000000..a6ee6cb --- /dev/null +++ b/workspace/location_pubsub/README.md @@ -0,0 +1,68 @@ +### EmbeddedRTPS動作確認用アプリ + +EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 +利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 + +#### LINUX側の準備 +1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします +``` +git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 +``` +2. 通信用アプリをビルドします +``` +cd embeddedRTPS-STM32 +cd linux +mkdir build +cd build +cmake -DTHIRDPARTY=ON .. +make +``` +3. PC上のファイヤウォールの設定を切ります + +#### STM側の設定 +1. IPアドレスを設定します。 +`application/src/lwip.c L69-L80` +``` + IP_ADDRESS[0] = 192; + IP_ADDRESS[1] = 168; + IP_ADDRESS[2] = 11; + IP_ADDRESS[3] = 2; + NETMASK_ADDRESS[0] = 255; + NETMASK_ADDRESS[1] = 255; + NETMASK_ADDRESS[2] = 255; + NETMASK_ADDRESS[3] = 0; + GATEWAY_ADDRESS[0] = 192; + GATEWAY_ADDRESS[1] = 168; + GATEWAY_ADDRESS[2] = 11; + GATEWAY_ADDRESS[3] = 1; + ``` +`embeddedRTPS/include/rtps/config.h L36-L37` +``` +const std::array IP_ADDRESS = { + 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. +``` +2. 本アプリをビルドします + +#### 実行 +1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します +2. ビルドしたlinuxのアプリを実行します +3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です +``` +Conducting new Test... +Send message to the STM32. +Received message from STM32 with len:10 +0 : 10 +1 : 10 +2 : 10 +3 : 10 +4 : 10 +5 : 10 +6 : 10 +7 : 10 +8 : 10 +9 : 10 + +Conducting new Test... +Send message to the STM32. + +``` diff --git a/workspace/location_pubsub/app.cdl b/workspace/location_pubsub/app.cdl new file mode 100644 index 0000000..176c5a6 --- /dev/null +++ b/workspace/location_pubsub/app.cdl @@ -0,0 +1,122 @@ +/* + * サンプルプログラム(1)のコンポーネント記述ファイル + * + * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ + */ +/* + * カーネルオブジェクトの定義 + */ +import(); + +/* + * ターゲット非依存のセルタイプの定義 + */ +import("syssvc/tSerialPort.cdl"); +import("syssvc/tSerialAdapter.cdl"); +import("syssvc/tSysLog.cdl"); +import("syssvc/tSysLogAdapter.cdl"); +import("syssvc/tLogTask.cdl"); +import("syssvc/tBanner.cdl"); + +/* + * ターゲット依存部の取り込み + */ +import("target.cdl"); + +/* + * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" + * の行までのことを言う. + */ + +/* + * システムログ機能のアダプタの組上げ記述 + * + * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー + * スのシステムログ機能を呼び出すためのセルである.システムログ機能の + * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び + * 出さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSysLogAdapter SysLogAdapter { + cSysLog = SysLog.eSysLog; +}; + +/* + * シリアルインタフェースドライバのアダプタの組上げ記述 + * + * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー + * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための + * セルである.シリアルインタフェースドライバのサービスコールを呼び出 + * さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSerialAdapter SerialAdapter { + cSerialPort[0] = SerialPort1.eSerialPort; +}; + +/* + * システムログ機能の組上げ記述 + * + * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ + * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, + * システムログタスクはシステムログ機能を使用するため,それも外すこと + * が必要である.また,システムログ機能のアダプタも外さなければならな + * い.tecsgenが警告メッセージを出すが,無視してよい. + */ +cell tSysLog SysLog { + logBufferSize = 32; /* ログバッファのサイズ */ + initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); + /* ログバッファに記録すべき重要度 */ + initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); + /* 低レベル出力すべき重要度 */ + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * シリアルインタフェースドライバの組上げ記述 + * + * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 + * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー + * スドライバを使用するため,それも外すことが必要である.また,シリア + * ルインタフェースドライバのアダプタも外さなければならない. + */ +cell tSerialPort SerialPort1 { + receiveBufferSize = 256; /* 受信バッファのサイズ */ + sendBufferSize = 256; /* 送信バッファのサイズ */ + + /* ターゲット依存部との結合 */ + cSIOPort = SIOPortTarget1.eSIOPort; + eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ +}; + +/* + * システムログタスクの組上げ記述 + * + * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ + * ばよい. + */ +cell tLogTask LogTask { + priority = 3; /* システムログタスクの優先度 */ + stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ + + /* シリアルインタフェースドライバとの結合 */ + cSerialPort = SerialPort1.eSerialPort; + cnSerialPortManage = SerialPort1.enSerialPortManage; + + /* システムログ機能との結合 */ + cSysLog = SysLog.eSysLog; + + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * カーネル起動メッセージ出力の組上げ記述 + * + * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 + * を削除すればよい. + */ +cell tBanner Banner { + /* 属性の設定 */ + targetName = BannerTargetName; + copyrightNotice = BannerCopyrightNotice; +}; diff --git a/workspace/location_pubsub/app.cfg b/workspace/location_pubsub/app.cfg new file mode 100644 index 0000000..eb0495d --- /dev/null +++ b/workspace/location_pubsub/app.cfg @@ -0,0 +1,14 @@ +/* + * サンプルプログラム(1)のシステムコンフィギュレーションファイル + */ +INCLUDE("tecsgen.cfg"); +INCLUDE("asp3ext.cfg"); +INCLUDE("task.cfg"); + +#include "app.h" +#include "stm32f7xx_it.h" +CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); +CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); +CFG_INT(77, {TA_EDGE, -4}); + +CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/location_pubsub/app.cpp b/workspace/location_pubsub/app.cpp new file mode 100644 index 0000000..a20f7bf --- /dev/null +++ b/workspace/location_pubsub/app.cpp @@ -0,0 +1,44 @@ +#include "app.h" +#include "mros2.h" +#include "location_msgs/msg/location.hpp" + +#include "stm32f7xx_nucleo_144.h" + +mros2::Subscriber sub; +mros2::Publisher pub; + +void userCallback(location_msgs::msg::Location *msg) +{ + MROS2_INFO("subscribed msg: { x: %d, y: %d, z: %d }", msg->x, msg->y, msg->z); + MROS2_INFO("publishing msg: { x: %d, y: %d, z: %d }", msg->x, msg->y, msg->z); + pub.publish(*msg); +} + +int main(int argc, char * argv[]) +{ + MROS2_INFO("mROS 2 application is started"); + + mros2::init(argc, argv); + MROS2_DEBUG("mROS 2 initialization is completed"); + BSP_LED_Toggle(LED1); + + mros2::Node node = mros2::Node::create_node("mros2_node"); + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + location_msgs::msg::Location msg; + + MROS2_INFO("ready to pub/sub message"); + mros2::spin(); + BSP_LED_Toggle(LED3); +} + +void main_task(void) +{ + main(0, NULL); +} + +void +led_cyclic_handler(intptr_t exinf) +{ + BSP_LED_Toggle(LED2); +} \ No newline at end of file diff --git a/workspace/location_pubsub/app.h b/workspace/location_pubsub/app.h new file mode 100644 index 0000000..36eb6cf --- /dev/null +++ b/workspace/location_pubsub/app.h @@ -0,0 +1,84 @@ +/* + * TOPPERS/ASP Kernel + * Toyohashi Open Platform for Embedded Real-Time Systems/ + * Advanced Standard Profile Kernel + * + * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory + * Toyohashi Univ. of Technology, JAPAN + * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory + * Graduate School of Information Science, Nagoya Univ., JAPAN + * + * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ + * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 + * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. + * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 + * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー + * スコード中に含まれていること. + * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 + * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 + * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 + * の無保証規定を掲載すること. + * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 + * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ + * と. + * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 + * 作権表示,この利用条件および下記の無保証規定を掲載すること. + * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに + * 報告すること. + * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 + * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. + * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 + * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを + * 免責すること. + * + * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お + * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 + * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ + * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ + * の責任を負わない. + * + * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ + */ + +/* + * header file for the mros2 application + */ + +#include + +/* + * Priorities for TOPPERS tasks + */ + +#define MAIN_PRIORITY 5 + +#define HIGH_PRIORITY 9 +#define MID_PRIORITY 10 +#define LOW_PRIORITY 11 + +/* + * Constants that may depend on the target + */ + +#ifndef TASK_PORTID +#define TASK_PORTID 1 +#endif /* TASK_PORTID */ + +#ifndef STACK_SIZE +#define STACK_SIZE 4096 +#endif /* STACK_SIZE */ + +/* + * Declaration of prototyle functions + */ +#ifndef TOPPERS_MACRO_ONLY +#ifdef __cplusplus +extern "C" { +#endif +void main_task(void); +extern void led_cyclic_handler(intptr_t exinf); +#ifdef __cplusplus +} +#endif +void Error_Handler(); +#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.c b/workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.c new file mode 100644 index 0000000..41ef1da --- /dev/null +++ b/workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.c @@ -0,0 +1,24 @@ +#include "autosar_os_ext_asp3_user_config.h" + +const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), +}; + +const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) +{ + return autosar_os_ext_flag_user_map; +} + +int cmsis_get_flag_user_num(void) +{ + return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; +} diff --git a/workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.h b/workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.h new file mode 100644 index 0000000..7ad08bf --- /dev/null +++ b/workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.h @@ -0,0 +1,10 @@ +#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ + +#include "cmsis_config_utl.h" + +#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) + +extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; + +#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/location_pubsub/config/autosar_os_ext_user_config.c b/workspace/location_pubsub/config/autosar_os_ext_user_config.c new file mode 100644 index 0000000..940941b --- /dev/null +++ b/workspace/location_pubsub/config/autosar_os_ext_user_config.c @@ -0,0 +1,75 @@ +#include "cmsis_os.h" +#include "autosar_os_ext_user_config.h" + +extern void tcpip_thread(void *arg); +extern void ethernetif_set_link(void* argument); +extern void ethernetif_input(void* argument); +extern void callHbPubFunc(void *arg); +extern void callHbSubFunc(void *arg); +extern void StartDefaultTask(void * argument); +extern void callWriterThreadFunction(void *arg); +extern void callReaderThreadFunction(void *arg); +extern void callRunBroadcast(void *args); +extern void mros2_init(void *args); + + +UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { + { + .taskID = AutosarOsExtTcpTask, + .func = tcpip_thread, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthIfLinkTask, + .func = ethernetif_set_link, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthInputTask, + .func = ethernetif_input, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBPubTask, + .func = callHbPubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBSubTask, + .func = callHbSubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtSPDPTask, + .func = callRunBroadcast, + .argument = NULL, + }, + { + .taskID = AutosarOsExtWriterTask, + .func = callWriterThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtReaderTask, + .func = callReaderThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtMROS2Task, + .func = mros2_init, + .argument = NULL, + }, +}; + +UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) +{ + return user_thread_autosar_ostask_map; +} +int cmsis_get_app_heap_size(void) +{ + return APP_HEAP_SIZE; +} +int cmsis_get_user_thread_num(void) +{ + return USER_THREAD_NUM; +} diff --git a/workspace/location_pubsub/config/autosar_os_ext_user_config.h b/workspace/location_pubsub/config/autosar_os_ext_user_config.h new file mode 100644 index 0000000..bab78d3 --- /dev/null +++ b/workspace/location_pubsub/config/autosar_os_ext_user_config.h @@ -0,0 +1,22 @@ +#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ + +#include "cmsis_os.h" +#include "cmsis_config_utl.h" + +/*********************************************** + * + * MEMORY + * + ***********************************************/ +#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ + + +/*********************************************** + * + * THREAD + * + ***********************************************/ +#define USER_THREAD_NUM 9U + +#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/location_pubsub/config/mros2_user_config.c b/workspace/location_pubsub/config/mros2_user_config.c new file mode 100644 index 0000000..7d2c110 --- /dev/null +++ b/workspace/location_pubsub/config/mros2_user_config.c @@ -0,0 +1,10 @@ + + +#define SUB_MSG_COUNT 10 + +int mros2_get_submsg_count(void) +{ + return SUB_MSG_COUNT; +} + + diff --git a/workspace/location_pubsub/config/task.cfg b/workspace/location_pubsub/config/task.cfg new file mode 100644 index 0000000..f577110 --- /dev/null +++ b/workspace/location_pubsub/config/task.cfg @@ -0,0 +1,24 @@ +#include "task_impl.h" + +CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); +CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); +CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); +CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); +CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); +CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); +CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); +CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); +CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); +CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); + +CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/location_pubsub/location_msgs/msg/Location.msg b/workspace/location_pubsub/location_msgs/msg/Location.msg new file mode 100644 index 0000000..c69a678 --- /dev/null +++ b/workspace/location_pubsub/location_msgs/msg/Location.msg @@ -0,0 +1,3 @@ +int16 x +int16 y +int16 z \ No newline at end of file diff --git a/workspace/location_pubsub/msg_settings.json b/workspace/location_pubsub/msg_settings.json new file mode 100644 index 0000000..7096df7 --- /dev/null +++ b/workspace/location_pubsub/msg_settings.json @@ -0,0 +1,7 @@ +{ + "includingMsgs": [ + "health_msgs/msg/Health.msg" + ], + "dependingPkgs": [ + ] +} \ No newline at end of file diff --git a/workspace/location_pubsub/task_impl.c b/workspace/location_pubsub/task_impl.c new file mode 100644 index 0000000..afb9fca --- /dev/null +++ b/workspace/location_pubsub/task_impl.c @@ -0,0 +1,126 @@ +#include "cmsis_os.h" +#include "cmsis_config_utl.h" +#include "task_impl.h" + +TASK(AutosarOsExtTcpTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthIfLinkTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthInputTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBPubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBSubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtSPDPTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtWriterTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtReaderTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtUserDefaultTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtMROS2Task) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} diff --git a/workspace/location_pubsub/task_impl.h b/workspace/location_pubsub/task_impl.h new file mode 100644 index 0000000..11e7a81 --- /dev/null +++ b/workspace/location_pubsub/task_impl.h @@ -0,0 +1,54 @@ +#ifndef _AUTOSAR_OS_EXT_TEST_H_ +#define _AUTOSAR_OS_EXT_TEST_H_ + +#include "cmsis_config_utl.h" + +extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); + +/* + * priorities of mROS 2 tasks for RTPS + * + * TODO: We assigned relatevely lower priorities for EthIfLinkTask and + * EthInputTask than the application. Check whether these are appropriate. + */ +#define MROS2_HIGH_PRIORITY MAIN_PRIORITY +#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 + +/* + * experimental: stack size of mROS 2 tasks for RTPS + * Each comment refers the location of original definition + */ +// application/include/lwipopt.h +// #define TCPIP_THREAD_STACKSIZE 1024 +#define MROS2_STACK_SIZE_TcpTask 1024 +// application/src/lwip.c +// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) +#define MROS2_STACK_SIZE_EthIfLinkTask 1024 +// application/src/ethernet.c +// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) +#define MROS2_STACK_SIZE_EthInputTask 350 +// embeddedRTPS/include/config.h +// const int HEARTBEAT_STACKSIZE = 1200; // byte +#define MROS2_STACK_SIZE_HBPubTask 1200 +#define MROS2_STACK_SIZE_HBSubTask 1200 +// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte +#define MROS2_STACK_SIZE_SPDPTask 550 +// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte +#define MROS2_STACK_SIZE_WriterTask 1100 +// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte +#define MROS2_STACK_SIZE_ReaderTask 1600 +// embeddedRTPS-STM32/stm32/Src/main.cpp +// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); +#define MROS2_STACK_SIZE_UserDefaultTask 250 + + +#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ From 3d1372b29344b070ce3954544128f6ef5a1637b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Fri, 10 Dec 2021 09:23:15 +0900 Subject: [PATCH 09/80] location_pubsub app created --- workspace/location_pubsub/msg_settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/location_pubsub/msg_settings.json b/workspace/location_pubsub/msg_settings.json index 7096df7..fb54130 100644 --- a/workspace/location_pubsub/msg_settings.json +++ b/workspace/location_pubsub/msg_settings.json @@ -1,6 +1,6 @@ { "includingMsgs": [ - "health_msgs/msg/Health.msg" + "location_msgs/msg/Location.msg" ], "dependingPkgs": [ ] From 1ead4caef54b718b114eb768f1dd9341f4e81074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:17:23 +0900 Subject: [PATCH 10/80] health_pubsub app modified for debug --- workspace/health_pubsub/app.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/health_pubsub/app.cpp b/workspace/health_pubsub/app.cpp index afff2ab..505bea7 100644 --- a/workspace/health_pubsub/app.cpp +++ b/workspace/health_pubsub/app.cpp @@ -16,7 +16,7 @@ void userCallback(health_msgs::msg::Health *msg) MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); } - pub.publish(*msg); + //pub.publish(*msg); } int main(int argc, char * argv[]) From cc565282ef7a99d8ad8a42d5a86ca9c85ffc3dd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:29:47 +0900 Subject: [PATCH 11/80] health_pubsub app modified for debug --- workspace/health_pubsub/app.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/health_pubsub/app.cpp b/workspace/health_pubsub/app.cpp index 505bea7..afff2ab 100644 --- a/workspace/health_pubsub/app.cpp +++ b/workspace/health_pubsub/app.cpp @@ -16,7 +16,7 @@ void userCallback(health_msgs::msg::Health *msg) MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); } - //pub.publish(*msg); + pub.publish(*msg); } int main(int argc, char * argv[]) From e86eb5e809eee8ad8337a4376f3b606f4fa1cc68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 16:02:22 +0900 Subject: [PATCH 12/80] health_pubsub app modified for debug --- workspace/health_pubsub/app.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/workspace/health_pubsub/app.cpp b/workspace/health_pubsub/app.cpp index afff2ab..3597d6b 100644 --- a/workspace/health_pubsub/app.cpp +++ b/workspace/health_pubsub/app.cpp @@ -10,11 +10,21 @@ mros2::Publisher pub; void userCallback(health_msgs::msg::Health *msg) { if (msg->weight==63.5) { + if (msg->name=='Hi'){ + MROS2_INFO("subscribed msg: { name: 'Hi', height: %u cm, weight: 63.5 kg }", msg->height); + MROS2_INFO("publishing msg: { name: 'Hi', height: %u cm, weight: 63.5 kg }", msg->height); + } else { MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: 63.5 kg }", msg->name.c_str(), msg->height); MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: 63.5 kg }", msg->name.c_str(), msg->height); + } } else { + if (msg->name=='Hi'){ + MROS2_INFO("subscribed msg: { name: 'Hi', height: %u cm, weight: %f kg }", msg->height, msg->weight); + MROS2_INFO("publishing msg: { name: 'Hi', height: %u cm, weight: %f kg }", msg->height, msg->weight); + } else { MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); + } } pub.publish(*msg); } From c55740ade08dbc0eb0c46f9878d7131bbcb644cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 16:04:32 +0900 Subject: [PATCH 13/80] health_pubsub app modified for debug --- workspace/health_pubsub/app.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workspace/health_pubsub/app.cpp b/workspace/health_pubsub/app.cpp index 3597d6b..64339d9 100644 --- a/workspace/health_pubsub/app.cpp +++ b/workspace/health_pubsub/app.cpp @@ -10,7 +10,7 @@ mros2::Publisher pub; void userCallback(health_msgs::msg::Health *msg) { if (msg->weight==63.5) { - if (msg->name=='Hi'){ + if (msg->name=="Hi"){ MROS2_INFO("subscribed msg: { name: 'Hi', height: %u cm, weight: 63.5 kg }", msg->height); MROS2_INFO("publishing msg: { name: 'Hi', height: %u cm, weight: 63.5 kg }", msg->height); } else { @@ -18,7 +18,7 @@ void userCallback(health_msgs::msg::Health *msg) MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: 63.5 kg }", msg->name.c_str(), msg->height); } } else { - if (msg->name=='Hi'){ + if (msg->name=="Hi"){ MROS2_INFO("subscribed msg: { name: 'Hi', height: %u cm, weight: %f kg }", msg->height, msg->weight); MROS2_INFO("publishing msg: { name: 'Hi', height: %u cm, weight: %f kg }", msg->height, msg->weight); } else { From 471b91931307157b3d8016318631c22a3fc8e8cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sun, 12 Dec 2021 11:12:36 +0900 Subject: [PATCH 14/80] health_pubsub app modified for debug --- workspace/health_pubsub/app.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/health_pubsub/app.cpp b/workspace/health_pubsub/app.cpp index 64339d9..9eaf8b3 100644 --- a/workspace/health_pubsub/app.cpp +++ b/workspace/health_pubsub/app.cpp @@ -18,7 +18,7 @@ void userCallback(health_msgs::msg::Health *msg) MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: 63.5 kg }", msg->name.c_str(), msg->height); } } else { - if (msg->name=="Hi"){ + if (msg->name=="Hi"){ MROS2_INFO("subscribed msg: { name: 'Hi', height: %u cm, weight: %f kg }", msg->height, msg->weight); MROS2_INFO("publishing msg: { name: 'Hi', height: %u cm, weight: %f kg }", msg->height, msg->weight); } else { From 2db6bffce8da60e3a4da40d6050861c99f25b195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 15 Dec 2021 15:34:58 +0900 Subject: [PATCH 15/80] health/location pubsub create_subscription fixed --- workspace/health_pubsub/app.cpp | 2 +- workspace/location_pubsub/app.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/workspace/health_pubsub/app.cpp b/workspace/health_pubsub/app.cpp index 9eaf8b3..67fd1f7 100644 --- a/workspace/health_pubsub/app.cpp +++ b/workspace/health_pubsub/app.cpp @@ -39,7 +39,7 @@ int main(int argc, char * argv[]) mros2::Node node = mros2::Node::create_node("mros2_node"); pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); + sub = node.create_subscription("to_stm", 10, userCallback); health_msgs::msg::Health msg; MROS2_INFO("ready to pub/sub message"); diff --git a/workspace/location_pubsub/app.cpp b/workspace/location_pubsub/app.cpp index a20f7bf..a73deec 100644 --- a/workspace/location_pubsub/app.cpp +++ b/workspace/location_pubsub/app.cpp @@ -24,7 +24,7 @@ int main(int argc, char * argv[]) mros2::Node node = mros2::Node::create_node("mros2_node"); pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); + sub = node.create_subscription("to_stm", 10, userCallback); location_msgs::msg::Location msg; MROS2_INFO("ready to pub/sub message"); From 78b9d1ead641964754b793f20b895c3b1f53ec8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 13:42:26 +0900 Subject: [PATCH 16/80] health_pubsub modified for debug --- workspace/health_pubsub/app.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/health_pubsub/app.cpp b/workspace/health_pubsub/app.cpp index 67fd1f7..b32fd65 100644 --- a/workspace/health_pubsub/app.cpp +++ b/workspace/health_pubsub/app.cpp @@ -26,7 +26,7 @@ void userCallback(health_msgs::msg::Health *msg) MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); } } - pub.publish(*msg); + //pub.publish(*msg); } int main(int argc, char * argv[]) From 9079ca8ec9530ff68b61b0a325ef2bcb46b47431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 13:51:19 +0900 Subject: [PATCH 17/80] float_location app added --- workspace/float_location_pubsub/Makefile.inc | 27 ++++ workspace/float_location_pubsub/README.md | 68 ++++++++++ workspace/float_location_pubsub/app.cdl | 122 +++++++++++++++++ workspace/float_location_pubsub/app.cfg | 14 ++ workspace/float_location_pubsub/app.cpp | 44 ++++++ workspace/float_location_pubsub/app.h | 84 ++++++++++++ .../config/autosar_os_ext_asp3_user_config.c | 24 ++++ .../config/autosar_os_ext_asp3_user_config.h | 10 ++ .../config/autosar_os_ext_user_config.c | 75 +++++++++++ .../config/autosar_os_ext_user_config.h | 22 +++ .../config/mros2_user_config.c | 10 ++ .../float_location_pubsub/config/task.cfg | 24 ++++ .../float_location_msgs/msg/FloatLocation.msg | 3 + .../float_location_pubsub/msg_settings.json | 7 + workspace/float_location_pubsub/task_impl.c | 126 ++++++++++++++++++ workspace/float_location_pubsub/task_impl.h | 54 ++++++++ 16 files changed, 714 insertions(+) create mode 100644 workspace/float_location_pubsub/Makefile.inc create mode 100644 workspace/float_location_pubsub/README.md create mode 100644 workspace/float_location_pubsub/app.cdl create mode 100644 workspace/float_location_pubsub/app.cfg create mode 100644 workspace/float_location_pubsub/app.cpp create mode 100644 workspace/float_location_pubsub/app.h create mode 100644 workspace/float_location_pubsub/config/autosar_os_ext_asp3_user_config.c create mode 100644 workspace/float_location_pubsub/config/autosar_os_ext_asp3_user_config.h create mode 100644 workspace/float_location_pubsub/config/autosar_os_ext_user_config.c create mode 100644 workspace/float_location_pubsub/config/autosar_os_ext_user_config.h create mode 100644 workspace/float_location_pubsub/config/mros2_user_config.c create mode 100644 workspace/float_location_pubsub/config/task.cfg create mode 100644 workspace/float_location_pubsub/float_location_msgs/msg/FloatLocation.msg create mode 100644 workspace/float_location_pubsub/msg_settings.json create mode 100644 workspace/float_location_pubsub/task_impl.c create mode 100644 workspace/float_location_pubsub/task_impl.h diff --git a/workspace/float_location_pubsub/Makefile.inc b/workspace/float_location_pubsub/Makefile.inc new file mode 100644 index 0000000..f807ac1 --- /dev/null +++ b/workspace/float_location_pubsub/Makefile.inc @@ -0,0 +1,27 @@ +# +# Makefile definition for mros2 application +# + +# name of main application +APPLNAME = app + +# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) +# NOTE: also check `initLogMask` in app.cdl for syslog setting +CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 + +# information for directory tree +APPLDIR := $(APPDIR) +APPLDIR += $(APPDIR)/config + +# link option for C++ code +SRCLANG = c++ +APPL_CXXLIBS += -specs=nano.specs + +# compile switch +CDEFS += -DUSE_ASP3_FOR_STM + +# additional files for configuration +APPL_COBJS := task_impl.o +APPL_COBJS += autosar_os_ext_user_config.o +APPL_COBJS += autosar_os_ext_asp3_user_config.o +APPL_COBJS += mros2_user_config.o diff --git a/workspace/float_location_pubsub/README.md b/workspace/float_location_pubsub/README.md new file mode 100644 index 0000000..a6ee6cb --- /dev/null +++ b/workspace/float_location_pubsub/README.md @@ -0,0 +1,68 @@ +### EmbeddedRTPS動作確認用アプリ + +EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 +利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 + +#### LINUX側の準備 +1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします +``` +git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 +``` +2. 通信用アプリをビルドします +``` +cd embeddedRTPS-STM32 +cd linux +mkdir build +cd build +cmake -DTHIRDPARTY=ON .. +make +``` +3. PC上のファイヤウォールの設定を切ります + +#### STM側の設定 +1. IPアドレスを設定します。 +`application/src/lwip.c L69-L80` +``` + IP_ADDRESS[0] = 192; + IP_ADDRESS[1] = 168; + IP_ADDRESS[2] = 11; + IP_ADDRESS[3] = 2; + NETMASK_ADDRESS[0] = 255; + NETMASK_ADDRESS[1] = 255; + NETMASK_ADDRESS[2] = 255; + NETMASK_ADDRESS[3] = 0; + GATEWAY_ADDRESS[0] = 192; + GATEWAY_ADDRESS[1] = 168; + GATEWAY_ADDRESS[2] = 11; + GATEWAY_ADDRESS[3] = 1; + ``` +`embeddedRTPS/include/rtps/config.h L36-L37` +``` +const std::array IP_ADDRESS = { + 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. +``` +2. 本アプリをビルドします + +#### 実行 +1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します +2. ビルドしたlinuxのアプリを実行します +3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です +``` +Conducting new Test... +Send message to the STM32. +Received message from STM32 with len:10 +0 : 10 +1 : 10 +2 : 10 +3 : 10 +4 : 10 +5 : 10 +6 : 10 +7 : 10 +8 : 10 +9 : 10 + +Conducting new Test... +Send message to the STM32. + +``` diff --git a/workspace/float_location_pubsub/app.cdl b/workspace/float_location_pubsub/app.cdl new file mode 100644 index 0000000..176c5a6 --- /dev/null +++ b/workspace/float_location_pubsub/app.cdl @@ -0,0 +1,122 @@ +/* + * サンプルプログラム(1)のコンポーネント記述ファイル + * + * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ + */ +/* + * カーネルオブジェクトの定義 + */ +import(); + +/* + * ターゲット非依存のセルタイプの定義 + */ +import("syssvc/tSerialPort.cdl"); +import("syssvc/tSerialAdapter.cdl"); +import("syssvc/tSysLog.cdl"); +import("syssvc/tSysLogAdapter.cdl"); +import("syssvc/tLogTask.cdl"); +import("syssvc/tBanner.cdl"); + +/* + * ターゲット依存部の取り込み + */ +import("target.cdl"); + +/* + * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" + * の行までのことを言う. + */ + +/* + * システムログ機能のアダプタの組上げ記述 + * + * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー + * スのシステムログ機能を呼び出すためのセルである.システムログ機能の + * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び + * 出さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSysLogAdapter SysLogAdapter { + cSysLog = SysLog.eSysLog; +}; + +/* + * シリアルインタフェースドライバのアダプタの組上げ記述 + * + * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー + * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための + * セルである.シリアルインタフェースドライバのサービスコールを呼び出 + * さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSerialAdapter SerialAdapter { + cSerialPort[0] = SerialPort1.eSerialPort; +}; + +/* + * システムログ機能の組上げ記述 + * + * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ + * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, + * システムログタスクはシステムログ機能を使用するため,それも外すこと + * が必要である.また,システムログ機能のアダプタも外さなければならな + * い.tecsgenが警告メッセージを出すが,無視してよい. + */ +cell tSysLog SysLog { + logBufferSize = 32; /* ログバッファのサイズ */ + initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); + /* ログバッファに記録すべき重要度 */ + initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); + /* 低レベル出力すべき重要度 */ + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * シリアルインタフェースドライバの組上げ記述 + * + * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 + * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー + * スドライバを使用するため,それも外すことが必要である.また,シリア + * ルインタフェースドライバのアダプタも外さなければならない. + */ +cell tSerialPort SerialPort1 { + receiveBufferSize = 256; /* 受信バッファのサイズ */ + sendBufferSize = 256; /* 送信バッファのサイズ */ + + /* ターゲット依存部との結合 */ + cSIOPort = SIOPortTarget1.eSIOPort; + eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ +}; + +/* + * システムログタスクの組上げ記述 + * + * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ + * ばよい. + */ +cell tLogTask LogTask { + priority = 3; /* システムログタスクの優先度 */ + stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ + + /* シリアルインタフェースドライバとの結合 */ + cSerialPort = SerialPort1.eSerialPort; + cnSerialPortManage = SerialPort1.enSerialPortManage; + + /* システムログ機能との結合 */ + cSysLog = SysLog.eSysLog; + + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * カーネル起動メッセージ出力の組上げ記述 + * + * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 + * を削除すればよい. + */ +cell tBanner Banner { + /* 属性の設定 */ + targetName = BannerTargetName; + copyrightNotice = BannerCopyrightNotice; +}; diff --git a/workspace/float_location_pubsub/app.cfg b/workspace/float_location_pubsub/app.cfg new file mode 100644 index 0000000..eb0495d --- /dev/null +++ b/workspace/float_location_pubsub/app.cfg @@ -0,0 +1,14 @@ +/* + * サンプルプログラム(1)のシステムコンフィギュレーションファイル + */ +INCLUDE("tecsgen.cfg"); +INCLUDE("asp3ext.cfg"); +INCLUDE("task.cfg"); + +#include "app.h" +#include "stm32f7xx_it.h" +CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); +CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); +CFG_INT(77, {TA_EDGE, -4}); + +CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/float_location_pubsub/app.cpp b/workspace/float_location_pubsub/app.cpp new file mode 100644 index 0000000..c16a5ba --- /dev/null +++ b/workspace/float_location_pubsub/app.cpp @@ -0,0 +1,44 @@ +#include "app.h" +#include "mros2.h" +#include "float_location_msgs/msg/float_location.hpp" + +#include "stm32f7xx_nucleo_144.h" + +mros2::Subscriber sub; +mros2::Publisher pub; + +void userCallback(float_location_msgs::msg::FloatLocation *msg) +{ + MROS2_INFO("subscribed msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); + MROS2_INFO("publishing msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); + pub.publish(*msg); +} + +int main(int argc, char * argv[]) +{ + MROS2_INFO("mROS 2 application is started"); + + mros2::init(argc, argv); + MROS2_DEBUG("mROS 2 initialization is completed"); + BSP_LED_Toggle(LED1); + + mros2::Node node = mros2::Node::create_node("mros2_node"); + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + float_location_msgs::msg::FloatLocation msg; + + MROS2_INFO("ready to pub/sub message"); + mros2::spin(); + BSP_LED_Toggle(LED3); +} + +void main_task(void) +{ + main(0, NULL); +} + +void +led_cyclic_handler(intptr_t exinf) +{ + BSP_LED_Toggle(LED2); +} \ No newline at end of file diff --git a/workspace/float_location_pubsub/app.h b/workspace/float_location_pubsub/app.h new file mode 100644 index 0000000..36eb6cf --- /dev/null +++ b/workspace/float_location_pubsub/app.h @@ -0,0 +1,84 @@ +/* + * TOPPERS/ASP Kernel + * Toyohashi Open Platform for Embedded Real-Time Systems/ + * Advanced Standard Profile Kernel + * + * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory + * Toyohashi Univ. of Technology, JAPAN + * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory + * Graduate School of Information Science, Nagoya Univ., JAPAN + * + * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ + * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 + * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. + * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 + * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー + * スコード中に含まれていること. + * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 + * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 + * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 + * の無保証規定を掲載すること. + * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 + * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ + * と. + * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 + * 作権表示,この利用条件および下記の無保証規定を掲載すること. + * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに + * 報告すること. + * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 + * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. + * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 + * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを + * 免責すること. + * + * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お + * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 + * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ + * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ + * の責任を負わない. + * + * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ + */ + +/* + * header file for the mros2 application + */ + +#include + +/* + * Priorities for TOPPERS tasks + */ + +#define MAIN_PRIORITY 5 + +#define HIGH_PRIORITY 9 +#define MID_PRIORITY 10 +#define LOW_PRIORITY 11 + +/* + * Constants that may depend on the target + */ + +#ifndef TASK_PORTID +#define TASK_PORTID 1 +#endif /* TASK_PORTID */ + +#ifndef STACK_SIZE +#define STACK_SIZE 4096 +#endif /* STACK_SIZE */ + +/* + * Declaration of prototyle functions + */ +#ifndef TOPPERS_MACRO_ONLY +#ifdef __cplusplus +extern "C" { +#endif +void main_task(void); +extern void led_cyclic_handler(intptr_t exinf); +#ifdef __cplusplus +} +#endif +void Error_Handler(); +#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/float_location_pubsub/config/autosar_os_ext_asp3_user_config.c b/workspace/float_location_pubsub/config/autosar_os_ext_asp3_user_config.c new file mode 100644 index 0000000..41ef1da --- /dev/null +++ b/workspace/float_location_pubsub/config/autosar_os_ext_asp3_user_config.c @@ -0,0 +1,24 @@ +#include "autosar_os_ext_asp3_user_config.h" + +const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), +}; + +const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) +{ + return autosar_os_ext_flag_user_map; +} + +int cmsis_get_flag_user_num(void) +{ + return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; +} diff --git a/workspace/float_location_pubsub/config/autosar_os_ext_asp3_user_config.h b/workspace/float_location_pubsub/config/autosar_os_ext_asp3_user_config.h new file mode 100644 index 0000000..7ad08bf --- /dev/null +++ b/workspace/float_location_pubsub/config/autosar_os_ext_asp3_user_config.h @@ -0,0 +1,10 @@ +#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ + +#include "cmsis_config_utl.h" + +#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) + +extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; + +#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/float_location_pubsub/config/autosar_os_ext_user_config.c b/workspace/float_location_pubsub/config/autosar_os_ext_user_config.c new file mode 100644 index 0000000..940941b --- /dev/null +++ b/workspace/float_location_pubsub/config/autosar_os_ext_user_config.c @@ -0,0 +1,75 @@ +#include "cmsis_os.h" +#include "autosar_os_ext_user_config.h" + +extern void tcpip_thread(void *arg); +extern void ethernetif_set_link(void* argument); +extern void ethernetif_input(void* argument); +extern void callHbPubFunc(void *arg); +extern void callHbSubFunc(void *arg); +extern void StartDefaultTask(void * argument); +extern void callWriterThreadFunction(void *arg); +extern void callReaderThreadFunction(void *arg); +extern void callRunBroadcast(void *args); +extern void mros2_init(void *args); + + +UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { + { + .taskID = AutosarOsExtTcpTask, + .func = tcpip_thread, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthIfLinkTask, + .func = ethernetif_set_link, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthInputTask, + .func = ethernetif_input, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBPubTask, + .func = callHbPubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBSubTask, + .func = callHbSubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtSPDPTask, + .func = callRunBroadcast, + .argument = NULL, + }, + { + .taskID = AutosarOsExtWriterTask, + .func = callWriterThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtReaderTask, + .func = callReaderThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtMROS2Task, + .func = mros2_init, + .argument = NULL, + }, +}; + +UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) +{ + return user_thread_autosar_ostask_map; +} +int cmsis_get_app_heap_size(void) +{ + return APP_HEAP_SIZE; +} +int cmsis_get_user_thread_num(void) +{ + return USER_THREAD_NUM; +} diff --git a/workspace/float_location_pubsub/config/autosar_os_ext_user_config.h b/workspace/float_location_pubsub/config/autosar_os_ext_user_config.h new file mode 100644 index 0000000..bab78d3 --- /dev/null +++ b/workspace/float_location_pubsub/config/autosar_os_ext_user_config.h @@ -0,0 +1,22 @@ +#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ + +#include "cmsis_os.h" +#include "cmsis_config_utl.h" + +/*********************************************** + * + * MEMORY + * + ***********************************************/ +#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ + + +/*********************************************** + * + * THREAD + * + ***********************************************/ +#define USER_THREAD_NUM 9U + +#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/float_location_pubsub/config/mros2_user_config.c b/workspace/float_location_pubsub/config/mros2_user_config.c new file mode 100644 index 0000000..7d2c110 --- /dev/null +++ b/workspace/float_location_pubsub/config/mros2_user_config.c @@ -0,0 +1,10 @@ + + +#define SUB_MSG_COUNT 10 + +int mros2_get_submsg_count(void) +{ + return SUB_MSG_COUNT; +} + + diff --git a/workspace/float_location_pubsub/config/task.cfg b/workspace/float_location_pubsub/config/task.cfg new file mode 100644 index 0000000..f577110 --- /dev/null +++ b/workspace/float_location_pubsub/config/task.cfg @@ -0,0 +1,24 @@ +#include "task_impl.h" + +CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); +CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); +CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); +CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); +CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); +CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); +CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); +CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); +CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); +CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); + +CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/float_location_pubsub/float_location_msgs/msg/FloatLocation.msg b/workspace/float_location_pubsub/float_location_msgs/msg/FloatLocation.msg new file mode 100644 index 0000000..0fb5429 --- /dev/null +++ b/workspace/float_location_pubsub/float_location_msgs/msg/FloatLocation.msg @@ -0,0 +1,3 @@ +float32 x +float32 y +float32 z \ No newline at end of file diff --git a/workspace/float_location_pubsub/msg_settings.json b/workspace/float_location_pubsub/msg_settings.json new file mode 100644 index 0000000..fb54130 --- /dev/null +++ b/workspace/float_location_pubsub/msg_settings.json @@ -0,0 +1,7 @@ +{ + "includingMsgs": [ + "location_msgs/msg/Location.msg" + ], + "dependingPkgs": [ + ] +} \ No newline at end of file diff --git a/workspace/float_location_pubsub/task_impl.c b/workspace/float_location_pubsub/task_impl.c new file mode 100644 index 0000000..afb9fca --- /dev/null +++ b/workspace/float_location_pubsub/task_impl.c @@ -0,0 +1,126 @@ +#include "cmsis_os.h" +#include "cmsis_config_utl.h" +#include "task_impl.h" + +TASK(AutosarOsExtTcpTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthIfLinkTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthInputTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBPubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBSubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtSPDPTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtWriterTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtReaderTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtUserDefaultTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtMROS2Task) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} diff --git a/workspace/float_location_pubsub/task_impl.h b/workspace/float_location_pubsub/task_impl.h new file mode 100644 index 0000000..11e7a81 --- /dev/null +++ b/workspace/float_location_pubsub/task_impl.h @@ -0,0 +1,54 @@ +#ifndef _AUTOSAR_OS_EXT_TEST_H_ +#define _AUTOSAR_OS_EXT_TEST_H_ + +#include "cmsis_config_utl.h" + +extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); + +/* + * priorities of mROS 2 tasks for RTPS + * + * TODO: We assigned relatevely lower priorities for EthIfLinkTask and + * EthInputTask than the application. Check whether these are appropriate. + */ +#define MROS2_HIGH_PRIORITY MAIN_PRIORITY +#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 + +/* + * experimental: stack size of mROS 2 tasks for RTPS + * Each comment refers the location of original definition + */ +// application/include/lwipopt.h +// #define TCPIP_THREAD_STACKSIZE 1024 +#define MROS2_STACK_SIZE_TcpTask 1024 +// application/src/lwip.c +// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) +#define MROS2_STACK_SIZE_EthIfLinkTask 1024 +// application/src/ethernet.c +// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) +#define MROS2_STACK_SIZE_EthInputTask 350 +// embeddedRTPS/include/config.h +// const int HEARTBEAT_STACKSIZE = 1200; // byte +#define MROS2_STACK_SIZE_HBPubTask 1200 +#define MROS2_STACK_SIZE_HBSubTask 1200 +// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte +#define MROS2_STACK_SIZE_SPDPTask 550 +// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte +#define MROS2_STACK_SIZE_WriterTask 1100 +// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte +#define MROS2_STACK_SIZE_ReaderTask 1600 +// embeddedRTPS-STM32/stm32/Src/main.cpp +// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); +#define MROS2_STACK_SIZE_UserDefaultTask 250 + + +#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ From a196fcc7095ca1020145cdf45e309d08a4b0919f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 13:54:01 +0900 Subject: [PATCH 18/80] float_location app added --- workspace/float_location_pubsub/msg_settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/float_location_pubsub/msg_settings.json b/workspace/float_location_pubsub/msg_settings.json index fb54130..6c64d29 100644 --- a/workspace/float_location_pubsub/msg_settings.json +++ b/workspace/float_location_pubsub/msg_settings.json @@ -1,6 +1,6 @@ { "includingMsgs": [ - "location_msgs/msg/Location.msg" + "float_location_msgs/msg/FloatLocation.msg" ], "dependingPkgs": [ ] From 953eb76bb5c0b5e0019d4aa07ac0bf287dc8b921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 13:58:10 +0900 Subject: [PATCH 19/80] float_location app added --- workspace/float_location_pubsub/app.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/float_location_pubsub/app.cpp b/workspace/float_location_pubsub/app.cpp index c16a5ba..e827c3c 100644 --- a/workspace/float_location_pubsub/app.cpp +++ b/workspace/float_location_pubsub/app.cpp @@ -1,6 +1,6 @@ #include "app.h" #include "mros2.h" -#include "float_location_msgs/msg/float_location.hpp" +#include "float_location_msgs/msg/floatlocation.hpp" #include "stm32f7xx_nucleo_144.h" From ebe60b17f7681531e328b032b18a9a88909877be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 14:16:01 +0900 Subject: [PATCH 20/80] float_location app added --- workspace/float_location_pubsub/app.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/float_location_pubsub/app.cpp b/workspace/float_location_pubsub/app.cpp index e827c3c..c16a5ba 100644 --- a/workspace/float_location_pubsub/app.cpp +++ b/workspace/float_location_pubsub/app.cpp @@ -1,6 +1,6 @@ #include "app.h" #include "mros2.h" -#include "float_location_msgs/msg/floatlocation.hpp" +#include "float_location_msgs/msg/float_location.hpp" #include "stm32f7xx_nucleo_144.h" From 2e426b2c84b1effcd688629976de8b091874330c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 14:42:21 +0900 Subject: [PATCH 21/80] float_location app added --- workspace/float_location_pubsub/app.cpp | 10 +++++----- .../msg/Flocation.msg} | 0 workspace/float_location_pubsub/msg_settings.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) rename workspace/float_location_pubsub/{float_location_msgs/msg/FloatLocation.msg => flocation_msgs/msg/Flocation.msg} (100%) diff --git a/workspace/float_location_pubsub/app.cpp b/workspace/float_location_pubsub/app.cpp index c16a5ba..aca5fe3 100644 --- a/workspace/float_location_pubsub/app.cpp +++ b/workspace/float_location_pubsub/app.cpp @@ -1,13 +1,13 @@ #include "app.h" #include "mros2.h" -#include "float_location_msgs/msg/float_location.hpp" +#include "flocation_msgs/msg/flocation.hpp" #include "stm32f7xx_nucleo_144.h" mros2::Subscriber sub; mros2::Publisher pub; -void userCallback(float_location_msgs::msg::FloatLocation *msg) +void userCallback(flocation_msgs::msg::Flocation *msg) { MROS2_INFO("subscribed msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); MROS2_INFO("publishing msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); @@ -23,9 +23,9 @@ int main(int argc, char * argv[]) BSP_LED_Toggle(LED1); mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - float_location_msgs::msg::FloatLocation msg; + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + flocation_msgs::msg::Flocation msg; MROS2_INFO("ready to pub/sub message"); mros2::spin(); diff --git a/workspace/float_location_pubsub/float_location_msgs/msg/FloatLocation.msg b/workspace/float_location_pubsub/flocation_msgs/msg/Flocation.msg similarity index 100% rename from workspace/float_location_pubsub/float_location_msgs/msg/FloatLocation.msg rename to workspace/float_location_pubsub/flocation_msgs/msg/Flocation.msg diff --git a/workspace/float_location_pubsub/msg_settings.json b/workspace/float_location_pubsub/msg_settings.json index 6c64d29..288bcb6 100644 --- a/workspace/float_location_pubsub/msg_settings.json +++ b/workspace/float_location_pubsub/msg_settings.json @@ -1,6 +1,6 @@ { "includingMsgs": [ - "float_location_msgs/msg/FloatLocation.msg" + "flocation_msgs/msg/Flocation.msg" ], "dependingPkgs": [ ] From e53fb81e38fb249668fd96a589ad1c5e4917ca49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 15:21:43 +0900 Subject: [PATCH 22/80] flocation app added --- .../{float_location_pubsub => flocation_pubsub}/Makefile.inc | 0 workspace/{float_location_pubsub => flocation_pubsub}/README.md | 0 workspace/{float_location_pubsub => flocation_pubsub}/app.cdl | 0 workspace/{float_location_pubsub => flocation_pubsub}/app.cfg | 0 workspace/{float_location_pubsub => flocation_pubsub}/app.cpp | 0 workspace/{float_location_pubsub => flocation_pubsub}/app.h | 0 .../config/autosar_os_ext_asp3_user_config.c | 0 .../config/autosar_os_ext_asp3_user_config.h | 0 .../config/autosar_os_ext_user_config.c | 0 .../config/autosar_os_ext_user_config.h | 0 .../config/mros2_user_config.c | 0 .../{float_location_pubsub => flocation_pubsub}/config/task.cfg | 0 .../flocation_msgs/msg/Flocation.msg | 0 .../{float_location_pubsub => flocation_pubsub}/msg_settings.json | 0 workspace/{float_location_pubsub => flocation_pubsub}/task_impl.c | 0 workspace/{float_location_pubsub => flocation_pubsub}/task_impl.h | 0 16 files changed, 0 insertions(+), 0 deletions(-) rename workspace/{float_location_pubsub => flocation_pubsub}/Makefile.inc (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/README.md (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/app.cdl (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/app.cfg (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/app.cpp (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/app.h (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/config/autosar_os_ext_asp3_user_config.c (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/config/autosar_os_ext_asp3_user_config.h (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/config/autosar_os_ext_user_config.c (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/config/autosar_os_ext_user_config.h (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/config/mros2_user_config.c (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/config/task.cfg (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/flocation_msgs/msg/Flocation.msg (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/msg_settings.json (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/task_impl.c (100%) rename workspace/{float_location_pubsub => flocation_pubsub}/task_impl.h (100%) diff --git a/workspace/float_location_pubsub/Makefile.inc b/workspace/flocation_pubsub/Makefile.inc similarity index 100% rename from workspace/float_location_pubsub/Makefile.inc rename to workspace/flocation_pubsub/Makefile.inc diff --git a/workspace/float_location_pubsub/README.md b/workspace/flocation_pubsub/README.md similarity index 100% rename from workspace/float_location_pubsub/README.md rename to workspace/flocation_pubsub/README.md diff --git a/workspace/float_location_pubsub/app.cdl b/workspace/flocation_pubsub/app.cdl similarity index 100% rename from workspace/float_location_pubsub/app.cdl rename to workspace/flocation_pubsub/app.cdl diff --git a/workspace/float_location_pubsub/app.cfg b/workspace/flocation_pubsub/app.cfg similarity index 100% rename from workspace/float_location_pubsub/app.cfg rename to workspace/flocation_pubsub/app.cfg diff --git a/workspace/float_location_pubsub/app.cpp b/workspace/flocation_pubsub/app.cpp similarity index 100% rename from workspace/float_location_pubsub/app.cpp rename to workspace/flocation_pubsub/app.cpp diff --git a/workspace/float_location_pubsub/app.h b/workspace/flocation_pubsub/app.h similarity index 100% rename from workspace/float_location_pubsub/app.h rename to workspace/flocation_pubsub/app.h diff --git a/workspace/float_location_pubsub/config/autosar_os_ext_asp3_user_config.c b/workspace/flocation_pubsub/config/autosar_os_ext_asp3_user_config.c similarity index 100% rename from workspace/float_location_pubsub/config/autosar_os_ext_asp3_user_config.c rename to workspace/flocation_pubsub/config/autosar_os_ext_asp3_user_config.c diff --git a/workspace/float_location_pubsub/config/autosar_os_ext_asp3_user_config.h b/workspace/flocation_pubsub/config/autosar_os_ext_asp3_user_config.h similarity index 100% rename from workspace/float_location_pubsub/config/autosar_os_ext_asp3_user_config.h rename to workspace/flocation_pubsub/config/autosar_os_ext_asp3_user_config.h diff --git a/workspace/float_location_pubsub/config/autosar_os_ext_user_config.c b/workspace/flocation_pubsub/config/autosar_os_ext_user_config.c similarity index 100% rename from workspace/float_location_pubsub/config/autosar_os_ext_user_config.c rename to workspace/flocation_pubsub/config/autosar_os_ext_user_config.c diff --git a/workspace/float_location_pubsub/config/autosar_os_ext_user_config.h b/workspace/flocation_pubsub/config/autosar_os_ext_user_config.h similarity index 100% rename from workspace/float_location_pubsub/config/autosar_os_ext_user_config.h rename to workspace/flocation_pubsub/config/autosar_os_ext_user_config.h diff --git a/workspace/float_location_pubsub/config/mros2_user_config.c b/workspace/flocation_pubsub/config/mros2_user_config.c similarity index 100% rename from workspace/float_location_pubsub/config/mros2_user_config.c rename to workspace/flocation_pubsub/config/mros2_user_config.c diff --git a/workspace/float_location_pubsub/config/task.cfg b/workspace/flocation_pubsub/config/task.cfg similarity index 100% rename from workspace/float_location_pubsub/config/task.cfg rename to workspace/flocation_pubsub/config/task.cfg diff --git a/workspace/float_location_pubsub/flocation_msgs/msg/Flocation.msg b/workspace/flocation_pubsub/flocation_msgs/msg/Flocation.msg similarity index 100% rename from workspace/float_location_pubsub/flocation_msgs/msg/Flocation.msg rename to workspace/flocation_pubsub/flocation_msgs/msg/Flocation.msg diff --git a/workspace/float_location_pubsub/msg_settings.json b/workspace/flocation_pubsub/msg_settings.json similarity index 100% rename from workspace/float_location_pubsub/msg_settings.json rename to workspace/flocation_pubsub/msg_settings.json diff --git a/workspace/float_location_pubsub/task_impl.c b/workspace/flocation_pubsub/task_impl.c similarity index 100% rename from workspace/float_location_pubsub/task_impl.c rename to workspace/flocation_pubsub/task_impl.c diff --git a/workspace/float_location_pubsub/task_impl.h b/workspace/flocation_pubsub/task_impl.h similarity index 100% rename from workspace/float_location_pubsub/task_impl.h rename to workspace/flocation_pubsub/task_impl.h From 5823b38ea25475d384684f19375331c845fae451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 15:25:14 +0900 Subject: [PATCH 23/80] flocation app added --- workspace/location_pubsub/app.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/workspace/location_pubsub/app.cpp b/workspace/location_pubsub/app.cpp index a73deec..aca5fe3 100644 --- a/workspace/location_pubsub/app.cpp +++ b/workspace/location_pubsub/app.cpp @@ -1,16 +1,16 @@ #include "app.h" #include "mros2.h" -#include "location_msgs/msg/location.hpp" +#include "flocation_msgs/msg/flocation.hpp" #include "stm32f7xx_nucleo_144.h" mros2::Subscriber sub; mros2::Publisher pub; -void userCallback(location_msgs::msg::Location *msg) +void userCallback(flocation_msgs::msg::Flocation *msg) { - MROS2_INFO("subscribed msg: { x: %d, y: %d, z: %d }", msg->x, msg->y, msg->z); - MROS2_INFO("publishing msg: { x: %d, y: %d, z: %d }", msg->x, msg->y, msg->z); + MROS2_INFO("subscribed msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); + MROS2_INFO("publishing msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); pub.publish(*msg); } @@ -23,9 +23,9 @@ int main(int argc, char * argv[]) BSP_LED_Toggle(LED1); mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - location_msgs::msg::Location msg; + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + flocation_msgs::msg::Flocation msg; MROS2_INFO("ready to pub/sub message"); mros2::spin(); From 738f8a4ebf443bc80c231e976fdca1e9aa532316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 15:26:42 +0900 Subject: [PATCH 24/80] flocation app added --- workspace/location_pubsub/app.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/workspace/location_pubsub/app.cpp b/workspace/location_pubsub/app.cpp index aca5fe3..a73deec 100644 --- a/workspace/location_pubsub/app.cpp +++ b/workspace/location_pubsub/app.cpp @@ -1,16 +1,16 @@ #include "app.h" #include "mros2.h" -#include "flocation_msgs/msg/flocation.hpp" +#include "location_msgs/msg/location.hpp" #include "stm32f7xx_nucleo_144.h" mros2::Subscriber sub; mros2::Publisher pub; -void userCallback(flocation_msgs::msg::Flocation *msg) +void userCallback(location_msgs::msg::Location *msg) { - MROS2_INFO("subscribed msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); - MROS2_INFO("publishing msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); + MROS2_INFO("subscribed msg: { x: %d, y: %d, z: %d }", msg->x, msg->y, msg->z); + MROS2_INFO("publishing msg: { x: %d, y: %d, z: %d }", msg->x, msg->y, msg->z); pub.publish(*msg); } @@ -23,9 +23,9 @@ int main(int argc, char * argv[]) BSP_LED_Toggle(LED1); mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - flocation_msgs::msg::Flocation msg; + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + location_msgs::msg::Location msg; MROS2_INFO("ready to pub/sub message"); mros2::spin(); From ce45044c3cdebe1f7fbdb6a168b6b96875d807ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 17:45:41 +0900 Subject: [PATCH 25/80] rename apps --- .../Makefile.inc | 0 .../README.md | 0 .../app.cdl | 0 .../app.cfg | 0 .../app.cpp | 0 .../app.h | 0 .../flocation_msgs/msg/Flocation.msg | 0 .../msg_settings.json | 0 .../task_impl.c | 0 .../task_impl.h | 0 .../Makefile.inc | 0 .../README.md | 0 .../app.cdl | 0 .../app.cfg | 0 .../app.cpp | 0 .../{health_pubsub => echoreply_health}/app.h | 0 .../health_msgs/msg/Health.msg | 0 .../msg_settings.json | 0 .../task_impl.c | 0 .../task_impl.h | 0 .../Makefile.inc | 0 .../README.md | 0 .../app.cdl | 0 .../app.cfg | 0 .../app.cpp | 0 .../app.h | 0 .../location_msgs/msg/Location.msg | 0 .../msg_settings.json | 0 .../task_impl.c | 0 .../config/autosar_os_ext_asp3_user_config.c | 24 ------ .../config/autosar_os_ext_asp3_user_config.h | 10 --- .../config/autosar_os_ext_user_config.c | 75 ------------------- .../config/autosar_os_ext_user_config.h | 22 ------ .../config/mros2_user_config.c | 10 --- workspace/flocation_pubsub/config/task.cfg | 24 ------ .../config/autosar_os_ext_asp3_user_config.c | 24 ------ .../config/autosar_os_ext_asp3_user_config.h | 10 --- .../config/autosar_os_ext_user_config.c | 75 ------------------- .../config/autosar_os_ext_user_config.h | 22 ------ .../health_pubsub/config/mros2_user_config.c | 10 --- workspace/health_pubsub/config/task.cfg | 24 ------ .../config/autosar_os_ext_asp3_user_config.c | 24 ------ .../config/autosar_os_ext_asp3_user_config.h | 10 --- .../config/autosar_os_ext_user_config.c | 75 ------------------- .../config/autosar_os_ext_user_config.h | 22 ------ .../config/mros2_user_config.c | 10 --- workspace/location_pubsub/config/task.cfg | 24 ------ workspace/location_pubsub/task_impl.h | 54 ------------- 48 files changed, 549 deletions(-) rename workspace/{flocation_pubsub => echoreply_flocation}/Makefile.inc (100%) rename workspace/{flocation_pubsub => echoreply_flocation}/README.md (100%) rename workspace/{flocation_pubsub => echoreply_flocation}/app.cdl (100%) rename workspace/{flocation_pubsub => echoreply_flocation}/app.cfg (100%) rename workspace/{flocation_pubsub => echoreply_flocation}/app.cpp (100%) rename workspace/{flocation_pubsub => echoreply_flocation}/app.h (100%) rename workspace/{flocation_pubsub => echoreply_flocation}/flocation_msgs/msg/Flocation.msg (100%) rename workspace/{flocation_pubsub => echoreply_flocation}/msg_settings.json (100%) rename workspace/{flocation_pubsub => echoreply_flocation}/task_impl.c (100%) rename workspace/{flocation_pubsub => echoreply_flocation}/task_impl.h (100%) rename workspace/{health_pubsub => echoreply_health}/Makefile.inc (100%) rename workspace/{health_pubsub => echoreply_health}/README.md (100%) rename workspace/{health_pubsub => echoreply_health}/app.cdl (100%) rename workspace/{health_pubsub => echoreply_health}/app.cfg (100%) rename workspace/{health_pubsub => echoreply_health}/app.cpp (100%) rename workspace/{health_pubsub => echoreply_health}/app.h (100%) rename workspace/{health_pubsub => echoreply_health}/health_msgs/msg/Health.msg (100%) rename workspace/{health_pubsub => echoreply_health}/msg_settings.json (100%) rename workspace/{health_pubsub => echoreply_health}/task_impl.c (100%) rename workspace/{health_pubsub => echoreply_health}/task_impl.h (100%) rename workspace/{location_pubsub => echoreply_location}/Makefile.inc (100%) rename workspace/{location_pubsub => echoreply_location}/README.md (100%) rename workspace/{location_pubsub => echoreply_location}/app.cdl (100%) rename workspace/{location_pubsub => echoreply_location}/app.cfg (100%) rename workspace/{location_pubsub => echoreply_location}/app.cpp (100%) rename workspace/{location_pubsub => echoreply_location}/app.h (100%) rename workspace/{location_pubsub => echoreply_location}/location_msgs/msg/Location.msg (100%) rename workspace/{location_pubsub => echoreply_location}/msg_settings.json (100%) rename workspace/{location_pubsub => echoreply_location}/task_impl.c (100%) delete mode 100644 workspace/flocation_pubsub/config/autosar_os_ext_asp3_user_config.c delete mode 100644 workspace/flocation_pubsub/config/autosar_os_ext_asp3_user_config.h delete mode 100644 workspace/flocation_pubsub/config/autosar_os_ext_user_config.c delete mode 100644 workspace/flocation_pubsub/config/autosar_os_ext_user_config.h delete mode 100644 workspace/flocation_pubsub/config/mros2_user_config.c delete mode 100644 workspace/flocation_pubsub/config/task.cfg delete mode 100644 workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.c delete mode 100644 workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.h delete mode 100644 workspace/health_pubsub/config/autosar_os_ext_user_config.c delete mode 100644 workspace/health_pubsub/config/autosar_os_ext_user_config.h delete mode 100644 workspace/health_pubsub/config/mros2_user_config.c delete mode 100644 workspace/health_pubsub/config/task.cfg delete mode 100644 workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.c delete mode 100644 workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.h delete mode 100644 workspace/location_pubsub/config/autosar_os_ext_user_config.c delete mode 100644 workspace/location_pubsub/config/autosar_os_ext_user_config.h delete mode 100644 workspace/location_pubsub/config/mros2_user_config.c delete mode 100644 workspace/location_pubsub/config/task.cfg delete mode 100644 workspace/location_pubsub/task_impl.h diff --git a/workspace/flocation_pubsub/Makefile.inc b/workspace/echoreply_flocation/Makefile.inc similarity index 100% rename from workspace/flocation_pubsub/Makefile.inc rename to workspace/echoreply_flocation/Makefile.inc diff --git a/workspace/flocation_pubsub/README.md b/workspace/echoreply_flocation/README.md similarity index 100% rename from workspace/flocation_pubsub/README.md rename to workspace/echoreply_flocation/README.md diff --git a/workspace/flocation_pubsub/app.cdl b/workspace/echoreply_flocation/app.cdl similarity index 100% rename from workspace/flocation_pubsub/app.cdl rename to workspace/echoreply_flocation/app.cdl diff --git a/workspace/flocation_pubsub/app.cfg b/workspace/echoreply_flocation/app.cfg similarity index 100% rename from workspace/flocation_pubsub/app.cfg rename to workspace/echoreply_flocation/app.cfg diff --git a/workspace/flocation_pubsub/app.cpp b/workspace/echoreply_flocation/app.cpp similarity index 100% rename from workspace/flocation_pubsub/app.cpp rename to workspace/echoreply_flocation/app.cpp diff --git a/workspace/flocation_pubsub/app.h b/workspace/echoreply_flocation/app.h similarity index 100% rename from workspace/flocation_pubsub/app.h rename to workspace/echoreply_flocation/app.h diff --git a/workspace/flocation_pubsub/flocation_msgs/msg/Flocation.msg b/workspace/echoreply_flocation/flocation_msgs/msg/Flocation.msg similarity index 100% rename from workspace/flocation_pubsub/flocation_msgs/msg/Flocation.msg rename to workspace/echoreply_flocation/flocation_msgs/msg/Flocation.msg diff --git a/workspace/flocation_pubsub/msg_settings.json b/workspace/echoreply_flocation/msg_settings.json similarity index 100% rename from workspace/flocation_pubsub/msg_settings.json rename to workspace/echoreply_flocation/msg_settings.json diff --git a/workspace/flocation_pubsub/task_impl.c b/workspace/echoreply_flocation/task_impl.c similarity index 100% rename from workspace/flocation_pubsub/task_impl.c rename to workspace/echoreply_flocation/task_impl.c diff --git a/workspace/flocation_pubsub/task_impl.h b/workspace/echoreply_flocation/task_impl.h similarity index 100% rename from workspace/flocation_pubsub/task_impl.h rename to workspace/echoreply_flocation/task_impl.h diff --git a/workspace/health_pubsub/Makefile.inc b/workspace/echoreply_health/Makefile.inc similarity index 100% rename from workspace/health_pubsub/Makefile.inc rename to workspace/echoreply_health/Makefile.inc diff --git a/workspace/health_pubsub/README.md b/workspace/echoreply_health/README.md similarity index 100% rename from workspace/health_pubsub/README.md rename to workspace/echoreply_health/README.md diff --git a/workspace/health_pubsub/app.cdl b/workspace/echoreply_health/app.cdl similarity index 100% rename from workspace/health_pubsub/app.cdl rename to workspace/echoreply_health/app.cdl diff --git a/workspace/health_pubsub/app.cfg b/workspace/echoreply_health/app.cfg similarity index 100% rename from workspace/health_pubsub/app.cfg rename to workspace/echoreply_health/app.cfg diff --git a/workspace/health_pubsub/app.cpp b/workspace/echoreply_health/app.cpp similarity index 100% rename from workspace/health_pubsub/app.cpp rename to workspace/echoreply_health/app.cpp diff --git a/workspace/health_pubsub/app.h b/workspace/echoreply_health/app.h similarity index 100% rename from workspace/health_pubsub/app.h rename to workspace/echoreply_health/app.h diff --git a/workspace/health_pubsub/health_msgs/msg/Health.msg b/workspace/echoreply_health/health_msgs/msg/Health.msg similarity index 100% rename from workspace/health_pubsub/health_msgs/msg/Health.msg rename to workspace/echoreply_health/health_msgs/msg/Health.msg diff --git a/workspace/health_pubsub/msg_settings.json b/workspace/echoreply_health/msg_settings.json similarity index 100% rename from workspace/health_pubsub/msg_settings.json rename to workspace/echoreply_health/msg_settings.json diff --git a/workspace/health_pubsub/task_impl.c b/workspace/echoreply_health/task_impl.c similarity index 100% rename from workspace/health_pubsub/task_impl.c rename to workspace/echoreply_health/task_impl.c diff --git a/workspace/health_pubsub/task_impl.h b/workspace/echoreply_health/task_impl.h similarity index 100% rename from workspace/health_pubsub/task_impl.h rename to workspace/echoreply_health/task_impl.h diff --git a/workspace/location_pubsub/Makefile.inc b/workspace/echoreply_location/Makefile.inc similarity index 100% rename from workspace/location_pubsub/Makefile.inc rename to workspace/echoreply_location/Makefile.inc diff --git a/workspace/location_pubsub/README.md b/workspace/echoreply_location/README.md similarity index 100% rename from workspace/location_pubsub/README.md rename to workspace/echoreply_location/README.md diff --git a/workspace/location_pubsub/app.cdl b/workspace/echoreply_location/app.cdl similarity index 100% rename from workspace/location_pubsub/app.cdl rename to workspace/echoreply_location/app.cdl diff --git a/workspace/location_pubsub/app.cfg b/workspace/echoreply_location/app.cfg similarity index 100% rename from workspace/location_pubsub/app.cfg rename to workspace/echoreply_location/app.cfg diff --git a/workspace/location_pubsub/app.cpp b/workspace/echoreply_location/app.cpp similarity index 100% rename from workspace/location_pubsub/app.cpp rename to workspace/echoreply_location/app.cpp diff --git a/workspace/location_pubsub/app.h b/workspace/echoreply_location/app.h similarity index 100% rename from workspace/location_pubsub/app.h rename to workspace/echoreply_location/app.h diff --git a/workspace/location_pubsub/location_msgs/msg/Location.msg b/workspace/echoreply_location/location_msgs/msg/Location.msg similarity index 100% rename from workspace/location_pubsub/location_msgs/msg/Location.msg rename to workspace/echoreply_location/location_msgs/msg/Location.msg diff --git a/workspace/location_pubsub/msg_settings.json b/workspace/echoreply_location/msg_settings.json similarity index 100% rename from workspace/location_pubsub/msg_settings.json rename to workspace/echoreply_location/msg_settings.json diff --git a/workspace/location_pubsub/task_impl.c b/workspace/echoreply_location/task_impl.c similarity index 100% rename from workspace/location_pubsub/task_impl.c rename to workspace/echoreply_location/task_impl.c diff --git a/workspace/flocation_pubsub/config/autosar_os_ext_asp3_user_config.c b/workspace/flocation_pubsub/config/autosar_os_ext_asp3_user_config.c deleted file mode 100644 index 41ef1da..0000000 --- a/workspace/flocation_pubsub/config/autosar_os_ext_asp3_user_config.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "autosar_os_ext_asp3_user_config.h" - -const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), -}; - -const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) -{ - return autosar_os_ext_flag_user_map; -} - -int cmsis_get_flag_user_num(void) -{ - return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; -} diff --git a/workspace/flocation_pubsub/config/autosar_os_ext_asp3_user_config.h b/workspace/flocation_pubsub/config/autosar_os_ext_asp3_user_config.h deleted file mode 100644 index 7ad08bf..0000000 --- a/workspace/flocation_pubsub/config/autosar_os_ext_asp3_user_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ - -#include "cmsis_config_utl.h" - -#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) - -extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; - -#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/flocation_pubsub/config/autosar_os_ext_user_config.c b/workspace/flocation_pubsub/config/autosar_os_ext_user_config.c deleted file mode 100644 index 940941b..0000000 --- a/workspace/flocation_pubsub/config/autosar_os_ext_user_config.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "cmsis_os.h" -#include "autosar_os_ext_user_config.h" - -extern void tcpip_thread(void *arg); -extern void ethernetif_set_link(void* argument); -extern void ethernetif_input(void* argument); -extern void callHbPubFunc(void *arg); -extern void callHbSubFunc(void *arg); -extern void StartDefaultTask(void * argument); -extern void callWriterThreadFunction(void *arg); -extern void callReaderThreadFunction(void *arg); -extern void callRunBroadcast(void *args); -extern void mros2_init(void *args); - - -UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { - { - .taskID = AutosarOsExtTcpTask, - .func = tcpip_thread, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthIfLinkTask, - .func = ethernetif_set_link, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthInputTask, - .func = ethernetif_input, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBPubTask, - .func = callHbPubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBSubTask, - .func = callHbSubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtSPDPTask, - .func = callRunBroadcast, - .argument = NULL, - }, - { - .taskID = AutosarOsExtWriterTask, - .func = callWriterThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtReaderTask, - .func = callReaderThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtMROS2Task, - .func = mros2_init, - .argument = NULL, - }, -}; - -UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) -{ - return user_thread_autosar_ostask_map; -} -int cmsis_get_app_heap_size(void) -{ - return APP_HEAP_SIZE; -} -int cmsis_get_user_thread_num(void) -{ - return USER_THREAD_NUM; -} diff --git a/workspace/flocation_pubsub/config/autosar_os_ext_user_config.h b/workspace/flocation_pubsub/config/autosar_os_ext_user_config.h deleted file mode 100644 index bab78d3..0000000 --- a/workspace/flocation_pubsub/config/autosar_os_ext_user_config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ - -#include "cmsis_os.h" -#include "cmsis_config_utl.h" - -/*********************************************** - * - * MEMORY - * - ***********************************************/ -#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ - - -/*********************************************** - * - * THREAD - * - ***********************************************/ -#define USER_THREAD_NUM 9U - -#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/flocation_pubsub/config/mros2_user_config.c b/workspace/flocation_pubsub/config/mros2_user_config.c deleted file mode 100644 index 7d2c110..0000000 --- a/workspace/flocation_pubsub/config/mros2_user_config.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#define SUB_MSG_COUNT 10 - -int mros2_get_submsg_count(void) -{ - return SUB_MSG_COUNT; -} - - diff --git a/workspace/flocation_pubsub/config/task.cfg b/workspace/flocation_pubsub/config/task.cfg deleted file mode 100644 index f577110..0000000 --- a/workspace/flocation_pubsub/config/task.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#include "task_impl.h" - -CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); -CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); -CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); -CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); -CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); -CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); -CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); -CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); -CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); -CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); - -CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.c b/workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.c deleted file mode 100644 index 41ef1da..0000000 --- a/workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "autosar_os_ext_asp3_user_config.h" - -const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), -}; - -const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) -{ - return autosar_os_ext_flag_user_map; -} - -int cmsis_get_flag_user_num(void) -{ - return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; -} diff --git a/workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.h b/workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.h deleted file mode 100644 index 7ad08bf..0000000 --- a/workspace/health_pubsub/config/autosar_os_ext_asp3_user_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ - -#include "cmsis_config_utl.h" - -#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) - -extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; - -#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/health_pubsub/config/autosar_os_ext_user_config.c b/workspace/health_pubsub/config/autosar_os_ext_user_config.c deleted file mode 100644 index 940941b..0000000 --- a/workspace/health_pubsub/config/autosar_os_ext_user_config.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "cmsis_os.h" -#include "autosar_os_ext_user_config.h" - -extern void tcpip_thread(void *arg); -extern void ethernetif_set_link(void* argument); -extern void ethernetif_input(void* argument); -extern void callHbPubFunc(void *arg); -extern void callHbSubFunc(void *arg); -extern void StartDefaultTask(void * argument); -extern void callWriterThreadFunction(void *arg); -extern void callReaderThreadFunction(void *arg); -extern void callRunBroadcast(void *args); -extern void mros2_init(void *args); - - -UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { - { - .taskID = AutosarOsExtTcpTask, - .func = tcpip_thread, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthIfLinkTask, - .func = ethernetif_set_link, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthInputTask, - .func = ethernetif_input, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBPubTask, - .func = callHbPubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBSubTask, - .func = callHbSubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtSPDPTask, - .func = callRunBroadcast, - .argument = NULL, - }, - { - .taskID = AutosarOsExtWriterTask, - .func = callWriterThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtReaderTask, - .func = callReaderThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtMROS2Task, - .func = mros2_init, - .argument = NULL, - }, -}; - -UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) -{ - return user_thread_autosar_ostask_map; -} -int cmsis_get_app_heap_size(void) -{ - return APP_HEAP_SIZE; -} -int cmsis_get_user_thread_num(void) -{ - return USER_THREAD_NUM; -} diff --git a/workspace/health_pubsub/config/autosar_os_ext_user_config.h b/workspace/health_pubsub/config/autosar_os_ext_user_config.h deleted file mode 100644 index bab78d3..0000000 --- a/workspace/health_pubsub/config/autosar_os_ext_user_config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ - -#include "cmsis_os.h" -#include "cmsis_config_utl.h" - -/*********************************************** - * - * MEMORY - * - ***********************************************/ -#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ - - -/*********************************************** - * - * THREAD - * - ***********************************************/ -#define USER_THREAD_NUM 9U - -#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/health_pubsub/config/mros2_user_config.c b/workspace/health_pubsub/config/mros2_user_config.c deleted file mode 100644 index 7d2c110..0000000 --- a/workspace/health_pubsub/config/mros2_user_config.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#define SUB_MSG_COUNT 10 - -int mros2_get_submsg_count(void) -{ - return SUB_MSG_COUNT; -} - - diff --git a/workspace/health_pubsub/config/task.cfg b/workspace/health_pubsub/config/task.cfg deleted file mode 100644 index f577110..0000000 --- a/workspace/health_pubsub/config/task.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#include "task_impl.h" - -CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); -CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); -CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); -CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); -CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); -CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); -CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); -CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); -CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); -CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); - -CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.c b/workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.c deleted file mode 100644 index 41ef1da..0000000 --- a/workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "autosar_os_ext_asp3_user_config.h" - -const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), -}; - -const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) -{ - return autosar_os_ext_flag_user_map; -} - -int cmsis_get_flag_user_num(void) -{ - return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; -} diff --git a/workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.h b/workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.h deleted file mode 100644 index 7ad08bf..0000000 --- a/workspace/location_pubsub/config/autosar_os_ext_asp3_user_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ - -#include "cmsis_config_utl.h" - -#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) - -extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; - -#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/location_pubsub/config/autosar_os_ext_user_config.c b/workspace/location_pubsub/config/autosar_os_ext_user_config.c deleted file mode 100644 index 940941b..0000000 --- a/workspace/location_pubsub/config/autosar_os_ext_user_config.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "cmsis_os.h" -#include "autosar_os_ext_user_config.h" - -extern void tcpip_thread(void *arg); -extern void ethernetif_set_link(void* argument); -extern void ethernetif_input(void* argument); -extern void callHbPubFunc(void *arg); -extern void callHbSubFunc(void *arg); -extern void StartDefaultTask(void * argument); -extern void callWriterThreadFunction(void *arg); -extern void callReaderThreadFunction(void *arg); -extern void callRunBroadcast(void *args); -extern void mros2_init(void *args); - - -UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { - { - .taskID = AutosarOsExtTcpTask, - .func = tcpip_thread, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthIfLinkTask, - .func = ethernetif_set_link, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthInputTask, - .func = ethernetif_input, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBPubTask, - .func = callHbPubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBSubTask, - .func = callHbSubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtSPDPTask, - .func = callRunBroadcast, - .argument = NULL, - }, - { - .taskID = AutosarOsExtWriterTask, - .func = callWriterThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtReaderTask, - .func = callReaderThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtMROS2Task, - .func = mros2_init, - .argument = NULL, - }, -}; - -UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) -{ - return user_thread_autosar_ostask_map; -} -int cmsis_get_app_heap_size(void) -{ - return APP_HEAP_SIZE; -} -int cmsis_get_user_thread_num(void) -{ - return USER_THREAD_NUM; -} diff --git a/workspace/location_pubsub/config/autosar_os_ext_user_config.h b/workspace/location_pubsub/config/autosar_os_ext_user_config.h deleted file mode 100644 index bab78d3..0000000 --- a/workspace/location_pubsub/config/autosar_os_ext_user_config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ - -#include "cmsis_os.h" -#include "cmsis_config_utl.h" - -/*********************************************** - * - * MEMORY - * - ***********************************************/ -#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ - - -/*********************************************** - * - * THREAD - * - ***********************************************/ -#define USER_THREAD_NUM 9U - -#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/location_pubsub/config/mros2_user_config.c b/workspace/location_pubsub/config/mros2_user_config.c deleted file mode 100644 index 7d2c110..0000000 --- a/workspace/location_pubsub/config/mros2_user_config.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#define SUB_MSG_COUNT 10 - -int mros2_get_submsg_count(void) -{ - return SUB_MSG_COUNT; -} - - diff --git a/workspace/location_pubsub/config/task.cfg b/workspace/location_pubsub/config/task.cfg deleted file mode 100644 index f577110..0000000 --- a/workspace/location_pubsub/config/task.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#include "task_impl.h" - -CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); -CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); -CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); -CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); -CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); -CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); -CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); -CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); -CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); -CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); - -CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/location_pubsub/task_impl.h b/workspace/location_pubsub/task_impl.h deleted file mode 100644 index 11e7a81..0000000 --- a/workspace/location_pubsub/task_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_TEST_H_ -#define _AUTOSAR_OS_EXT_TEST_H_ - -#include "cmsis_config_utl.h" - -extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); - -/* - * priorities of mROS 2 tasks for RTPS - * - * TODO: We assigned relatevely lower priorities for EthIfLinkTask and - * EthInputTask than the application. Check whether these are appropriate. - */ -#define MROS2_HIGH_PRIORITY MAIN_PRIORITY -#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 - -/* - * experimental: stack size of mROS 2 tasks for RTPS - * Each comment refers the location of original definition - */ -// application/include/lwipopt.h -// #define TCPIP_THREAD_STACKSIZE 1024 -#define MROS2_STACK_SIZE_TcpTask 1024 -// application/src/lwip.c -// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) -#define MROS2_STACK_SIZE_EthIfLinkTask 1024 -// application/src/ethernet.c -// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) -#define MROS2_STACK_SIZE_EthInputTask 350 -// embeddedRTPS/include/config.h -// const int HEARTBEAT_STACKSIZE = 1200; // byte -#define MROS2_STACK_SIZE_HBPubTask 1200 -#define MROS2_STACK_SIZE_HBSubTask 1200 -// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte -#define MROS2_STACK_SIZE_SPDPTask 550 -// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte -#define MROS2_STACK_SIZE_WriterTask 1100 -// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte -#define MROS2_STACK_SIZE_ReaderTask 1600 -// embeddedRTPS-STM32/stm32/Src/main.cpp -// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); -#define MROS2_STACK_SIZE_UserDefaultTask 250 - - -#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ From f03d99bff14e2a3320b25a9aab1d3238dd9a0ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 17:54:03 +0900 Subject: [PATCH 26/80] rename apps --- .../config/autosar_os_ext_asp3_user_config.c | 24 ++++++ .../config/autosar_os_ext_asp3_user_config.h | 10 +++ .../config/autosar_os_ext_user_config.c | 75 +++++++++++++++++++ .../config/autosar_os_ext_user_config.h | 22 ++++++ .../config/mros2_user_config.c | 10 +++ workspace/echoreply_flocation/config/task.cfg | 24 ++++++ .../config/autosar_os_ext_asp3_user_config.c | 24 ++++++ .../config/autosar_os_ext_asp3_user_config.h | 10 +++ .../config/autosar_os_ext_user_config.c | 75 +++++++++++++++++++ .../config/autosar_os_ext_user_config.h | 22 ++++++ .../config/mros2_user_config.c | 10 +++ workspace/echoreply_health/config/task.cfg | 24 ++++++ .../config/autosar_os_ext_asp3_user_config.c | 24 ++++++ .../config/autosar_os_ext_asp3_user_config.h | 10 +++ .../config/autosar_os_ext_user_config.c | 75 +++++++++++++++++++ .../config/autosar_os_ext_user_config.h | 22 ++++++ .../config/mros2_user_config.c | 10 +++ workspace/echoreply_location/config/task.cfg | 24 ++++++ workspace/echoreply_location/task_impl.h | 54 +++++++++++++ 19 files changed, 549 insertions(+) create mode 100644 workspace/echoreply_flocation/config/autosar_os_ext_asp3_user_config.c create mode 100644 workspace/echoreply_flocation/config/autosar_os_ext_asp3_user_config.h create mode 100644 workspace/echoreply_flocation/config/autosar_os_ext_user_config.c create mode 100644 workspace/echoreply_flocation/config/autosar_os_ext_user_config.h create mode 100644 workspace/echoreply_flocation/config/mros2_user_config.c create mode 100644 workspace/echoreply_flocation/config/task.cfg create mode 100644 workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.c create mode 100644 workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.h create mode 100644 workspace/echoreply_health/config/autosar_os_ext_user_config.c create mode 100644 workspace/echoreply_health/config/autosar_os_ext_user_config.h create mode 100644 workspace/echoreply_health/config/mros2_user_config.c create mode 100644 workspace/echoreply_health/config/task.cfg create mode 100644 workspace/echoreply_location/config/autosar_os_ext_asp3_user_config.c create mode 100644 workspace/echoreply_location/config/autosar_os_ext_asp3_user_config.h create mode 100644 workspace/echoreply_location/config/autosar_os_ext_user_config.c create mode 100644 workspace/echoreply_location/config/autosar_os_ext_user_config.h create mode 100644 workspace/echoreply_location/config/mros2_user_config.c create mode 100644 workspace/echoreply_location/config/task.cfg create mode 100644 workspace/echoreply_location/task_impl.h diff --git a/workspace/echoreply_flocation/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_flocation/config/autosar_os_ext_asp3_user_config.c new file mode 100644 index 0000000..41ef1da --- /dev/null +++ b/workspace/echoreply_flocation/config/autosar_os_ext_asp3_user_config.c @@ -0,0 +1,24 @@ +#include "autosar_os_ext_asp3_user_config.h" + +const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), +}; + +const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) +{ + return autosar_os_ext_flag_user_map; +} + +int cmsis_get_flag_user_num(void) +{ + return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; +} diff --git a/workspace/echoreply_flocation/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_flocation/config/autosar_os_ext_asp3_user_config.h new file mode 100644 index 0000000..7ad08bf --- /dev/null +++ b/workspace/echoreply_flocation/config/autosar_os_ext_asp3_user_config.h @@ -0,0 +1,10 @@ +#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ + +#include "cmsis_config_utl.h" + +#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) + +extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; + +#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_flocation/config/autosar_os_ext_user_config.c b/workspace/echoreply_flocation/config/autosar_os_ext_user_config.c new file mode 100644 index 0000000..940941b --- /dev/null +++ b/workspace/echoreply_flocation/config/autosar_os_ext_user_config.c @@ -0,0 +1,75 @@ +#include "cmsis_os.h" +#include "autosar_os_ext_user_config.h" + +extern void tcpip_thread(void *arg); +extern void ethernetif_set_link(void* argument); +extern void ethernetif_input(void* argument); +extern void callHbPubFunc(void *arg); +extern void callHbSubFunc(void *arg); +extern void StartDefaultTask(void * argument); +extern void callWriterThreadFunction(void *arg); +extern void callReaderThreadFunction(void *arg); +extern void callRunBroadcast(void *args); +extern void mros2_init(void *args); + + +UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { + { + .taskID = AutosarOsExtTcpTask, + .func = tcpip_thread, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthIfLinkTask, + .func = ethernetif_set_link, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthInputTask, + .func = ethernetif_input, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBPubTask, + .func = callHbPubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBSubTask, + .func = callHbSubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtSPDPTask, + .func = callRunBroadcast, + .argument = NULL, + }, + { + .taskID = AutosarOsExtWriterTask, + .func = callWriterThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtReaderTask, + .func = callReaderThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtMROS2Task, + .func = mros2_init, + .argument = NULL, + }, +}; + +UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) +{ + return user_thread_autosar_ostask_map; +} +int cmsis_get_app_heap_size(void) +{ + return APP_HEAP_SIZE; +} +int cmsis_get_user_thread_num(void) +{ + return USER_THREAD_NUM; +} diff --git a/workspace/echoreply_flocation/config/autosar_os_ext_user_config.h b/workspace/echoreply_flocation/config/autosar_os_ext_user_config.h new file mode 100644 index 0000000..bab78d3 --- /dev/null +++ b/workspace/echoreply_flocation/config/autosar_os_ext_user_config.h @@ -0,0 +1,22 @@ +#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ + +#include "cmsis_os.h" +#include "cmsis_config_utl.h" + +/*********************************************** + * + * MEMORY + * + ***********************************************/ +#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ + + +/*********************************************** + * + * THREAD + * + ***********************************************/ +#define USER_THREAD_NUM 9U + +#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_flocation/config/mros2_user_config.c b/workspace/echoreply_flocation/config/mros2_user_config.c new file mode 100644 index 0000000..7d2c110 --- /dev/null +++ b/workspace/echoreply_flocation/config/mros2_user_config.c @@ -0,0 +1,10 @@ + + +#define SUB_MSG_COUNT 10 + +int mros2_get_submsg_count(void) +{ + return SUB_MSG_COUNT; +} + + diff --git a/workspace/echoreply_flocation/config/task.cfg b/workspace/echoreply_flocation/config/task.cfg new file mode 100644 index 0000000..f577110 --- /dev/null +++ b/workspace/echoreply_flocation/config/task.cfg @@ -0,0 +1,24 @@ +#include "task_impl.h" + +CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); +CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); +CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); +CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); +CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); +CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); +CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); +CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); +CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); +CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); + +CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.c new file mode 100644 index 0000000..41ef1da --- /dev/null +++ b/workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.c @@ -0,0 +1,24 @@ +#include "autosar_os_ext_asp3_user_config.h" + +const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), +}; + +const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) +{ + return autosar_os_ext_flag_user_map; +} + +int cmsis_get_flag_user_num(void) +{ + return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; +} diff --git a/workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.h new file mode 100644 index 0000000..7ad08bf --- /dev/null +++ b/workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.h @@ -0,0 +1,10 @@ +#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ + +#include "cmsis_config_utl.h" + +#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) + +extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; + +#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_health/config/autosar_os_ext_user_config.c b/workspace/echoreply_health/config/autosar_os_ext_user_config.c new file mode 100644 index 0000000..940941b --- /dev/null +++ b/workspace/echoreply_health/config/autosar_os_ext_user_config.c @@ -0,0 +1,75 @@ +#include "cmsis_os.h" +#include "autosar_os_ext_user_config.h" + +extern void tcpip_thread(void *arg); +extern void ethernetif_set_link(void* argument); +extern void ethernetif_input(void* argument); +extern void callHbPubFunc(void *arg); +extern void callHbSubFunc(void *arg); +extern void StartDefaultTask(void * argument); +extern void callWriterThreadFunction(void *arg); +extern void callReaderThreadFunction(void *arg); +extern void callRunBroadcast(void *args); +extern void mros2_init(void *args); + + +UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { + { + .taskID = AutosarOsExtTcpTask, + .func = tcpip_thread, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthIfLinkTask, + .func = ethernetif_set_link, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthInputTask, + .func = ethernetif_input, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBPubTask, + .func = callHbPubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBSubTask, + .func = callHbSubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtSPDPTask, + .func = callRunBroadcast, + .argument = NULL, + }, + { + .taskID = AutosarOsExtWriterTask, + .func = callWriterThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtReaderTask, + .func = callReaderThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtMROS2Task, + .func = mros2_init, + .argument = NULL, + }, +}; + +UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) +{ + return user_thread_autosar_ostask_map; +} +int cmsis_get_app_heap_size(void) +{ + return APP_HEAP_SIZE; +} +int cmsis_get_user_thread_num(void) +{ + return USER_THREAD_NUM; +} diff --git a/workspace/echoreply_health/config/autosar_os_ext_user_config.h b/workspace/echoreply_health/config/autosar_os_ext_user_config.h new file mode 100644 index 0000000..bab78d3 --- /dev/null +++ b/workspace/echoreply_health/config/autosar_os_ext_user_config.h @@ -0,0 +1,22 @@ +#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ + +#include "cmsis_os.h" +#include "cmsis_config_utl.h" + +/*********************************************** + * + * MEMORY + * + ***********************************************/ +#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ + + +/*********************************************** + * + * THREAD + * + ***********************************************/ +#define USER_THREAD_NUM 9U + +#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_health/config/mros2_user_config.c b/workspace/echoreply_health/config/mros2_user_config.c new file mode 100644 index 0000000..7d2c110 --- /dev/null +++ b/workspace/echoreply_health/config/mros2_user_config.c @@ -0,0 +1,10 @@ + + +#define SUB_MSG_COUNT 10 + +int mros2_get_submsg_count(void) +{ + return SUB_MSG_COUNT; +} + + diff --git a/workspace/echoreply_health/config/task.cfg b/workspace/echoreply_health/config/task.cfg new file mode 100644 index 0000000..f577110 --- /dev/null +++ b/workspace/echoreply_health/config/task.cfg @@ -0,0 +1,24 @@ +#include "task_impl.h" + +CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); +CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); +CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); +CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); +CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); +CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); +CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); +CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); +CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); +CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); + +CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_location/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_location/config/autosar_os_ext_asp3_user_config.c new file mode 100644 index 0000000..41ef1da --- /dev/null +++ b/workspace/echoreply_location/config/autosar_os_ext_asp3_user_config.c @@ -0,0 +1,24 @@ +#include "autosar_os_ext_asp3_user_config.h" + +const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), +}; + +const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) +{ + return autosar_os_ext_flag_user_map; +} + +int cmsis_get_flag_user_num(void) +{ + return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; +} diff --git a/workspace/echoreply_location/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_location/config/autosar_os_ext_asp3_user_config.h new file mode 100644 index 0000000..7ad08bf --- /dev/null +++ b/workspace/echoreply_location/config/autosar_os_ext_asp3_user_config.h @@ -0,0 +1,10 @@ +#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ + +#include "cmsis_config_utl.h" + +#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) + +extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; + +#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_location/config/autosar_os_ext_user_config.c b/workspace/echoreply_location/config/autosar_os_ext_user_config.c new file mode 100644 index 0000000..940941b --- /dev/null +++ b/workspace/echoreply_location/config/autosar_os_ext_user_config.c @@ -0,0 +1,75 @@ +#include "cmsis_os.h" +#include "autosar_os_ext_user_config.h" + +extern void tcpip_thread(void *arg); +extern void ethernetif_set_link(void* argument); +extern void ethernetif_input(void* argument); +extern void callHbPubFunc(void *arg); +extern void callHbSubFunc(void *arg); +extern void StartDefaultTask(void * argument); +extern void callWriterThreadFunction(void *arg); +extern void callReaderThreadFunction(void *arg); +extern void callRunBroadcast(void *args); +extern void mros2_init(void *args); + + +UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { + { + .taskID = AutosarOsExtTcpTask, + .func = tcpip_thread, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthIfLinkTask, + .func = ethernetif_set_link, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthInputTask, + .func = ethernetif_input, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBPubTask, + .func = callHbPubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBSubTask, + .func = callHbSubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtSPDPTask, + .func = callRunBroadcast, + .argument = NULL, + }, + { + .taskID = AutosarOsExtWriterTask, + .func = callWriterThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtReaderTask, + .func = callReaderThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtMROS2Task, + .func = mros2_init, + .argument = NULL, + }, +}; + +UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) +{ + return user_thread_autosar_ostask_map; +} +int cmsis_get_app_heap_size(void) +{ + return APP_HEAP_SIZE; +} +int cmsis_get_user_thread_num(void) +{ + return USER_THREAD_NUM; +} diff --git a/workspace/echoreply_location/config/autosar_os_ext_user_config.h b/workspace/echoreply_location/config/autosar_os_ext_user_config.h new file mode 100644 index 0000000..bab78d3 --- /dev/null +++ b/workspace/echoreply_location/config/autosar_os_ext_user_config.h @@ -0,0 +1,22 @@ +#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ + +#include "cmsis_os.h" +#include "cmsis_config_utl.h" + +/*********************************************** + * + * MEMORY + * + ***********************************************/ +#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ + + +/*********************************************** + * + * THREAD + * + ***********************************************/ +#define USER_THREAD_NUM 9U + +#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_location/config/mros2_user_config.c b/workspace/echoreply_location/config/mros2_user_config.c new file mode 100644 index 0000000..7d2c110 --- /dev/null +++ b/workspace/echoreply_location/config/mros2_user_config.c @@ -0,0 +1,10 @@ + + +#define SUB_MSG_COUNT 10 + +int mros2_get_submsg_count(void) +{ + return SUB_MSG_COUNT; +} + + diff --git a/workspace/echoreply_location/config/task.cfg b/workspace/echoreply_location/config/task.cfg new file mode 100644 index 0000000..f577110 --- /dev/null +++ b/workspace/echoreply_location/config/task.cfg @@ -0,0 +1,24 @@ +#include "task_impl.h" + +CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); +CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); +CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); +CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); +CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); +CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); +CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); +CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); +CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); +CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); + +CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_location/task_impl.h b/workspace/echoreply_location/task_impl.h new file mode 100644 index 0000000..11e7a81 --- /dev/null +++ b/workspace/echoreply_location/task_impl.h @@ -0,0 +1,54 @@ +#ifndef _AUTOSAR_OS_EXT_TEST_H_ +#define _AUTOSAR_OS_EXT_TEST_H_ + +#include "cmsis_config_utl.h" + +extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); + +/* + * priorities of mROS 2 tasks for RTPS + * + * TODO: We assigned relatevely lower priorities for EthIfLinkTask and + * EthInputTask than the application. Check whether these are appropriate. + */ +#define MROS2_HIGH_PRIORITY MAIN_PRIORITY +#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 + +/* + * experimental: stack size of mROS 2 tasks for RTPS + * Each comment refers the location of original definition + */ +// application/include/lwipopt.h +// #define TCPIP_THREAD_STACKSIZE 1024 +#define MROS2_STACK_SIZE_TcpTask 1024 +// application/src/lwip.c +// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) +#define MROS2_STACK_SIZE_EthIfLinkTask 1024 +// application/src/ethernet.c +// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) +#define MROS2_STACK_SIZE_EthInputTask 350 +// embeddedRTPS/include/config.h +// const int HEARTBEAT_STACKSIZE = 1200; // byte +#define MROS2_STACK_SIZE_HBPubTask 1200 +#define MROS2_STACK_SIZE_HBSubTask 1200 +// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte +#define MROS2_STACK_SIZE_SPDPTask 550 +// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte +#define MROS2_STACK_SIZE_WriterTask 1100 +// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte +#define MROS2_STACK_SIZE_ReaderTask 1600 +// embeddedRTPS-STM32/stm32/Src/main.cpp +// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); +#define MROS2_STACK_SIZE_UserDefaultTask 250 + + +#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ From 36f1d2d642e1b32d15ea90f9508868c5209436af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 17:59:14 +0900 Subject: [PATCH 27/80] rename apps --- workspace/echoreply_health/app.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/echoreply_health/app.cpp b/workspace/echoreply_health/app.cpp index b32fd65..67fd1f7 100644 --- a/workspace/echoreply_health/app.cpp +++ b/workspace/echoreply_health/app.cpp @@ -26,7 +26,7 @@ void userCallback(health_msgs::msg::Health *msg) MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); } } - //pub.publish(*msg); + pub.publish(*msg); } int main(int argc, char * argv[]) From be266f989ea7b906db775137e95071c4cb056f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 18 Dec 2021 16:56:10 +0900 Subject: [PATCH 28/80] echoreply_health app modified --- workspace/Makefile | 29 ----------------------------- workspace/echoreply_health/app.cpp | 19 ++----------------- 2 files changed, 2 insertions(+), 46 deletions(-) delete mode 100644 workspace/Makefile diff --git a/workspace/Makefile b/workspace/Makefile deleted file mode 100644 index e2e8a0d..0000000 --- a/workspace/Makefile +++ /dev/null @@ -1,29 +0,0 @@ - -# get the app name with the argument of make -APPNAME := ${app} -BUILDSPACE := build - -BOARDNAME := NODE_F767ZI -BOARDPATH := /media/${USER}/${BOARDNAME} - -ifdef app -# nothing to do -else -usage: - @echo Please specify the application - @echo Usage Guide:make app="" -endif - -all: clean - @cd $(BUILDSPACE) && make -j4 -f Makefile.common app=${APPNAME} - @cp $(BUILDSPACE)/asp.bin . && cp $(BUILDSPACE)/asp.elf . - @echo "Build complete successfully" - @if [ -d "$(BOARDPATH)" ]; then \ - echo "Copying binary to the board..."; \ - cp asp.bin $(BOARDPATH); \ - echo "completed"; \ - fi - -clean: - @cd $(BUILDSPACE) && make -f Makefile.common clean - rm -f asp.* diff --git a/workspace/echoreply_health/app.cpp b/workspace/echoreply_health/app.cpp index 67fd1f7..18d2e5b 100644 --- a/workspace/echoreply_health/app.cpp +++ b/workspace/echoreply_health/app.cpp @@ -9,23 +9,8 @@ mros2::Publisher pub; void userCallback(health_msgs::msg::Health *msg) { - if (msg->weight==63.5) { - if (msg->name=="Hi"){ - MROS2_INFO("subscribed msg: { name: 'Hi', height: %u cm, weight: 63.5 kg }", msg->height); - MROS2_INFO("publishing msg: { name: 'Hi', height: %u cm, weight: 63.5 kg }", msg->height); - } else { - MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: 63.5 kg }", msg->name.c_str(), msg->height); - MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: 63.5 kg }", msg->name.c_str(), msg->height); - } - } else { - if (msg->name=="Hi"){ - MROS2_INFO("subscribed msg: { name: 'Hi', height: %u cm, weight: %f kg }", msg->height, msg->weight); - MROS2_INFO("publishing msg: { name: 'Hi', height: %u cm, weight: %f kg }", msg->height, msg->weight); - } else { - MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); - MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); - } - } + MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); + MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); pub.publish(*msg); } From e14a75769b102ebff27814de096d4ce824c0c862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 22 Dec 2021 12:15:46 +0900 Subject: [PATCH 29/80] uint32_array app added --- .../Makefile.inc | 0 .../README.md | 0 .../app.cdl | 0 .../app.cfg | 0 .../app.cpp | 10 +- .../app.h | 0 .../config/autosar_os_ext_asp3_user_config.c | 0 .../config/autosar_os_ext_asp3_user_config.h | 0 .../config/autosar_os_ext_user_config.c | 0 .../config/autosar_os_ext_user_config.h | 0 .../config/mros2_user_config.c | 0 .../config/task.cfg | 0 .../msg/FloatLocation.msg} | 0 .../msg_settings.json | 0 .../task_impl.c | 0 .../task_impl.h | 0 workspace/echoreply_uint16/app.cpp | 4 +- workspace/echoreply_uint32_array/Makefile.inc | 27 ++++ workspace/echoreply_uint32_array/README.md | 24 ++++ workspace/echoreply_uint32_array/app.cdl | 122 +++++++++++++++++ workspace/echoreply_uint32_array/app.cfg | 14 ++ workspace/echoreply_uint32_array/app.cpp | 46 +++++++ workspace/echoreply_uint32_array/app.h | 84 ++++++++++++ .../config/autosar_os_ext_asp3_user_config.c | 24 ++++ .../config/autosar_os_ext_asp3_user_config.h | 10 ++ .../config/autosar_os_ext_user_config.c | 75 +++++++++++ .../config/autosar_os_ext_user_config.h | 22 +++ .../config/mros2_user_config.c | 10 ++ .../echoreply_uint32_array/config/task.cfg | 24 ++++ workspace/echoreply_uint32_array/task_impl.c | 126 ++++++++++++++++++ workspace/echoreply_uint32_array/task_impl.h | 54 ++++++++ .../u_int32_array_msgs/msg/UInt32Array.msg | 1 + 32 files changed, 670 insertions(+), 7 deletions(-) rename workspace/{echoreply_flocation => echoreply_float_location}/Makefile.inc (100%) rename workspace/{echoreply_flocation => echoreply_float_location}/README.md (100%) rename workspace/{echoreply_flocation => echoreply_float_location}/app.cdl (100%) rename workspace/{echoreply_flocation => echoreply_float_location}/app.cfg (100%) rename workspace/{echoreply_flocation => echoreply_float_location}/app.cpp (65%) rename workspace/{echoreply_flocation => echoreply_float_location}/app.h (100%) rename workspace/{echoreply_flocation => echoreply_float_location}/config/autosar_os_ext_asp3_user_config.c (100%) rename workspace/{echoreply_flocation => echoreply_float_location}/config/autosar_os_ext_asp3_user_config.h (100%) rename workspace/{echoreply_flocation => echoreply_float_location}/config/autosar_os_ext_user_config.c (100%) rename workspace/{echoreply_flocation => echoreply_float_location}/config/autosar_os_ext_user_config.h (100%) rename workspace/{echoreply_flocation => echoreply_float_location}/config/mros2_user_config.c (100%) rename workspace/{echoreply_flocation => echoreply_float_location}/config/task.cfg (100%) rename workspace/{echoreply_flocation/flocation_msgs/msg/Flocation.msg => echoreply_float_location/float_location_msgs/msg/FloatLocation.msg} (100%) rename workspace/{echoreply_flocation => echoreply_float_location}/msg_settings.json (100%) rename workspace/{echoreply_flocation => echoreply_float_location}/task_impl.c (100%) rename workspace/{echoreply_flocation => echoreply_float_location}/task_impl.h (100%) create mode 100644 workspace/echoreply_uint32_array/Makefile.inc create mode 100644 workspace/echoreply_uint32_array/README.md create mode 100644 workspace/echoreply_uint32_array/app.cdl create mode 100644 workspace/echoreply_uint32_array/app.cfg create mode 100644 workspace/echoreply_uint32_array/app.cpp create mode 100644 workspace/echoreply_uint32_array/app.h create mode 100644 workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.c create mode 100644 workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.h create mode 100644 workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.c create mode 100644 workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.h create mode 100644 workspace/echoreply_uint32_array/config/mros2_user_config.c create mode 100644 workspace/echoreply_uint32_array/config/task.cfg create mode 100644 workspace/echoreply_uint32_array/task_impl.c create mode 100644 workspace/echoreply_uint32_array/task_impl.h create mode 100644 workspace/echoreply_uint32_array/u_int32_array_msgs/msg/UInt32Array.msg diff --git a/workspace/echoreply_flocation/Makefile.inc b/workspace/echoreply_float_location/Makefile.inc similarity index 100% rename from workspace/echoreply_flocation/Makefile.inc rename to workspace/echoreply_float_location/Makefile.inc diff --git a/workspace/echoreply_flocation/README.md b/workspace/echoreply_float_location/README.md similarity index 100% rename from workspace/echoreply_flocation/README.md rename to workspace/echoreply_float_location/README.md diff --git a/workspace/echoreply_flocation/app.cdl b/workspace/echoreply_float_location/app.cdl similarity index 100% rename from workspace/echoreply_flocation/app.cdl rename to workspace/echoreply_float_location/app.cdl diff --git a/workspace/echoreply_flocation/app.cfg b/workspace/echoreply_float_location/app.cfg similarity index 100% rename from workspace/echoreply_flocation/app.cfg rename to workspace/echoreply_float_location/app.cfg diff --git a/workspace/echoreply_flocation/app.cpp b/workspace/echoreply_float_location/app.cpp similarity index 65% rename from workspace/echoreply_flocation/app.cpp rename to workspace/echoreply_float_location/app.cpp index aca5fe3..c16a5ba 100644 --- a/workspace/echoreply_flocation/app.cpp +++ b/workspace/echoreply_float_location/app.cpp @@ -1,13 +1,13 @@ #include "app.h" #include "mros2.h" -#include "flocation_msgs/msg/flocation.hpp" +#include "float_location_msgs/msg/float_location.hpp" #include "stm32f7xx_nucleo_144.h" mros2::Subscriber sub; mros2::Publisher pub; -void userCallback(flocation_msgs::msg::Flocation *msg) +void userCallback(float_location_msgs::msg::FloatLocation *msg) { MROS2_INFO("subscribed msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); MROS2_INFO("publishing msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); @@ -23,9 +23,9 @@ int main(int argc, char * argv[]) BSP_LED_Toggle(LED1); mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - flocation_msgs::msg::Flocation msg; + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + float_location_msgs::msg::FloatLocation msg; MROS2_INFO("ready to pub/sub message"); mros2::spin(); diff --git a/workspace/echoreply_flocation/app.h b/workspace/echoreply_float_location/app.h similarity index 100% rename from workspace/echoreply_flocation/app.h rename to workspace/echoreply_float_location/app.h diff --git a/workspace/echoreply_flocation/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_float_location/config/autosar_os_ext_asp3_user_config.c similarity index 100% rename from workspace/echoreply_flocation/config/autosar_os_ext_asp3_user_config.c rename to workspace/echoreply_float_location/config/autosar_os_ext_asp3_user_config.c diff --git a/workspace/echoreply_flocation/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_float_location/config/autosar_os_ext_asp3_user_config.h similarity index 100% rename from workspace/echoreply_flocation/config/autosar_os_ext_asp3_user_config.h rename to workspace/echoreply_float_location/config/autosar_os_ext_asp3_user_config.h diff --git a/workspace/echoreply_flocation/config/autosar_os_ext_user_config.c b/workspace/echoreply_float_location/config/autosar_os_ext_user_config.c similarity index 100% rename from workspace/echoreply_flocation/config/autosar_os_ext_user_config.c rename to workspace/echoreply_float_location/config/autosar_os_ext_user_config.c diff --git a/workspace/echoreply_flocation/config/autosar_os_ext_user_config.h b/workspace/echoreply_float_location/config/autosar_os_ext_user_config.h similarity index 100% rename from workspace/echoreply_flocation/config/autosar_os_ext_user_config.h rename to workspace/echoreply_float_location/config/autosar_os_ext_user_config.h diff --git a/workspace/echoreply_flocation/config/mros2_user_config.c b/workspace/echoreply_float_location/config/mros2_user_config.c similarity index 100% rename from workspace/echoreply_flocation/config/mros2_user_config.c rename to workspace/echoreply_float_location/config/mros2_user_config.c diff --git a/workspace/echoreply_flocation/config/task.cfg b/workspace/echoreply_float_location/config/task.cfg similarity index 100% rename from workspace/echoreply_flocation/config/task.cfg rename to workspace/echoreply_float_location/config/task.cfg diff --git a/workspace/echoreply_flocation/flocation_msgs/msg/Flocation.msg b/workspace/echoreply_float_location/float_location_msgs/msg/FloatLocation.msg similarity index 100% rename from workspace/echoreply_flocation/flocation_msgs/msg/Flocation.msg rename to workspace/echoreply_float_location/float_location_msgs/msg/FloatLocation.msg diff --git a/workspace/echoreply_flocation/msg_settings.json b/workspace/echoreply_float_location/msg_settings.json similarity index 100% rename from workspace/echoreply_flocation/msg_settings.json rename to workspace/echoreply_float_location/msg_settings.json diff --git a/workspace/echoreply_flocation/task_impl.c b/workspace/echoreply_float_location/task_impl.c similarity index 100% rename from workspace/echoreply_flocation/task_impl.c rename to workspace/echoreply_float_location/task_impl.c diff --git a/workspace/echoreply_flocation/task_impl.h b/workspace/echoreply_float_location/task_impl.h similarity index 100% rename from workspace/echoreply_flocation/task_impl.h rename to workspace/echoreply_float_location/task_impl.h diff --git a/workspace/echoreply_uint16/app.cpp b/workspace/echoreply_uint16/app.cpp index ff1b004..35c9728 100644 --- a/workspace/echoreply_uint16/app.cpp +++ b/workspace/echoreply_uint16/app.cpp @@ -9,8 +9,8 @@ mros2::Publisher pub; void userCallback(std_msgs::msg::UInt16 *msg) { - MROS2_INFO("subscribed msg: %d", msg->data); - MROS2_INFO("publishing msg: %d", msg->data); + MROS2_INFO("subscribed msg: %u", msg->data); + MROS2_INFO("publishing msg: %u", msg->data); pub.publish(*msg); } diff --git a/workspace/echoreply_uint32_array/Makefile.inc b/workspace/echoreply_uint32_array/Makefile.inc new file mode 100644 index 0000000..f807ac1 --- /dev/null +++ b/workspace/echoreply_uint32_array/Makefile.inc @@ -0,0 +1,27 @@ +# +# Makefile definition for mros2 application +# + +# name of main application +APPLNAME = app + +# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) +# NOTE: also check `initLogMask` in app.cdl for syslog setting +CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 + +# information for directory tree +APPLDIR := $(APPDIR) +APPLDIR += $(APPDIR)/config + +# link option for C++ code +SRCLANG = c++ +APPL_CXXLIBS += -specs=nano.specs + +# compile switch +CDEFS += -DUSE_ASP3_FOR_STM + +# additional files for configuration +APPL_COBJS := task_impl.o +APPL_COBJS += autosar_os_ext_user_config.o +APPL_COBJS += autosar_os_ext_asp3_user_config.o +APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_uint32_array/README.md b/workspace/echoreply_uint32_array/README.md new file mode 100644 index 0000000..48267f4 --- /dev/null +++ b/workspace/echoreply_uint32_array/README.md @@ -0,0 +1,24 @@ +### uint16型通信動作確認用アプリ + +uint16型の通信の動作確認をするためのサンプルアプリです。 +以下の手順で確認できます。 + +1.workspaceディレクトリにて、`make app=echoreply_uint16` によりアプリをビルド + +2.Serial Console (picocomなど) を立ち上げて、初期化 + +3.hostのros2アプリからuint16型のmessageを送信 + +4.messageを受信、これを再びhostのros2アプリに向かって送信 (以下) + +``` +Subscribed msg : 1 +Publishing msg : 1 +Subscribed msg : 2 +Publishing msg : 2 +Subscribed msg : 3 +Publishing msg : 3 +Subscribed msg : 4 +Publishing msg : 4 +... +``` diff --git a/workspace/echoreply_uint32_array/app.cdl b/workspace/echoreply_uint32_array/app.cdl new file mode 100644 index 0000000..176c5a6 --- /dev/null +++ b/workspace/echoreply_uint32_array/app.cdl @@ -0,0 +1,122 @@ +/* + * サンプルプログラム(1)のコンポーネント記述ファイル + * + * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ + */ +/* + * カーネルオブジェクトの定義 + */ +import(); + +/* + * ターゲット非依存のセルタイプの定義 + */ +import("syssvc/tSerialPort.cdl"); +import("syssvc/tSerialAdapter.cdl"); +import("syssvc/tSysLog.cdl"); +import("syssvc/tSysLogAdapter.cdl"); +import("syssvc/tLogTask.cdl"); +import("syssvc/tBanner.cdl"); + +/* + * ターゲット依存部の取り込み + */ +import("target.cdl"); + +/* + * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" + * の行までのことを言う. + */ + +/* + * システムログ機能のアダプタの組上げ記述 + * + * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー + * スのシステムログ機能を呼び出すためのセルである.システムログ機能の + * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び + * 出さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSysLogAdapter SysLogAdapter { + cSysLog = SysLog.eSysLog; +}; + +/* + * シリアルインタフェースドライバのアダプタの組上げ記述 + * + * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー + * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための + * セルである.シリアルインタフェースドライバのサービスコールを呼び出 + * さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSerialAdapter SerialAdapter { + cSerialPort[0] = SerialPort1.eSerialPort; +}; + +/* + * システムログ機能の組上げ記述 + * + * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ + * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, + * システムログタスクはシステムログ機能を使用するため,それも外すこと + * が必要である.また,システムログ機能のアダプタも外さなければならな + * い.tecsgenが警告メッセージを出すが,無視してよい. + */ +cell tSysLog SysLog { + logBufferSize = 32; /* ログバッファのサイズ */ + initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); + /* ログバッファに記録すべき重要度 */ + initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); + /* 低レベル出力すべき重要度 */ + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * シリアルインタフェースドライバの組上げ記述 + * + * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 + * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー + * スドライバを使用するため,それも外すことが必要である.また,シリア + * ルインタフェースドライバのアダプタも外さなければならない. + */ +cell tSerialPort SerialPort1 { + receiveBufferSize = 256; /* 受信バッファのサイズ */ + sendBufferSize = 256; /* 送信バッファのサイズ */ + + /* ターゲット依存部との結合 */ + cSIOPort = SIOPortTarget1.eSIOPort; + eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ +}; + +/* + * システムログタスクの組上げ記述 + * + * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ + * ばよい. + */ +cell tLogTask LogTask { + priority = 3; /* システムログタスクの優先度 */ + stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ + + /* シリアルインタフェースドライバとの結合 */ + cSerialPort = SerialPort1.eSerialPort; + cnSerialPortManage = SerialPort1.enSerialPortManage; + + /* システムログ機能との結合 */ + cSysLog = SysLog.eSysLog; + + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * カーネル起動メッセージ出力の組上げ記述 + * + * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 + * を削除すればよい. + */ +cell tBanner Banner { + /* 属性の設定 */ + targetName = BannerTargetName; + copyrightNotice = BannerCopyrightNotice; +}; diff --git a/workspace/echoreply_uint32_array/app.cfg b/workspace/echoreply_uint32_array/app.cfg new file mode 100644 index 0000000..eb0495d --- /dev/null +++ b/workspace/echoreply_uint32_array/app.cfg @@ -0,0 +1,14 @@ +/* + * サンプルプログラム(1)のシステムコンフィギュレーションファイル + */ +INCLUDE("tecsgen.cfg"); +INCLUDE("asp3ext.cfg"); +INCLUDE("task.cfg"); + +#include "app.h" +#include "stm32f7xx_it.h" +CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); +CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); +CFG_INT(77, {TA_EDGE, -4}); + +CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_uint32_array/app.cpp b/workspace/echoreply_uint32_array/app.cpp new file mode 100644 index 0000000..ac48fd5 --- /dev/null +++ b/workspace/echoreply_uint32_array/app.cpp @@ -0,0 +1,46 @@ +#include "app.h" +#include "mros2.h" +#include "u_int32_msgs/msg/u_int32_array.hpp" + +#include "stm32f7xx_nucleo_144.h" + +mros2::Subscriber sub; +mros2::Publisher pub; + +void userCallback(std_msgs::msg::UInt32Array *msg) +{ + for (int i=0; idata.size(); i++){ + MROS2_INFO("subscribed msg: %u", msg->data[i]); + MROS2_INFO("publishing msg: %u", msg->data[i]); + } + pub.publish(*msg); +} + +int main(int argc, char * argv[]) +{ + MROS2_INFO("mROS 2 application is started"); + + mros2::init(argc, argv); + MROS2_DEBUG("mROS 2 initialization is completed"); + BSP_LED_Toggle(LED1); + + mros2::Node node = mros2::Node::create_node("mros2_node"); + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + std_msgs::msg::UInt32Array msg; + + MROS2_INFO("ready to pub/sub message"); + mros2::spin(); + BSP_LED_Toggle(LED3); +} + +void main_task(void) +{ + main(0, NULL); +} + +void +led_cyclic_handler(intptr_t exinf) +{ + BSP_LED_Toggle(LED2); +} diff --git a/workspace/echoreply_uint32_array/app.h b/workspace/echoreply_uint32_array/app.h new file mode 100644 index 0000000..36eb6cf --- /dev/null +++ b/workspace/echoreply_uint32_array/app.h @@ -0,0 +1,84 @@ +/* + * TOPPERS/ASP Kernel + * Toyohashi Open Platform for Embedded Real-Time Systems/ + * Advanced Standard Profile Kernel + * + * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory + * Toyohashi Univ. of Technology, JAPAN + * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory + * Graduate School of Information Science, Nagoya Univ., JAPAN + * + * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ + * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 + * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. + * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 + * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー + * スコード中に含まれていること. + * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 + * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 + * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 + * の無保証規定を掲載すること. + * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 + * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ + * と. + * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 + * 作権表示,この利用条件および下記の無保証規定を掲載すること. + * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに + * 報告すること. + * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 + * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. + * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 + * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを + * 免責すること. + * + * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お + * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 + * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ + * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ + * の責任を負わない. + * + * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ + */ + +/* + * header file for the mros2 application + */ + +#include + +/* + * Priorities for TOPPERS tasks + */ + +#define MAIN_PRIORITY 5 + +#define HIGH_PRIORITY 9 +#define MID_PRIORITY 10 +#define LOW_PRIORITY 11 + +/* + * Constants that may depend on the target + */ + +#ifndef TASK_PORTID +#define TASK_PORTID 1 +#endif /* TASK_PORTID */ + +#ifndef STACK_SIZE +#define STACK_SIZE 4096 +#endif /* STACK_SIZE */ + +/* + * Declaration of prototyle functions + */ +#ifndef TOPPERS_MACRO_ONLY +#ifdef __cplusplus +extern "C" { +#endif +void main_task(void); +extern void led_cyclic_handler(intptr_t exinf); +#ifdef __cplusplus +} +#endif +void Error_Handler(); +#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.c new file mode 100644 index 0000000..41ef1da --- /dev/null +++ b/workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.c @@ -0,0 +1,24 @@ +#include "autosar_os_ext_asp3_user_config.h" + +const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), +}; + +const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) +{ + return autosar_os_ext_flag_user_map; +} + +int cmsis_get_flag_user_num(void) +{ + return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; +} diff --git a/workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.h new file mode 100644 index 0000000..7ad08bf --- /dev/null +++ b/workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.h @@ -0,0 +1,10 @@ +#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ + +#include "cmsis_config_utl.h" + +#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) + +extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; + +#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.c b/workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.c new file mode 100644 index 0000000..940941b --- /dev/null +++ b/workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.c @@ -0,0 +1,75 @@ +#include "cmsis_os.h" +#include "autosar_os_ext_user_config.h" + +extern void tcpip_thread(void *arg); +extern void ethernetif_set_link(void* argument); +extern void ethernetif_input(void* argument); +extern void callHbPubFunc(void *arg); +extern void callHbSubFunc(void *arg); +extern void StartDefaultTask(void * argument); +extern void callWriterThreadFunction(void *arg); +extern void callReaderThreadFunction(void *arg); +extern void callRunBroadcast(void *args); +extern void mros2_init(void *args); + + +UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { + { + .taskID = AutosarOsExtTcpTask, + .func = tcpip_thread, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthIfLinkTask, + .func = ethernetif_set_link, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthInputTask, + .func = ethernetif_input, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBPubTask, + .func = callHbPubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBSubTask, + .func = callHbSubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtSPDPTask, + .func = callRunBroadcast, + .argument = NULL, + }, + { + .taskID = AutosarOsExtWriterTask, + .func = callWriterThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtReaderTask, + .func = callReaderThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtMROS2Task, + .func = mros2_init, + .argument = NULL, + }, +}; + +UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) +{ + return user_thread_autosar_ostask_map; +} +int cmsis_get_app_heap_size(void) +{ + return APP_HEAP_SIZE; +} +int cmsis_get_user_thread_num(void) +{ + return USER_THREAD_NUM; +} diff --git a/workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.h b/workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.h new file mode 100644 index 0000000..bab78d3 --- /dev/null +++ b/workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.h @@ -0,0 +1,22 @@ +#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ + +#include "cmsis_os.h" +#include "cmsis_config_utl.h" + +/*********************************************** + * + * MEMORY + * + ***********************************************/ +#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ + + +/*********************************************** + * + * THREAD + * + ***********************************************/ +#define USER_THREAD_NUM 9U + +#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_uint32_array/config/mros2_user_config.c b/workspace/echoreply_uint32_array/config/mros2_user_config.c new file mode 100644 index 0000000..7d2c110 --- /dev/null +++ b/workspace/echoreply_uint32_array/config/mros2_user_config.c @@ -0,0 +1,10 @@ + + +#define SUB_MSG_COUNT 10 + +int mros2_get_submsg_count(void) +{ + return SUB_MSG_COUNT; +} + + diff --git a/workspace/echoreply_uint32_array/config/task.cfg b/workspace/echoreply_uint32_array/config/task.cfg new file mode 100644 index 0000000..f577110 --- /dev/null +++ b/workspace/echoreply_uint32_array/config/task.cfg @@ -0,0 +1,24 @@ +#include "task_impl.h" + +CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); +CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); +CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); +CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); +CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); +CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); +CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); +CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); +CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); +CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); + +CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_uint32_array/task_impl.c b/workspace/echoreply_uint32_array/task_impl.c new file mode 100644 index 0000000..afb9fca --- /dev/null +++ b/workspace/echoreply_uint32_array/task_impl.c @@ -0,0 +1,126 @@ +#include "cmsis_os.h" +#include "cmsis_config_utl.h" +#include "task_impl.h" + +TASK(AutosarOsExtTcpTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthIfLinkTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthInputTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBPubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBSubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtSPDPTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtWriterTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtReaderTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtUserDefaultTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtMROS2Task) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} diff --git a/workspace/echoreply_uint32_array/task_impl.h b/workspace/echoreply_uint32_array/task_impl.h new file mode 100644 index 0000000..11e7a81 --- /dev/null +++ b/workspace/echoreply_uint32_array/task_impl.h @@ -0,0 +1,54 @@ +#ifndef _AUTOSAR_OS_EXT_TEST_H_ +#define _AUTOSAR_OS_EXT_TEST_H_ + +#include "cmsis_config_utl.h" + +extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); + +/* + * priorities of mROS 2 tasks for RTPS + * + * TODO: We assigned relatevely lower priorities for EthIfLinkTask and + * EthInputTask than the application. Check whether these are appropriate. + */ +#define MROS2_HIGH_PRIORITY MAIN_PRIORITY +#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 + +/* + * experimental: stack size of mROS 2 tasks for RTPS + * Each comment refers the location of original definition + */ +// application/include/lwipopt.h +// #define TCPIP_THREAD_STACKSIZE 1024 +#define MROS2_STACK_SIZE_TcpTask 1024 +// application/src/lwip.c +// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) +#define MROS2_STACK_SIZE_EthIfLinkTask 1024 +// application/src/ethernet.c +// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) +#define MROS2_STACK_SIZE_EthInputTask 350 +// embeddedRTPS/include/config.h +// const int HEARTBEAT_STACKSIZE = 1200; // byte +#define MROS2_STACK_SIZE_HBPubTask 1200 +#define MROS2_STACK_SIZE_HBSubTask 1200 +// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte +#define MROS2_STACK_SIZE_SPDPTask 550 +// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte +#define MROS2_STACK_SIZE_WriterTask 1100 +// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte +#define MROS2_STACK_SIZE_ReaderTask 1600 +// embeddedRTPS-STM32/stm32/Src/main.cpp +// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); +#define MROS2_STACK_SIZE_UserDefaultTask 250 + + +#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/echoreply_uint32_array/u_int32_array_msgs/msg/UInt32Array.msg b/workspace/echoreply_uint32_array/u_int32_array_msgs/msg/UInt32Array.msg new file mode 100644 index 0000000..7703e22 --- /dev/null +++ b/workspace/echoreply_uint32_array/u_int32_array_msgs/msg/UInt32Array.msg @@ -0,0 +1 @@ +uint32[] data \ No newline at end of file From 466225bc999e16a5ca94012bb4a3bc68b95006ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 22 Dec 2021 12:17:57 +0900 Subject: [PATCH 30/80] uint32_array app added --- workspace/echoreply_uint32_array/msg_settings.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 workspace/echoreply_uint32_array/msg_settings.json diff --git a/workspace/echoreply_uint32_array/msg_settings.json b/workspace/echoreply_uint32_array/msg_settings.json new file mode 100644 index 0000000..4e2fa6a --- /dev/null +++ b/workspace/echoreply_uint32_array/msg_settings.json @@ -0,0 +1,7 @@ +{ + "includingMsgs": [ + "u_int32_array_msgs/msg/UInt32Array.msg" + ], + "dependingPkgs": [ + ] +} \ No newline at end of file From 03f773b5ccd52419508b0950dfa24ab7523c1728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 22 Dec 2021 12:28:52 +0900 Subject: [PATCH 31/80] uint32_array app added --- workspace/echoreply_uint32_array/app.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/workspace/echoreply_uint32_array/app.cpp b/workspace/echoreply_uint32_array/app.cpp index ac48fd5..cb716f1 100644 --- a/workspace/echoreply_uint32_array/app.cpp +++ b/workspace/echoreply_uint32_array/app.cpp @@ -1,13 +1,13 @@ #include "app.h" #include "mros2.h" -#include "u_int32_msgs/msg/u_int32_array.hpp" +#include "u_int32_array_msgs/msg/u_int32_array.hpp" #include "stm32f7xx_nucleo_144.h" mros2::Subscriber sub; mros2::Publisher pub; -void userCallback(std_msgs::msg::UInt32Array *msg) +void userCallback(u_int32_array_msgs::msg::UInt32Array *msg) { for (int i=0; idata.size(); i++){ MROS2_INFO("subscribed msg: %u", msg->data[i]); @@ -25,9 +25,9 @@ int main(int argc, char * argv[]) BSP_LED_Toggle(LED1); mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - std_msgs::msg::UInt32Array msg; + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + u_int32_array_msgs::msg::UInt32Array msg; MROS2_INFO("ready to pub/sub message"); mros2::spin(); From fc92f29fd04c8213ecff8948ff2593d1e0ebeb4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 22 Dec 2021 16:37:09 +0900 Subject: [PATCH 32/80] echoreply_mix app added (support array) --- workspace/echoreply_float_location/app.cpp | 44 ------ .../float_location_msgs/msg/FloatLocation.msg | 3 - .../Makefile.inc | 0 .../README.md | 0 .../app.cdl | 0 .../app.cfg | 0 workspace/echoreply_mix/app.cpp | 44 ++++++ .../app.h | 0 .../config/autosar_os_ext_asp3_user_config.c | 0 .../config/autosar_os_ext_asp3_user_config.h | 0 .../config/autosar_os_ext_user_config.c | 0 .../config/autosar_os_ext_user_config.h | 0 .../config/mros2_user_config.c | 0 .../config/task.cfg | 0 workspace/echoreply_mix/mix_msgs/msg/Mix.msg | 4 + .../msg_settings.json | 2 +- .../task_impl.c | 0 .../task_impl.h | 0 workspace/echoreply_uint32_array/Makefile.inc | 27 ---- workspace/echoreply_uint32_array/README.md | 24 ---- workspace/echoreply_uint32_array/app.cdl | 122 ----------------- workspace/echoreply_uint32_array/app.cfg | 14 -- workspace/echoreply_uint32_array/app.cpp | 46 ------- workspace/echoreply_uint32_array/app.h | 84 ------------ .../config/autosar_os_ext_asp3_user_config.c | 24 ---- .../config/autosar_os_ext_asp3_user_config.h | 10 -- .../config/autosar_os_ext_user_config.c | 75 ----------- .../config/autosar_os_ext_user_config.h | 22 --- .../config/mros2_user_config.c | 10 -- .../echoreply_uint32_array/config/task.cfg | 24 ---- .../echoreply_uint32_array/msg_settings.json | 7 - workspace/echoreply_uint32_array/task_impl.c | 126 ------------------ workspace/echoreply_uint32_array/task_impl.h | 54 -------- .../u_int32_array_msgs/msg/UInt32Array.msg | 1 - 34 files changed, 49 insertions(+), 718 deletions(-) delete mode 100644 workspace/echoreply_float_location/app.cpp delete mode 100644 workspace/echoreply_float_location/float_location_msgs/msg/FloatLocation.msg rename workspace/{echoreply_float_location => echoreply_mix}/Makefile.inc (100%) rename workspace/{echoreply_float_location => echoreply_mix}/README.md (100%) rename workspace/{echoreply_float_location => echoreply_mix}/app.cdl (100%) rename workspace/{echoreply_float_location => echoreply_mix}/app.cfg (100%) create mode 100644 workspace/echoreply_mix/app.cpp rename workspace/{echoreply_float_location => echoreply_mix}/app.h (100%) rename workspace/{echoreply_float_location => echoreply_mix}/config/autosar_os_ext_asp3_user_config.c (100%) rename workspace/{echoreply_float_location => echoreply_mix}/config/autosar_os_ext_asp3_user_config.h (100%) rename workspace/{echoreply_float_location => echoreply_mix}/config/autosar_os_ext_user_config.c (100%) rename workspace/{echoreply_float_location => echoreply_mix}/config/autosar_os_ext_user_config.h (100%) rename workspace/{echoreply_float_location => echoreply_mix}/config/mros2_user_config.c (100%) rename workspace/{echoreply_float_location => echoreply_mix}/config/task.cfg (100%) create mode 100644 workspace/echoreply_mix/mix_msgs/msg/Mix.msg rename workspace/{echoreply_float_location => echoreply_mix}/msg_settings.json (60%) rename workspace/{echoreply_float_location => echoreply_mix}/task_impl.c (100%) rename workspace/{echoreply_float_location => echoreply_mix}/task_impl.h (100%) delete mode 100644 workspace/echoreply_uint32_array/Makefile.inc delete mode 100644 workspace/echoreply_uint32_array/README.md delete mode 100644 workspace/echoreply_uint32_array/app.cdl delete mode 100644 workspace/echoreply_uint32_array/app.cfg delete mode 100644 workspace/echoreply_uint32_array/app.cpp delete mode 100644 workspace/echoreply_uint32_array/app.h delete mode 100644 workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.c delete mode 100644 workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.h delete mode 100644 workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.c delete mode 100644 workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.h delete mode 100644 workspace/echoreply_uint32_array/config/mros2_user_config.c delete mode 100644 workspace/echoreply_uint32_array/config/task.cfg delete mode 100644 workspace/echoreply_uint32_array/msg_settings.json delete mode 100644 workspace/echoreply_uint32_array/task_impl.c delete mode 100644 workspace/echoreply_uint32_array/task_impl.h delete mode 100644 workspace/echoreply_uint32_array/u_int32_array_msgs/msg/UInt32Array.msg diff --git a/workspace/echoreply_float_location/app.cpp b/workspace/echoreply_float_location/app.cpp deleted file mode 100644 index c16a5ba..0000000 --- a/workspace/echoreply_float_location/app.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "app.h" -#include "mros2.h" -#include "float_location_msgs/msg/float_location.hpp" - -#include "stm32f7xx_nucleo_144.h" - -mros2::Subscriber sub; -mros2::Publisher pub; - -void userCallback(float_location_msgs::msg::FloatLocation *msg) -{ - MROS2_INFO("subscribed msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); - MROS2_INFO("publishing msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); - pub.publish(*msg); -} - -int main(int argc, char * argv[]) -{ - MROS2_INFO("mROS 2 application is started"); - - mros2::init(argc, argv); - MROS2_DEBUG("mROS 2 initialization is completed"); - BSP_LED_Toggle(LED1); - - mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - float_location_msgs::msg::FloatLocation msg; - - MROS2_INFO("ready to pub/sub message"); - mros2::spin(); - BSP_LED_Toggle(LED3); -} - -void main_task(void) -{ - main(0, NULL); -} - -void -led_cyclic_handler(intptr_t exinf) -{ - BSP_LED_Toggle(LED2); -} \ No newline at end of file diff --git a/workspace/echoreply_float_location/float_location_msgs/msg/FloatLocation.msg b/workspace/echoreply_float_location/float_location_msgs/msg/FloatLocation.msg deleted file mode 100644 index 0fb5429..0000000 --- a/workspace/echoreply_float_location/float_location_msgs/msg/FloatLocation.msg +++ /dev/null @@ -1,3 +0,0 @@ -float32 x -float32 y -float32 z \ No newline at end of file diff --git a/workspace/echoreply_float_location/Makefile.inc b/workspace/echoreply_mix/Makefile.inc similarity index 100% rename from workspace/echoreply_float_location/Makefile.inc rename to workspace/echoreply_mix/Makefile.inc diff --git a/workspace/echoreply_float_location/README.md b/workspace/echoreply_mix/README.md similarity index 100% rename from workspace/echoreply_float_location/README.md rename to workspace/echoreply_mix/README.md diff --git a/workspace/echoreply_float_location/app.cdl b/workspace/echoreply_mix/app.cdl similarity index 100% rename from workspace/echoreply_float_location/app.cdl rename to workspace/echoreply_mix/app.cdl diff --git a/workspace/echoreply_float_location/app.cfg b/workspace/echoreply_mix/app.cfg similarity index 100% rename from workspace/echoreply_float_location/app.cfg rename to workspace/echoreply_mix/app.cfg diff --git a/workspace/echoreply_mix/app.cpp b/workspace/echoreply_mix/app.cpp new file mode 100644 index 0000000..1bf72f8 --- /dev/null +++ b/workspace/echoreply_mix/app.cpp @@ -0,0 +1,44 @@ +#include "app.h" +#include "mros2.h" +#include "mix_msgs/msg/mix.hpp" + +#include "stm32f7xx_nucleo_144.h" + +mros2::Subscriber sub; +mros2::Publisher pub; + +void userCallback(mix_msgs::msg::Mix *msg) +{ + MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg, array: {%u,%u,%u} }", msg->name.c_str(), msg->height, msg->weight, msg->array[0], msg->array[1], msg->array[2]); + MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg, array: {%u,%u,%u} }", msg->name.c_str(), msg->height, msg->weight, msg->array[0], msg->array[1], msg->array[2]); + pub.publish(*msg); +} + +int main(int argc, char * argv[]) +{ + MROS2_INFO("mROS 2 application is started"); + + mros2::init(argc, argv); + MROS2_DEBUG("mROS 2 initialization is completed"); + BSP_LED_Toggle(LED1); + + mros2::Node node = mros2::Node::create_node("mros2_node"); + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + mix_msgs::msg::Mix msg; + + MROS2_INFO("ready to pub/sub message"); + mros2::spin(); + BSP_LED_Toggle(LED3); +} + +void main_task(void) +{ + main(0, NULL); +} + +void +led_cyclic_handler(intptr_t exinf) +{ + BSP_LED_Toggle(LED2); +} \ No newline at end of file diff --git a/workspace/echoreply_float_location/app.h b/workspace/echoreply_mix/app.h similarity index 100% rename from workspace/echoreply_float_location/app.h rename to workspace/echoreply_mix/app.h diff --git a/workspace/echoreply_float_location/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_mix/config/autosar_os_ext_asp3_user_config.c similarity index 100% rename from workspace/echoreply_float_location/config/autosar_os_ext_asp3_user_config.c rename to workspace/echoreply_mix/config/autosar_os_ext_asp3_user_config.c diff --git a/workspace/echoreply_float_location/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_mix/config/autosar_os_ext_asp3_user_config.h similarity index 100% rename from workspace/echoreply_float_location/config/autosar_os_ext_asp3_user_config.h rename to workspace/echoreply_mix/config/autosar_os_ext_asp3_user_config.h diff --git a/workspace/echoreply_float_location/config/autosar_os_ext_user_config.c b/workspace/echoreply_mix/config/autosar_os_ext_user_config.c similarity index 100% rename from workspace/echoreply_float_location/config/autosar_os_ext_user_config.c rename to workspace/echoreply_mix/config/autosar_os_ext_user_config.c diff --git a/workspace/echoreply_float_location/config/autosar_os_ext_user_config.h b/workspace/echoreply_mix/config/autosar_os_ext_user_config.h similarity index 100% rename from workspace/echoreply_float_location/config/autosar_os_ext_user_config.h rename to workspace/echoreply_mix/config/autosar_os_ext_user_config.h diff --git a/workspace/echoreply_float_location/config/mros2_user_config.c b/workspace/echoreply_mix/config/mros2_user_config.c similarity index 100% rename from workspace/echoreply_float_location/config/mros2_user_config.c rename to workspace/echoreply_mix/config/mros2_user_config.c diff --git a/workspace/echoreply_float_location/config/task.cfg b/workspace/echoreply_mix/config/task.cfg similarity index 100% rename from workspace/echoreply_float_location/config/task.cfg rename to workspace/echoreply_mix/config/task.cfg diff --git a/workspace/echoreply_mix/mix_msgs/msg/Mix.msg b/workspace/echoreply_mix/mix_msgs/msg/Mix.msg new file mode 100644 index 0000000..1b8f5db --- /dev/null +++ b/workspace/echoreply_mix/mix_msgs/msg/Mix.msg @@ -0,0 +1,4 @@ +string name +uint16 height +float32 weight +uint32[] array \ No newline at end of file diff --git a/workspace/echoreply_float_location/msg_settings.json b/workspace/echoreply_mix/msg_settings.json similarity index 60% rename from workspace/echoreply_float_location/msg_settings.json rename to workspace/echoreply_mix/msg_settings.json index 288bcb6..2020f4a 100644 --- a/workspace/echoreply_float_location/msg_settings.json +++ b/workspace/echoreply_mix/msg_settings.json @@ -1,6 +1,6 @@ { "includingMsgs": [ - "flocation_msgs/msg/Flocation.msg" + "mix_msgs/msg/Mix.msg" ], "dependingPkgs": [ ] diff --git a/workspace/echoreply_float_location/task_impl.c b/workspace/echoreply_mix/task_impl.c similarity index 100% rename from workspace/echoreply_float_location/task_impl.c rename to workspace/echoreply_mix/task_impl.c diff --git a/workspace/echoreply_float_location/task_impl.h b/workspace/echoreply_mix/task_impl.h similarity index 100% rename from workspace/echoreply_float_location/task_impl.h rename to workspace/echoreply_mix/task_impl.h diff --git a/workspace/echoreply_uint32_array/Makefile.inc b/workspace/echoreply_uint32_array/Makefile.inc deleted file mode 100644 index f807ac1..0000000 --- a/workspace/echoreply_uint32_array/Makefile.inc +++ /dev/null @@ -1,27 +0,0 @@ -# -# Makefile definition for mros2 application -# - -# name of main application -APPLNAME = app - -# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) -# NOTE: also check `initLogMask` in app.cdl for syslog setting -CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 - -# information for directory tree -APPLDIR := $(APPDIR) -APPLDIR += $(APPDIR)/config - -# link option for C++ code -SRCLANG = c++ -APPL_CXXLIBS += -specs=nano.specs - -# compile switch -CDEFS += -DUSE_ASP3_FOR_STM - -# additional files for configuration -APPL_COBJS := task_impl.o -APPL_COBJS += autosar_os_ext_user_config.o -APPL_COBJS += autosar_os_ext_asp3_user_config.o -APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_uint32_array/README.md b/workspace/echoreply_uint32_array/README.md deleted file mode 100644 index 48267f4..0000000 --- a/workspace/echoreply_uint32_array/README.md +++ /dev/null @@ -1,24 +0,0 @@ -### uint16型通信動作確認用アプリ - -uint16型の通信の動作確認をするためのサンプルアプリです。 -以下の手順で確認できます。 - -1.workspaceディレクトリにて、`make app=echoreply_uint16` によりアプリをビルド - -2.Serial Console (picocomなど) を立ち上げて、初期化 - -3.hostのros2アプリからuint16型のmessageを送信 - -4.messageを受信、これを再びhostのros2アプリに向かって送信 (以下) - -``` -Subscribed msg : 1 -Publishing msg : 1 -Subscribed msg : 2 -Publishing msg : 2 -Subscribed msg : 3 -Publishing msg : 3 -Subscribed msg : 4 -Publishing msg : 4 -... -``` diff --git a/workspace/echoreply_uint32_array/app.cdl b/workspace/echoreply_uint32_array/app.cdl deleted file mode 100644 index 176c5a6..0000000 --- a/workspace/echoreply_uint32_array/app.cdl +++ /dev/null @@ -1,122 +0,0 @@ -/* - * サンプルプログラム(1)のコンポーネント記述ファイル - * - * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ - */ -/* - * カーネルオブジェクトの定義 - */ -import(); - -/* - * ターゲット非依存のセルタイプの定義 - */ -import("syssvc/tSerialPort.cdl"); -import("syssvc/tSerialAdapter.cdl"); -import("syssvc/tSysLog.cdl"); -import("syssvc/tSysLogAdapter.cdl"); -import("syssvc/tLogTask.cdl"); -import("syssvc/tBanner.cdl"); - -/* - * ターゲット依存部の取り込み - */ -import("target.cdl"); - -/* - * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" - * の行までのことを言う. - */ - -/* - * システムログ機能のアダプタの組上げ記述 - * - * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー - * スのシステムログ機能を呼び出すためのセルである.システムログ機能の - * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び - * 出さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSysLogAdapter SysLogAdapter { - cSysLog = SysLog.eSysLog; -}; - -/* - * シリアルインタフェースドライバのアダプタの組上げ記述 - * - * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー - * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための - * セルである.シリアルインタフェースドライバのサービスコールを呼び出 - * さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSerialAdapter SerialAdapter { - cSerialPort[0] = SerialPort1.eSerialPort; -}; - -/* - * システムログ機能の組上げ記述 - * - * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ - * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, - * システムログタスクはシステムログ機能を使用するため,それも外すこと - * が必要である.また,システムログ機能のアダプタも外さなければならな - * い.tecsgenが警告メッセージを出すが,無視してよい. - */ -cell tSysLog SysLog { - logBufferSize = 32; /* ログバッファのサイズ */ - initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); - /* ログバッファに記録すべき重要度 */ - initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); - /* 低レベル出力すべき重要度 */ - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * シリアルインタフェースドライバの組上げ記述 - * - * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 - * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー - * スドライバを使用するため,それも外すことが必要である.また,シリア - * ルインタフェースドライバのアダプタも外さなければならない. - */ -cell tSerialPort SerialPort1 { - receiveBufferSize = 256; /* 受信バッファのサイズ */ - sendBufferSize = 256; /* 送信バッファのサイズ */ - - /* ターゲット依存部との結合 */ - cSIOPort = SIOPortTarget1.eSIOPort; - eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ -}; - -/* - * システムログタスクの組上げ記述 - * - * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ - * ばよい. - */ -cell tLogTask LogTask { - priority = 3; /* システムログタスクの優先度 */ - stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ - - /* シリアルインタフェースドライバとの結合 */ - cSerialPort = SerialPort1.eSerialPort; - cnSerialPortManage = SerialPort1.enSerialPortManage; - - /* システムログ機能との結合 */ - cSysLog = SysLog.eSysLog; - - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * カーネル起動メッセージ出力の組上げ記述 - * - * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 - * を削除すればよい. - */ -cell tBanner Banner { - /* 属性の設定 */ - targetName = BannerTargetName; - copyrightNotice = BannerCopyrightNotice; -}; diff --git a/workspace/echoreply_uint32_array/app.cfg b/workspace/echoreply_uint32_array/app.cfg deleted file mode 100644 index eb0495d..0000000 --- a/workspace/echoreply_uint32_array/app.cfg +++ /dev/null @@ -1,14 +0,0 @@ -/* - * サンプルプログラム(1)のシステムコンフィギュレーションファイル - */ -INCLUDE("tecsgen.cfg"); -INCLUDE("asp3ext.cfg"); -INCLUDE("task.cfg"); - -#include "app.h" -#include "stm32f7xx_it.h" -CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); -CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); -CFG_INT(77, {TA_EDGE, -4}); - -CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_uint32_array/app.cpp b/workspace/echoreply_uint32_array/app.cpp deleted file mode 100644 index cb716f1..0000000 --- a/workspace/echoreply_uint32_array/app.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "app.h" -#include "mros2.h" -#include "u_int32_array_msgs/msg/u_int32_array.hpp" - -#include "stm32f7xx_nucleo_144.h" - -mros2::Subscriber sub; -mros2::Publisher pub; - -void userCallback(u_int32_array_msgs::msg::UInt32Array *msg) -{ - for (int i=0; idata.size(); i++){ - MROS2_INFO("subscribed msg: %u", msg->data[i]); - MROS2_INFO("publishing msg: %u", msg->data[i]); - } - pub.publish(*msg); -} - -int main(int argc, char * argv[]) -{ - MROS2_INFO("mROS 2 application is started"); - - mros2::init(argc, argv); - MROS2_DEBUG("mROS 2 initialization is completed"); - BSP_LED_Toggle(LED1); - - mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - u_int32_array_msgs::msg::UInt32Array msg; - - MROS2_INFO("ready to pub/sub message"); - mros2::spin(); - BSP_LED_Toggle(LED3); -} - -void main_task(void) -{ - main(0, NULL); -} - -void -led_cyclic_handler(intptr_t exinf) -{ - BSP_LED_Toggle(LED2); -} diff --git a/workspace/echoreply_uint32_array/app.h b/workspace/echoreply_uint32_array/app.h deleted file mode 100644 index 36eb6cf..0000000 --- a/workspace/echoreply_uint32_array/app.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * TOPPERS/ASP Kernel - * Toyohashi Open Platform for Embedded Real-Time Systems/ - * Advanced Standard Profile Kernel - * - * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory - * Toyohashi Univ. of Technology, JAPAN - * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory - * Graduate School of Information Science, Nagoya Univ., JAPAN - * - * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ - * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 - * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. - * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 - * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー - * スコード中に含まれていること. - * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 - * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 - * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 - * の無保証規定を掲載すること. - * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 - * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ - * と. - * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 - * 作権表示,この利用条件および下記の無保証規定を掲載すること. - * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに - * 報告すること. - * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 - * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. - * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 - * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを - * 免責すること. - * - * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お - * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 - * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ - * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ - * の責任を負わない. - * - * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ - */ - -/* - * header file for the mros2 application - */ - -#include - -/* - * Priorities for TOPPERS tasks - */ - -#define MAIN_PRIORITY 5 - -#define HIGH_PRIORITY 9 -#define MID_PRIORITY 10 -#define LOW_PRIORITY 11 - -/* - * Constants that may depend on the target - */ - -#ifndef TASK_PORTID -#define TASK_PORTID 1 -#endif /* TASK_PORTID */ - -#ifndef STACK_SIZE -#define STACK_SIZE 4096 -#endif /* STACK_SIZE */ - -/* - * Declaration of prototyle functions - */ -#ifndef TOPPERS_MACRO_ONLY -#ifdef __cplusplus -extern "C" { -#endif -void main_task(void); -extern void led_cyclic_handler(intptr_t exinf); -#ifdef __cplusplus -} -#endif -void Error_Handler(); -#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.c deleted file mode 100644 index 41ef1da..0000000 --- a/workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "autosar_os_ext_asp3_user_config.h" - -const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), -}; - -const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) -{ - return autosar_os_ext_flag_user_map; -} - -int cmsis_get_flag_user_num(void) -{ - return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; -} diff --git a/workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.h deleted file mode 100644 index 7ad08bf..0000000 --- a/workspace/echoreply_uint32_array/config/autosar_os_ext_asp3_user_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ - -#include "cmsis_config_utl.h" - -#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) - -extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; - -#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.c b/workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.c deleted file mode 100644 index 940941b..0000000 --- a/workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "cmsis_os.h" -#include "autosar_os_ext_user_config.h" - -extern void tcpip_thread(void *arg); -extern void ethernetif_set_link(void* argument); -extern void ethernetif_input(void* argument); -extern void callHbPubFunc(void *arg); -extern void callHbSubFunc(void *arg); -extern void StartDefaultTask(void * argument); -extern void callWriterThreadFunction(void *arg); -extern void callReaderThreadFunction(void *arg); -extern void callRunBroadcast(void *args); -extern void mros2_init(void *args); - - -UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { - { - .taskID = AutosarOsExtTcpTask, - .func = tcpip_thread, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthIfLinkTask, - .func = ethernetif_set_link, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthInputTask, - .func = ethernetif_input, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBPubTask, - .func = callHbPubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBSubTask, - .func = callHbSubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtSPDPTask, - .func = callRunBroadcast, - .argument = NULL, - }, - { - .taskID = AutosarOsExtWriterTask, - .func = callWriterThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtReaderTask, - .func = callReaderThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtMROS2Task, - .func = mros2_init, - .argument = NULL, - }, -}; - -UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) -{ - return user_thread_autosar_ostask_map; -} -int cmsis_get_app_heap_size(void) -{ - return APP_HEAP_SIZE; -} -int cmsis_get_user_thread_num(void) -{ - return USER_THREAD_NUM; -} diff --git a/workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.h b/workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.h deleted file mode 100644 index bab78d3..0000000 --- a/workspace/echoreply_uint32_array/config/autosar_os_ext_user_config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ - -#include "cmsis_os.h" -#include "cmsis_config_utl.h" - -/*********************************************** - * - * MEMORY - * - ***********************************************/ -#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ - - -/*********************************************** - * - * THREAD - * - ***********************************************/ -#define USER_THREAD_NUM 9U - -#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_uint32_array/config/mros2_user_config.c b/workspace/echoreply_uint32_array/config/mros2_user_config.c deleted file mode 100644 index 7d2c110..0000000 --- a/workspace/echoreply_uint32_array/config/mros2_user_config.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#define SUB_MSG_COUNT 10 - -int mros2_get_submsg_count(void) -{ - return SUB_MSG_COUNT; -} - - diff --git a/workspace/echoreply_uint32_array/config/task.cfg b/workspace/echoreply_uint32_array/config/task.cfg deleted file mode 100644 index f577110..0000000 --- a/workspace/echoreply_uint32_array/config/task.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#include "task_impl.h" - -CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); -CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); -CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); -CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); -CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); -CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); -CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); -CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); -CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); -CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); - -CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_uint32_array/msg_settings.json b/workspace/echoreply_uint32_array/msg_settings.json deleted file mode 100644 index 4e2fa6a..0000000 --- a/workspace/echoreply_uint32_array/msg_settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "includingMsgs": [ - "u_int32_array_msgs/msg/UInt32Array.msg" - ], - "dependingPkgs": [ - ] -} \ No newline at end of file diff --git a/workspace/echoreply_uint32_array/task_impl.c b/workspace/echoreply_uint32_array/task_impl.c deleted file mode 100644 index afb9fca..0000000 --- a/workspace/echoreply_uint32_array/task_impl.c +++ /dev/null @@ -1,126 +0,0 @@ -#include "cmsis_os.h" -#include "cmsis_config_utl.h" -#include "task_impl.h" - -TASK(AutosarOsExtTcpTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthIfLinkTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthInputTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBPubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBSubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtSPDPTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtWriterTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtReaderTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtUserDefaultTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtMROS2Task) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} diff --git a/workspace/echoreply_uint32_array/task_impl.h b/workspace/echoreply_uint32_array/task_impl.h deleted file mode 100644 index 11e7a81..0000000 --- a/workspace/echoreply_uint32_array/task_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_TEST_H_ -#define _AUTOSAR_OS_EXT_TEST_H_ - -#include "cmsis_config_utl.h" - -extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); - -/* - * priorities of mROS 2 tasks for RTPS - * - * TODO: We assigned relatevely lower priorities for EthIfLinkTask and - * EthInputTask than the application. Check whether these are appropriate. - */ -#define MROS2_HIGH_PRIORITY MAIN_PRIORITY -#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 - -/* - * experimental: stack size of mROS 2 tasks for RTPS - * Each comment refers the location of original definition - */ -// application/include/lwipopt.h -// #define TCPIP_THREAD_STACKSIZE 1024 -#define MROS2_STACK_SIZE_TcpTask 1024 -// application/src/lwip.c -// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) -#define MROS2_STACK_SIZE_EthIfLinkTask 1024 -// application/src/ethernet.c -// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) -#define MROS2_STACK_SIZE_EthInputTask 350 -// embeddedRTPS/include/config.h -// const int HEARTBEAT_STACKSIZE = 1200; // byte -#define MROS2_STACK_SIZE_HBPubTask 1200 -#define MROS2_STACK_SIZE_HBSubTask 1200 -// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte -#define MROS2_STACK_SIZE_SPDPTask 550 -// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte -#define MROS2_STACK_SIZE_WriterTask 1100 -// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte -#define MROS2_STACK_SIZE_ReaderTask 1600 -// embeddedRTPS-STM32/stm32/Src/main.cpp -// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); -#define MROS2_STACK_SIZE_UserDefaultTask 250 - - -#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/echoreply_uint32_array/u_int32_array_msgs/msg/UInt32Array.msg b/workspace/echoreply_uint32_array/u_int32_array_msgs/msg/UInt32Array.msg deleted file mode 100644 index 7703e22..0000000 --- a/workspace/echoreply_uint32_array/u_int32_array_msgs/msg/UInt32Array.msg +++ /dev/null @@ -1 +0,0 @@ -uint32[] data \ No newline at end of file From 079ac907a07ca8fe25c3b36f32f074cff27407c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 23 Dec 2021 00:20:03 +0900 Subject: [PATCH 33/80] vector3 app added --- workspace/echoreply_mix/mix_msgs/msg/Mix.msg | 2 +- workspace/echoreply_vector3/Makefile.inc | 27 ++++ workspace/echoreply_vector3/README.md | 68 ++++++++++ workspace/echoreply_vector3/app.cdl | 122 +++++++++++++++++ workspace/echoreply_vector3/app.cfg | 14 ++ workspace/echoreply_vector3/app.cpp | 44 ++++++ workspace/echoreply_vector3/app.h | 84 ++++++++++++ .../config/autosar_os_ext_asp3_user_config.c | 24 ++++ .../config/autosar_os_ext_asp3_user_config.h | 10 ++ .../config/autosar_os_ext_user_config.c | 75 +++++++++++ .../config/autosar_os_ext_user_config.h | 22 +++ .../config/mros2_user_config.c | 10 ++ workspace/echoreply_vector3/config/task.cfg | 24 ++++ .../geometry_msgs/msg/Vector3.msg | 3 + workspace/echoreply_vector3/msg_settings.json | 7 + workspace/echoreply_vector3/task_impl.c | 126 ++++++++++++++++++ workspace/echoreply_vector3/task_impl.h | 54 ++++++++ 17 files changed, 715 insertions(+), 1 deletion(-) create mode 100644 workspace/echoreply_vector3/Makefile.inc create mode 100644 workspace/echoreply_vector3/README.md create mode 100644 workspace/echoreply_vector3/app.cdl create mode 100644 workspace/echoreply_vector3/app.cfg create mode 100644 workspace/echoreply_vector3/app.cpp create mode 100644 workspace/echoreply_vector3/app.h create mode 100644 workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.c create mode 100644 workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.h create mode 100644 workspace/echoreply_vector3/config/autosar_os_ext_user_config.c create mode 100644 workspace/echoreply_vector3/config/autosar_os_ext_user_config.h create mode 100644 workspace/echoreply_vector3/config/mros2_user_config.c create mode 100644 workspace/echoreply_vector3/config/task.cfg create mode 100644 workspace/echoreply_vector3/geometry_msgs/msg/Vector3.msg create mode 100644 workspace/echoreply_vector3/msg_settings.json create mode 100644 workspace/echoreply_vector3/task_impl.c create mode 100644 workspace/echoreply_vector3/task_impl.h diff --git a/workspace/echoreply_mix/mix_msgs/msg/Mix.msg b/workspace/echoreply_mix/mix_msgs/msg/Mix.msg index 1b8f5db..4e55741 100644 --- a/workspace/echoreply_mix/mix_msgs/msg/Mix.msg +++ b/workspace/echoreply_mix/mix_msgs/msg/Mix.msg @@ -1,4 +1,4 @@ string name uint16 height float32 weight -uint32[] array \ No newline at end of file +uint16[] array \ No newline at end of file diff --git a/workspace/echoreply_vector3/Makefile.inc b/workspace/echoreply_vector3/Makefile.inc new file mode 100644 index 0000000..f807ac1 --- /dev/null +++ b/workspace/echoreply_vector3/Makefile.inc @@ -0,0 +1,27 @@ +# +# Makefile definition for mros2 application +# + +# name of main application +APPLNAME = app + +# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) +# NOTE: also check `initLogMask` in app.cdl for syslog setting +CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 + +# information for directory tree +APPLDIR := $(APPDIR) +APPLDIR += $(APPDIR)/config + +# link option for C++ code +SRCLANG = c++ +APPL_CXXLIBS += -specs=nano.specs + +# compile switch +CDEFS += -DUSE_ASP3_FOR_STM + +# additional files for configuration +APPL_COBJS := task_impl.o +APPL_COBJS += autosar_os_ext_user_config.o +APPL_COBJS += autosar_os_ext_asp3_user_config.o +APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_vector3/README.md b/workspace/echoreply_vector3/README.md new file mode 100644 index 0000000..a6ee6cb --- /dev/null +++ b/workspace/echoreply_vector3/README.md @@ -0,0 +1,68 @@ +### EmbeddedRTPS動作確認用アプリ + +EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 +利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 + +#### LINUX側の準備 +1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします +``` +git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 +``` +2. 通信用アプリをビルドします +``` +cd embeddedRTPS-STM32 +cd linux +mkdir build +cd build +cmake -DTHIRDPARTY=ON .. +make +``` +3. PC上のファイヤウォールの設定を切ります + +#### STM側の設定 +1. IPアドレスを設定します。 +`application/src/lwip.c L69-L80` +``` + IP_ADDRESS[0] = 192; + IP_ADDRESS[1] = 168; + IP_ADDRESS[2] = 11; + IP_ADDRESS[3] = 2; + NETMASK_ADDRESS[0] = 255; + NETMASK_ADDRESS[1] = 255; + NETMASK_ADDRESS[2] = 255; + NETMASK_ADDRESS[3] = 0; + GATEWAY_ADDRESS[0] = 192; + GATEWAY_ADDRESS[1] = 168; + GATEWAY_ADDRESS[2] = 11; + GATEWAY_ADDRESS[3] = 1; + ``` +`embeddedRTPS/include/rtps/config.h L36-L37` +``` +const std::array IP_ADDRESS = { + 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. +``` +2. 本アプリをビルドします + +#### 実行 +1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します +2. ビルドしたlinuxのアプリを実行します +3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です +``` +Conducting new Test... +Send message to the STM32. +Received message from STM32 with len:10 +0 : 10 +1 : 10 +2 : 10 +3 : 10 +4 : 10 +5 : 10 +6 : 10 +7 : 10 +8 : 10 +9 : 10 + +Conducting new Test... +Send message to the STM32. + +``` diff --git a/workspace/echoreply_vector3/app.cdl b/workspace/echoreply_vector3/app.cdl new file mode 100644 index 0000000..176c5a6 --- /dev/null +++ b/workspace/echoreply_vector3/app.cdl @@ -0,0 +1,122 @@ +/* + * サンプルプログラム(1)のコンポーネント記述ファイル + * + * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ + */ +/* + * カーネルオブジェクトの定義 + */ +import(); + +/* + * ターゲット非依存のセルタイプの定義 + */ +import("syssvc/tSerialPort.cdl"); +import("syssvc/tSerialAdapter.cdl"); +import("syssvc/tSysLog.cdl"); +import("syssvc/tSysLogAdapter.cdl"); +import("syssvc/tLogTask.cdl"); +import("syssvc/tBanner.cdl"); + +/* + * ターゲット依存部の取り込み + */ +import("target.cdl"); + +/* + * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" + * の行までのことを言う. + */ + +/* + * システムログ機能のアダプタの組上げ記述 + * + * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー + * スのシステムログ機能を呼び出すためのセルである.システムログ機能の + * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び + * 出さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSysLogAdapter SysLogAdapter { + cSysLog = SysLog.eSysLog; +}; + +/* + * シリアルインタフェースドライバのアダプタの組上げ記述 + * + * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー + * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための + * セルである.シリアルインタフェースドライバのサービスコールを呼び出 + * さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSerialAdapter SerialAdapter { + cSerialPort[0] = SerialPort1.eSerialPort; +}; + +/* + * システムログ機能の組上げ記述 + * + * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ + * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, + * システムログタスクはシステムログ機能を使用するため,それも外すこと + * が必要である.また,システムログ機能のアダプタも外さなければならな + * い.tecsgenが警告メッセージを出すが,無視してよい. + */ +cell tSysLog SysLog { + logBufferSize = 32; /* ログバッファのサイズ */ + initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); + /* ログバッファに記録すべき重要度 */ + initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); + /* 低レベル出力すべき重要度 */ + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * シリアルインタフェースドライバの組上げ記述 + * + * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 + * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー + * スドライバを使用するため,それも外すことが必要である.また,シリア + * ルインタフェースドライバのアダプタも外さなければならない. + */ +cell tSerialPort SerialPort1 { + receiveBufferSize = 256; /* 受信バッファのサイズ */ + sendBufferSize = 256; /* 送信バッファのサイズ */ + + /* ターゲット依存部との結合 */ + cSIOPort = SIOPortTarget1.eSIOPort; + eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ +}; + +/* + * システムログタスクの組上げ記述 + * + * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ + * ばよい. + */ +cell tLogTask LogTask { + priority = 3; /* システムログタスクの優先度 */ + stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ + + /* シリアルインタフェースドライバとの結合 */ + cSerialPort = SerialPort1.eSerialPort; + cnSerialPortManage = SerialPort1.enSerialPortManage; + + /* システムログ機能との結合 */ + cSysLog = SysLog.eSysLog; + + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * カーネル起動メッセージ出力の組上げ記述 + * + * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 + * を削除すればよい. + */ +cell tBanner Banner { + /* 属性の設定 */ + targetName = BannerTargetName; + copyrightNotice = BannerCopyrightNotice; +}; diff --git a/workspace/echoreply_vector3/app.cfg b/workspace/echoreply_vector3/app.cfg new file mode 100644 index 0000000..eb0495d --- /dev/null +++ b/workspace/echoreply_vector3/app.cfg @@ -0,0 +1,14 @@ +/* + * サンプルプログラム(1)のシステムコンフィギュレーションファイル + */ +INCLUDE("tecsgen.cfg"); +INCLUDE("asp3ext.cfg"); +INCLUDE("task.cfg"); + +#include "app.h" +#include "stm32f7xx_it.h" +CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); +CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); +CFG_INT(77, {TA_EDGE, -4}); + +CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_vector3/app.cpp b/workspace/echoreply_vector3/app.cpp new file mode 100644 index 0000000..8596482 --- /dev/null +++ b/workspace/echoreply_vector3/app.cpp @@ -0,0 +1,44 @@ +#include "app.h" +#include "mros2.h" +#include "geometry_msgs/msg/vector3.hpp" + +#include "stm32f7xx_nucleo_144.h" + +mros2::Subscriber sub; +mros2::Publisher pub; + +void userCallback(geometry_msgs::msg::Vector3 *msg) +{ + MROS2_INFO("subscribed msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); + MROS2_INFO("publishing msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); + pub.publish(*msg); +} + +int main(int argc, char * argv[]) +{ + MROS2_INFO("mROS 2 application is started"); + + mros2::init(argc, argv); + MROS2_DEBUG("mROS 2 initialization is completed"); + BSP_LED_Toggle(LED1); + + mros2::Node node = mros2::Node::create_node("mros2_node"); + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + geometry_msgs::msg::Vector3 msg; + + MROS2_INFO("ready to pub/sub message"); + mros2::spin(); + BSP_LED_Toggle(LED3); +} + +void main_task(void) +{ + main(0, NULL); +} + +void +led_cyclic_handler(intptr_t exinf) +{ + BSP_LED_Toggle(LED2); +} \ No newline at end of file diff --git a/workspace/echoreply_vector3/app.h b/workspace/echoreply_vector3/app.h new file mode 100644 index 0000000..36eb6cf --- /dev/null +++ b/workspace/echoreply_vector3/app.h @@ -0,0 +1,84 @@ +/* + * TOPPERS/ASP Kernel + * Toyohashi Open Platform for Embedded Real-Time Systems/ + * Advanced Standard Profile Kernel + * + * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory + * Toyohashi Univ. of Technology, JAPAN + * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory + * Graduate School of Information Science, Nagoya Univ., JAPAN + * + * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ + * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 + * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. + * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 + * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー + * スコード中に含まれていること. + * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 + * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 + * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 + * の無保証規定を掲載すること. + * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 + * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ + * と. + * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 + * 作権表示,この利用条件および下記の無保証規定を掲載すること. + * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに + * 報告すること. + * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 + * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. + * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 + * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを + * 免責すること. + * + * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お + * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 + * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ + * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ + * の責任を負わない. + * + * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ + */ + +/* + * header file for the mros2 application + */ + +#include + +/* + * Priorities for TOPPERS tasks + */ + +#define MAIN_PRIORITY 5 + +#define HIGH_PRIORITY 9 +#define MID_PRIORITY 10 +#define LOW_PRIORITY 11 + +/* + * Constants that may depend on the target + */ + +#ifndef TASK_PORTID +#define TASK_PORTID 1 +#endif /* TASK_PORTID */ + +#ifndef STACK_SIZE +#define STACK_SIZE 4096 +#endif /* STACK_SIZE */ + +/* + * Declaration of prototyle functions + */ +#ifndef TOPPERS_MACRO_ONLY +#ifdef __cplusplus +extern "C" { +#endif +void main_task(void); +extern void led_cyclic_handler(intptr_t exinf); +#ifdef __cplusplus +} +#endif +void Error_Handler(); +#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.c new file mode 100644 index 0000000..41ef1da --- /dev/null +++ b/workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.c @@ -0,0 +1,24 @@ +#include "autosar_os_ext_asp3_user_config.h" + +const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), +}; + +const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) +{ + return autosar_os_ext_flag_user_map; +} + +int cmsis_get_flag_user_num(void) +{ + return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; +} diff --git a/workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.h new file mode 100644 index 0000000..7ad08bf --- /dev/null +++ b/workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.h @@ -0,0 +1,10 @@ +#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ + +#include "cmsis_config_utl.h" + +#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) + +extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; + +#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_vector3/config/autosar_os_ext_user_config.c b/workspace/echoreply_vector3/config/autosar_os_ext_user_config.c new file mode 100644 index 0000000..940941b --- /dev/null +++ b/workspace/echoreply_vector3/config/autosar_os_ext_user_config.c @@ -0,0 +1,75 @@ +#include "cmsis_os.h" +#include "autosar_os_ext_user_config.h" + +extern void tcpip_thread(void *arg); +extern void ethernetif_set_link(void* argument); +extern void ethernetif_input(void* argument); +extern void callHbPubFunc(void *arg); +extern void callHbSubFunc(void *arg); +extern void StartDefaultTask(void * argument); +extern void callWriterThreadFunction(void *arg); +extern void callReaderThreadFunction(void *arg); +extern void callRunBroadcast(void *args); +extern void mros2_init(void *args); + + +UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { + { + .taskID = AutosarOsExtTcpTask, + .func = tcpip_thread, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthIfLinkTask, + .func = ethernetif_set_link, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthInputTask, + .func = ethernetif_input, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBPubTask, + .func = callHbPubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBSubTask, + .func = callHbSubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtSPDPTask, + .func = callRunBroadcast, + .argument = NULL, + }, + { + .taskID = AutosarOsExtWriterTask, + .func = callWriterThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtReaderTask, + .func = callReaderThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtMROS2Task, + .func = mros2_init, + .argument = NULL, + }, +}; + +UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) +{ + return user_thread_autosar_ostask_map; +} +int cmsis_get_app_heap_size(void) +{ + return APP_HEAP_SIZE; +} +int cmsis_get_user_thread_num(void) +{ + return USER_THREAD_NUM; +} diff --git a/workspace/echoreply_vector3/config/autosar_os_ext_user_config.h b/workspace/echoreply_vector3/config/autosar_os_ext_user_config.h new file mode 100644 index 0000000..bab78d3 --- /dev/null +++ b/workspace/echoreply_vector3/config/autosar_os_ext_user_config.h @@ -0,0 +1,22 @@ +#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ + +#include "cmsis_os.h" +#include "cmsis_config_utl.h" + +/*********************************************** + * + * MEMORY + * + ***********************************************/ +#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ + + +/*********************************************** + * + * THREAD + * + ***********************************************/ +#define USER_THREAD_NUM 9U + +#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_vector3/config/mros2_user_config.c b/workspace/echoreply_vector3/config/mros2_user_config.c new file mode 100644 index 0000000..7d2c110 --- /dev/null +++ b/workspace/echoreply_vector3/config/mros2_user_config.c @@ -0,0 +1,10 @@ + + +#define SUB_MSG_COUNT 10 + +int mros2_get_submsg_count(void) +{ + return SUB_MSG_COUNT; +} + + diff --git a/workspace/echoreply_vector3/config/task.cfg b/workspace/echoreply_vector3/config/task.cfg new file mode 100644 index 0000000..f577110 --- /dev/null +++ b/workspace/echoreply_vector3/config/task.cfg @@ -0,0 +1,24 @@ +#include "task_impl.h" + +CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); +CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); +CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); +CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); +CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); +CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); +CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); +CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); +CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); +CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); + +CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_vector3/geometry_msgs/msg/Vector3.msg b/workspace/echoreply_vector3/geometry_msgs/msg/Vector3.msg new file mode 100644 index 0000000..681257d --- /dev/null +++ b/workspace/echoreply_vector3/geometry_msgs/msg/Vector3.msg @@ -0,0 +1,3 @@ +float64 x +float64 y +float64 z \ No newline at end of file diff --git a/workspace/echoreply_vector3/msg_settings.json b/workspace/echoreply_vector3/msg_settings.json new file mode 100644 index 0000000..6b09641 --- /dev/null +++ b/workspace/echoreply_vector3/msg_settings.json @@ -0,0 +1,7 @@ +{ + "includingMsgs": [ + "geometry_msgs/msg/Vector3.msg" + ], + "dependingPkgs": [ + ] +} \ No newline at end of file diff --git a/workspace/echoreply_vector3/task_impl.c b/workspace/echoreply_vector3/task_impl.c new file mode 100644 index 0000000..afb9fca --- /dev/null +++ b/workspace/echoreply_vector3/task_impl.c @@ -0,0 +1,126 @@ +#include "cmsis_os.h" +#include "cmsis_config_utl.h" +#include "task_impl.h" + +TASK(AutosarOsExtTcpTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthIfLinkTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthInputTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBPubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBSubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtSPDPTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtWriterTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtReaderTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtUserDefaultTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtMROS2Task) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} diff --git a/workspace/echoreply_vector3/task_impl.h b/workspace/echoreply_vector3/task_impl.h new file mode 100644 index 0000000..11e7a81 --- /dev/null +++ b/workspace/echoreply_vector3/task_impl.h @@ -0,0 +1,54 @@ +#ifndef _AUTOSAR_OS_EXT_TEST_H_ +#define _AUTOSAR_OS_EXT_TEST_H_ + +#include "cmsis_config_utl.h" + +extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); + +/* + * priorities of mROS 2 tasks for RTPS + * + * TODO: We assigned relatevely lower priorities for EthIfLinkTask and + * EthInputTask than the application. Check whether these are appropriate. + */ +#define MROS2_HIGH_PRIORITY MAIN_PRIORITY +#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 + +/* + * experimental: stack size of mROS 2 tasks for RTPS + * Each comment refers the location of original definition + */ +// application/include/lwipopt.h +// #define TCPIP_THREAD_STACKSIZE 1024 +#define MROS2_STACK_SIZE_TcpTask 1024 +// application/src/lwip.c +// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) +#define MROS2_STACK_SIZE_EthIfLinkTask 1024 +// application/src/ethernet.c +// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) +#define MROS2_STACK_SIZE_EthInputTask 350 +// embeddedRTPS/include/config.h +// const int HEARTBEAT_STACKSIZE = 1200; // byte +#define MROS2_STACK_SIZE_HBPubTask 1200 +#define MROS2_STACK_SIZE_HBSubTask 1200 +// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte +#define MROS2_STACK_SIZE_SPDPTask 550 +// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte +#define MROS2_STACK_SIZE_WriterTask 1100 +// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte +#define MROS2_STACK_SIZE_ReaderTask 1600 +// embeddedRTPS-STM32/stm32/Src/main.cpp +// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); +#define MROS2_STACK_SIZE_UserDefaultTask 250 + + +#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ From 28745828b7f30fa552a76b79502908aff1a72d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 23 Dec 2021 12:01:59 +0900 Subject: [PATCH 34/80] twist app added --- workspace/echoreply_twist/Makefile.inc | 27 ++++ workspace/echoreply_twist/README.md | 68 ++++++++++ workspace/echoreply_twist/app.cdl | 122 +++++++++++++++++ workspace/echoreply_twist/app.cfg | 14 ++ workspace/echoreply_twist/app.cpp | 44 ++++++ workspace/echoreply_twist/app.h | 84 ++++++++++++ .../config/autosar_os_ext_asp3_user_config.c | 24 ++++ .../config/autosar_os_ext_asp3_user_config.h | 10 ++ .../config/autosar_os_ext_user_config.c | 75 +++++++++++ .../config/autosar_os_ext_user_config.h | 22 +++ .../config/mros2_user_config.c | 10 ++ workspace/echoreply_twist/config/task.cfg | 24 ++++ .../geometry_msgs/msg/Twist.msg | 2 + workspace/echoreply_twist/msg_settings.json | 8 ++ workspace/echoreply_twist/task_impl.c | 126 ++++++++++++++++++ workspace/echoreply_twist/task_impl.h | 54 ++++++++ 16 files changed, 714 insertions(+) create mode 100644 workspace/echoreply_twist/Makefile.inc create mode 100644 workspace/echoreply_twist/README.md create mode 100644 workspace/echoreply_twist/app.cdl create mode 100644 workspace/echoreply_twist/app.cfg create mode 100644 workspace/echoreply_twist/app.cpp create mode 100644 workspace/echoreply_twist/app.h create mode 100644 workspace/echoreply_twist/config/autosar_os_ext_asp3_user_config.c create mode 100644 workspace/echoreply_twist/config/autosar_os_ext_asp3_user_config.h create mode 100644 workspace/echoreply_twist/config/autosar_os_ext_user_config.c create mode 100644 workspace/echoreply_twist/config/autosar_os_ext_user_config.h create mode 100644 workspace/echoreply_twist/config/mros2_user_config.c create mode 100644 workspace/echoreply_twist/config/task.cfg create mode 100644 workspace/echoreply_twist/geometry_msgs/msg/Twist.msg create mode 100644 workspace/echoreply_twist/msg_settings.json create mode 100644 workspace/echoreply_twist/task_impl.c create mode 100644 workspace/echoreply_twist/task_impl.h diff --git a/workspace/echoreply_twist/Makefile.inc b/workspace/echoreply_twist/Makefile.inc new file mode 100644 index 0000000..f807ac1 --- /dev/null +++ b/workspace/echoreply_twist/Makefile.inc @@ -0,0 +1,27 @@ +# +# Makefile definition for mros2 application +# + +# name of main application +APPLNAME = app + +# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) +# NOTE: also check `initLogMask` in app.cdl for syslog setting +CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 + +# information for directory tree +APPLDIR := $(APPDIR) +APPLDIR += $(APPDIR)/config + +# link option for C++ code +SRCLANG = c++ +APPL_CXXLIBS += -specs=nano.specs + +# compile switch +CDEFS += -DUSE_ASP3_FOR_STM + +# additional files for configuration +APPL_COBJS := task_impl.o +APPL_COBJS += autosar_os_ext_user_config.o +APPL_COBJS += autosar_os_ext_asp3_user_config.o +APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_twist/README.md b/workspace/echoreply_twist/README.md new file mode 100644 index 0000000..a6ee6cb --- /dev/null +++ b/workspace/echoreply_twist/README.md @@ -0,0 +1,68 @@ +### EmbeddedRTPS動作確認用アプリ + +EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 +利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 + +#### LINUX側の準備 +1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします +``` +git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 +``` +2. 通信用アプリをビルドします +``` +cd embeddedRTPS-STM32 +cd linux +mkdir build +cd build +cmake -DTHIRDPARTY=ON .. +make +``` +3. PC上のファイヤウォールの設定を切ります + +#### STM側の設定 +1. IPアドレスを設定します。 +`application/src/lwip.c L69-L80` +``` + IP_ADDRESS[0] = 192; + IP_ADDRESS[1] = 168; + IP_ADDRESS[2] = 11; + IP_ADDRESS[3] = 2; + NETMASK_ADDRESS[0] = 255; + NETMASK_ADDRESS[1] = 255; + NETMASK_ADDRESS[2] = 255; + NETMASK_ADDRESS[3] = 0; + GATEWAY_ADDRESS[0] = 192; + GATEWAY_ADDRESS[1] = 168; + GATEWAY_ADDRESS[2] = 11; + GATEWAY_ADDRESS[3] = 1; + ``` +`embeddedRTPS/include/rtps/config.h L36-L37` +``` +const std::array IP_ADDRESS = { + 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. +``` +2. 本アプリをビルドします + +#### 実行 +1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します +2. ビルドしたlinuxのアプリを実行します +3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です +``` +Conducting new Test... +Send message to the STM32. +Received message from STM32 with len:10 +0 : 10 +1 : 10 +2 : 10 +3 : 10 +4 : 10 +5 : 10 +6 : 10 +7 : 10 +8 : 10 +9 : 10 + +Conducting new Test... +Send message to the STM32. + +``` diff --git a/workspace/echoreply_twist/app.cdl b/workspace/echoreply_twist/app.cdl new file mode 100644 index 0000000..176c5a6 --- /dev/null +++ b/workspace/echoreply_twist/app.cdl @@ -0,0 +1,122 @@ +/* + * サンプルプログラム(1)のコンポーネント記述ファイル + * + * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ + */ +/* + * カーネルオブジェクトの定義 + */ +import(); + +/* + * ターゲット非依存のセルタイプの定義 + */ +import("syssvc/tSerialPort.cdl"); +import("syssvc/tSerialAdapter.cdl"); +import("syssvc/tSysLog.cdl"); +import("syssvc/tSysLogAdapter.cdl"); +import("syssvc/tLogTask.cdl"); +import("syssvc/tBanner.cdl"); + +/* + * ターゲット依存部の取り込み + */ +import("target.cdl"); + +/* + * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" + * の行までのことを言う. + */ + +/* + * システムログ機能のアダプタの組上げ記述 + * + * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー + * スのシステムログ機能を呼び出すためのセルである.システムログ機能の + * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び + * 出さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSysLogAdapter SysLogAdapter { + cSysLog = SysLog.eSysLog; +}; + +/* + * シリアルインタフェースドライバのアダプタの組上げ記述 + * + * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー + * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための + * セルである.シリアルインタフェースドライバのサービスコールを呼び出 + * さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSerialAdapter SerialAdapter { + cSerialPort[0] = SerialPort1.eSerialPort; +}; + +/* + * システムログ機能の組上げ記述 + * + * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ + * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, + * システムログタスクはシステムログ機能を使用するため,それも外すこと + * が必要である.また,システムログ機能のアダプタも外さなければならな + * い.tecsgenが警告メッセージを出すが,無視してよい. + */ +cell tSysLog SysLog { + logBufferSize = 32; /* ログバッファのサイズ */ + initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); + /* ログバッファに記録すべき重要度 */ + initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); + /* 低レベル出力すべき重要度 */ + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * シリアルインタフェースドライバの組上げ記述 + * + * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 + * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー + * スドライバを使用するため,それも外すことが必要である.また,シリア + * ルインタフェースドライバのアダプタも外さなければならない. + */ +cell tSerialPort SerialPort1 { + receiveBufferSize = 256; /* 受信バッファのサイズ */ + sendBufferSize = 256; /* 送信バッファのサイズ */ + + /* ターゲット依存部との結合 */ + cSIOPort = SIOPortTarget1.eSIOPort; + eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ +}; + +/* + * システムログタスクの組上げ記述 + * + * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ + * ばよい. + */ +cell tLogTask LogTask { + priority = 3; /* システムログタスクの優先度 */ + stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ + + /* シリアルインタフェースドライバとの結合 */ + cSerialPort = SerialPort1.eSerialPort; + cnSerialPortManage = SerialPort1.enSerialPortManage; + + /* システムログ機能との結合 */ + cSysLog = SysLog.eSysLog; + + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * カーネル起動メッセージ出力の組上げ記述 + * + * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 + * を削除すればよい. + */ +cell tBanner Banner { + /* 属性の設定 */ + targetName = BannerTargetName; + copyrightNotice = BannerCopyrightNotice; +}; diff --git a/workspace/echoreply_twist/app.cfg b/workspace/echoreply_twist/app.cfg new file mode 100644 index 0000000..eb0495d --- /dev/null +++ b/workspace/echoreply_twist/app.cfg @@ -0,0 +1,14 @@ +/* + * サンプルプログラム(1)のシステムコンフィギュレーションファイル + */ +INCLUDE("tecsgen.cfg"); +INCLUDE("asp3ext.cfg"); +INCLUDE("task.cfg"); + +#include "app.h" +#include "stm32f7xx_it.h" +CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); +CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); +CFG_INT(77, {TA_EDGE, -4}); + +CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_twist/app.cpp b/workspace/echoreply_twist/app.cpp new file mode 100644 index 0000000..d5be014 --- /dev/null +++ b/workspace/echoreply_twist/app.cpp @@ -0,0 +1,44 @@ +#include "app.h" +#include "mros2.h" +#include "geometry_msgs/msg/twist.hpp" + +#include "stm32f7xx_nucleo_144.h" + +mros2::Subscriber sub; +mros2::Publisher pub; + +void userCallback(geometry_msgs::msg::Twist *msg) +{ + MROS2_INFO("subscribed msg: { linear: { x: , y: , z: }, angular: { x: , y: , z: } }"); + MROS2_INFO("publishing msg: { linear: { x: , y: , z: }, angular: { x: , y: , z: } }"); + pub.publish(*msg); +} + +int main(int argc, char * argv[]) +{ + MROS2_INFO("mROS 2 application is started"); + + mros2::init(argc, argv); + MROS2_DEBUG("mROS 2 initialization is completed"); + BSP_LED_Toggle(LED1); + + mros2::Node node = mros2::Node::create_node("mros2_node"); + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + geometry_msgs::msg::Twist msg; + + MROS2_INFO("ready to pub/sub message"); + mros2::spin(); + BSP_LED_Toggle(LED3); +} + +void main_task(void) +{ + main(0, NULL); +} + +void +led_cyclic_handler(intptr_t exinf) +{ + BSP_LED_Toggle(LED2); +} \ No newline at end of file diff --git a/workspace/echoreply_twist/app.h b/workspace/echoreply_twist/app.h new file mode 100644 index 0000000..36eb6cf --- /dev/null +++ b/workspace/echoreply_twist/app.h @@ -0,0 +1,84 @@ +/* + * TOPPERS/ASP Kernel + * Toyohashi Open Platform for Embedded Real-Time Systems/ + * Advanced Standard Profile Kernel + * + * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory + * Toyohashi Univ. of Technology, JAPAN + * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory + * Graduate School of Information Science, Nagoya Univ., JAPAN + * + * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ + * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 + * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. + * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 + * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー + * スコード中に含まれていること. + * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 + * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 + * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 + * の無保証規定を掲載すること. + * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 + * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ + * と. + * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 + * 作権表示,この利用条件および下記の無保証規定を掲載すること. + * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに + * 報告すること. + * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 + * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. + * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 + * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを + * 免責すること. + * + * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お + * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 + * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ + * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ + * の責任を負わない. + * + * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ + */ + +/* + * header file for the mros2 application + */ + +#include + +/* + * Priorities for TOPPERS tasks + */ + +#define MAIN_PRIORITY 5 + +#define HIGH_PRIORITY 9 +#define MID_PRIORITY 10 +#define LOW_PRIORITY 11 + +/* + * Constants that may depend on the target + */ + +#ifndef TASK_PORTID +#define TASK_PORTID 1 +#endif /* TASK_PORTID */ + +#ifndef STACK_SIZE +#define STACK_SIZE 4096 +#endif /* STACK_SIZE */ + +/* + * Declaration of prototyle functions + */ +#ifndef TOPPERS_MACRO_ONLY +#ifdef __cplusplus +extern "C" { +#endif +void main_task(void); +extern void led_cyclic_handler(intptr_t exinf); +#ifdef __cplusplus +} +#endif +void Error_Handler(); +#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_twist/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_twist/config/autosar_os_ext_asp3_user_config.c new file mode 100644 index 0000000..41ef1da --- /dev/null +++ b/workspace/echoreply_twist/config/autosar_os_ext_asp3_user_config.c @@ -0,0 +1,24 @@ +#include "autosar_os_ext_asp3_user_config.h" + +const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), +}; + +const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) +{ + return autosar_os_ext_flag_user_map; +} + +int cmsis_get_flag_user_num(void) +{ + return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; +} diff --git a/workspace/echoreply_twist/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_twist/config/autosar_os_ext_asp3_user_config.h new file mode 100644 index 0000000..7ad08bf --- /dev/null +++ b/workspace/echoreply_twist/config/autosar_os_ext_asp3_user_config.h @@ -0,0 +1,10 @@ +#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ + +#include "cmsis_config_utl.h" + +#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) + +extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; + +#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_twist/config/autosar_os_ext_user_config.c b/workspace/echoreply_twist/config/autosar_os_ext_user_config.c new file mode 100644 index 0000000..940941b --- /dev/null +++ b/workspace/echoreply_twist/config/autosar_os_ext_user_config.c @@ -0,0 +1,75 @@ +#include "cmsis_os.h" +#include "autosar_os_ext_user_config.h" + +extern void tcpip_thread(void *arg); +extern void ethernetif_set_link(void* argument); +extern void ethernetif_input(void* argument); +extern void callHbPubFunc(void *arg); +extern void callHbSubFunc(void *arg); +extern void StartDefaultTask(void * argument); +extern void callWriterThreadFunction(void *arg); +extern void callReaderThreadFunction(void *arg); +extern void callRunBroadcast(void *args); +extern void mros2_init(void *args); + + +UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { + { + .taskID = AutosarOsExtTcpTask, + .func = tcpip_thread, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthIfLinkTask, + .func = ethernetif_set_link, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthInputTask, + .func = ethernetif_input, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBPubTask, + .func = callHbPubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBSubTask, + .func = callHbSubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtSPDPTask, + .func = callRunBroadcast, + .argument = NULL, + }, + { + .taskID = AutosarOsExtWriterTask, + .func = callWriterThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtReaderTask, + .func = callReaderThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtMROS2Task, + .func = mros2_init, + .argument = NULL, + }, +}; + +UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) +{ + return user_thread_autosar_ostask_map; +} +int cmsis_get_app_heap_size(void) +{ + return APP_HEAP_SIZE; +} +int cmsis_get_user_thread_num(void) +{ + return USER_THREAD_NUM; +} diff --git a/workspace/echoreply_twist/config/autosar_os_ext_user_config.h b/workspace/echoreply_twist/config/autosar_os_ext_user_config.h new file mode 100644 index 0000000..bab78d3 --- /dev/null +++ b/workspace/echoreply_twist/config/autosar_os_ext_user_config.h @@ -0,0 +1,22 @@ +#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ + +#include "cmsis_os.h" +#include "cmsis_config_utl.h" + +/*********************************************** + * + * MEMORY + * + ***********************************************/ +#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ + + +/*********************************************** + * + * THREAD + * + ***********************************************/ +#define USER_THREAD_NUM 9U + +#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_twist/config/mros2_user_config.c b/workspace/echoreply_twist/config/mros2_user_config.c new file mode 100644 index 0000000..7d2c110 --- /dev/null +++ b/workspace/echoreply_twist/config/mros2_user_config.c @@ -0,0 +1,10 @@ + + +#define SUB_MSG_COUNT 10 + +int mros2_get_submsg_count(void) +{ + return SUB_MSG_COUNT; +} + + diff --git a/workspace/echoreply_twist/config/task.cfg b/workspace/echoreply_twist/config/task.cfg new file mode 100644 index 0000000..f577110 --- /dev/null +++ b/workspace/echoreply_twist/config/task.cfg @@ -0,0 +1,24 @@ +#include "task_impl.h" + +CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); +CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); +CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); +CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); +CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); +CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); +CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); +CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); +CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); +CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); + +CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_twist/geometry_msgs/msg/Twist.msg b/workspace/echoreply_twist/geometry_msgs/msg/Twist.msg new file mode 100644 index 0000000..4cdb251 --- /dev/null +++ b/workspace/echoreply_twist/geometry_msgs/msg/Twist.msg @@ -0,0 +1,2 @@ +Vector3 linear +Vector3 angular \ No newline at end of file diff --git a/workspace/echoreply_twist/msg_settings.json b/workspace/echoreply_twist/msg_settings.json new file mode 100644 index 0000000..d3829fc --- /dev/null +++ b/workspace/echoreply_twist/msg_settings.json @@ -0,0 +1,8 @@ +{ + "includingMsgs": [ + "geometry_msgs/msg/Twist.msg" + ], + "dependingMsgs": [ + "geometry_msgs/msg/Vector3.msg" + ] +} \ No newline at end of file diff --git a/workspace/echoreply_twist/task_impl.c b/workspace/echoreply_twist/task_impl.c new file mode 100644 index 0000000..afb9fca --- /dev/null +++ b/workspace/echoreply_twist/task_impl.c @@ -0,0 +1,126 @@ +#include "cmsis_os.h" +#include "cmsis_config_utl.h" +#include "task_impl.h" + +TASK(AutosarOsExtTcpTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthIfLinkTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthInputTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBPubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBSubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtSPDPTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtWriterTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtReaderTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtUserDefaultTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtMROS2Task) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} diff --git a/workspace/echoreply_twist/task_impl.h b/workspace/echoreply_twist/task_impl.h new file mode 100644 index 0000000..11e7a81 --- /dev/null +++ b/workspace/echoreply_twist/task_impl.h @@ -0,0 +1,54 @@ +#ifndef _AUTOSAR_OS_EXT_TEST_H_ +#define _AUTOSAR_OS_EXT_TEST_H_ + +#include "cmsis_config_utl.h" + +extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); + +/* + * priorities of mROS 2 tasks for RTPS + * + * TODO: We assigned relatevely lower priorities for EthIfLinkTask and + * EthInputTask than the application. Check whether these are appropriate. + */ +#define MROS2_HIGH_PRIORITY MAIN_PRIORITY +#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 + +/* + * experimental: stack size of mROS 2 tasks for RTPS + * Each comment refers the location of original definition + */ +// application/include/lwipopt.h +// #define TCPIP_THREAD_STACKSIZE 1024 +#define MROS2_STACK_SIZE_TcpTask 1024 +// application/src/lwip.c +// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) +#define MROS2_STACK_SIZE_EthIfLinkTask 1024 +// application/src/ethernet.c +// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) +#define MROS2_STACK_SIZE_EthInputTask 350 +// embeddedRTPS/include/config.h +// const int HEARTBEAT_STACKSIZE = 1200; // byte +#define MROS2_STACK_SIZE_HBPubTask 1200 +#define MROS2_STACK_SIZE_HBSubTask 1200 +// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte +#define MROS2_STACK_SIZE_SPDPTask 550 +// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte +#define MROS2_STACK_SIZE_WriterTask 1100 +// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte +#define MROS2_STACK_SIZE_ReaderTask 1600 +// embeddedRTPS-STM32/stm32/Src/main.cpp +// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); +#define MROS2_STACK_SIZE_UserDefaultTask 250 + + +#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ From c2e76fc57447d139b299575f5c35bd65b185975e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 23 Dec 2021 13:54:42 +0900 Subject: [PATCH 35/80] twist app worked --- workspace/echoreply_health/msg_settings.json | 2 +- workspace/echoreply_location/msg_settings.json | 2 +- workspace/echoreply_mix/msg_settings.json | 2 +- workspace/echoreply_vector3/msg_settings.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/workspace/echoreply_health/msg_settings.json b/workspace/echoreply_health/msg_settings.json index 7096df7..4f0bef7 100644 --- a/workspace/echoreply_health/msg_settings.json +++ b/workspace/echoreply_health/msg_settings.json @@ -2,6 +2,6 @@ "includingMsgs": [ "health_msgs/msg/Health.msg" ], - "dependingPkgs": [ + "dependingMsgs": [ ] } \ No newline at end of file diff --git a/workspace/echoreply_location/msg_settings.json b/workspace/echoreply_location/msg_settings.json index fb54130..d599774 100644 --- a/workspace/echoreply_location/msg_settings.json +++ b/workspace/echoreply_location/msg_settings.json @@ -2,6 +2,6 @@ "includingMsgs": [ "location_msgs/msg/Location.msg" ], - "dependingPkgs": [ + "dependingMsgs": [ ] } \ No newline at end of file diff --git a/workspace/echoreply_mix/msg_settings.json b/workspace/echoreply_mix/msg_settings.json index 2020f4a..6fa3fae 100644 --- a/workspace/echoreply_mix/msg_settings.json +++ b/workspace/echoreply_mix/msg_settings.json @@ -2,6 +2,6 @@ "includingMsgs": [ "mix_msgs/msg/Mix.msg" ], - "dependingPkgs": [ + "dependingMsgs": [ ] } \ No newline at end of file diff --git a/workspace/echoreply_vector3/msg_settings.json b/workspace/echoreply_vector3/msg_settings.json index 6b09641..46f4afc 100644 --- a/workspace/echoreply_vector3/msg_settings.json +++ b/workspace/echoreply_vector3/msg_settings.json @@ -2,6 +2,6 @@ "includingMsgs": [ "geometry_msgs/msg/Vector3.msg" ], - "dependingPkgs": [ + "dependingMsgs": [ ] } \ No newline at end of file From 6331e66a915af0c2dc96f35d162325e0c05ec6a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Tue, 28 Dec 2021 02:33:22 +0900 Subject: [PATCH 36/80] WIP: cleaning compile flow etc. --- workspace/echoreply_health/msg_settings.json | 6 +- workspace/echoreply_twist/msg_settings.json | 10 +- workspace/echoreply_vector3/msg_settings.json | 6 +- .../mros2_msgs/geometry_msgs/msg/twist.hpp | 94 ++++++++ .../mros2_msgs/geometry_msgs/msg/vector3.hpp | 200 ++++++++++++++++++ .../mros2_msgs/health_msgs/msg/health.hpp | 197 +++++++++++++++++ 6 files changed, 502 insertions(+), 11 deletions(-) create mode 100644 workspace/mros2_msgs/geometry_msgs/msg/twist.hpp create mode 100644 workspace/mros2_msgs/geometry_msgs/msg/vector3.hpp create mode 100644 workspace/mros2_msgs/health_msgs/msg/health.hpp diff --git a/workspace/echoreply_health/msg_settings.json b/workspace/echoreply_health/msg_settings.json index 4f0bef7..905a5ed 100644 --- a/workspace/echoreply_health/msg_settings.json +++ b/workspace/echoreply_health/msg_settings.json @@ -1,7 +1,7 @@ { "includingMsgs": [ - "health_msgs/msg/Health.msg" - ], - "dependingMsgs": [ + [ + "health_msgs/msg/Health.msg" + ] ] } \ No newline at end of file diff --git a/workspace/echoreply_twist/msg_settings.json b/workspace/echoreply_twist/msg_settings.json index d3829fc..3bc68b1 100644 --- a/workspace/echoreply_twist/msg_settings.json +++ b/workspace/echoreply_twist/msg_settings.json @@ -1,8 +1,8 @@ { - "includingMsgs": [ - "geometry_msgs/msg/Twist.msg" - ], - "dependingMsgs": [ - "geometry_msgs/msg/Vector3.msg" + "includingMsgs": [ + [ + "geometry_msgs/msg/Twist.msg", + "geometry_msgs/msg/Vector3.msg" + ] ] } \ No newline at end of file diff --git a/workspace/echoreply_vector3/msg_settings.json b/workspace/echoreply_vector3/msg_settings.json index 46f4afc..9aa05ac 100644 --- a/workspace/echoreply_vector3/msg_settings.json +++ b/workspace/echoreply_vector3/msg_settings.json @@ -1,7 +1,7 @@ { "includingMsgs": [ - "geometry_msgs/msg/Vector3.msg" - ], - "dependingMsgs": [ + [ + "geometry_msgs/msg/Vector3.msg" + ] ] } \ No newline at end of file diff --git a/workspace/mros2_msgs/geometry_msgs/msg/twist.hpp b/workspace/mros2_msgs/geometry_msgs/msg/twist.hpp new file mode 100644 index 0000000..6691ca2 --- /dev/null +++ b/workspace/mros2_msgs/geometry_msgs/msg/twist.hpp @@ -0,0 +1,94 @@ +#ifndef _GEOMETRY_MSGS_MSG_TWIST_H +#define _GEOMETRY_MSGS_MSG_TWIST_H + +#include +#include +#include + + +#include "geometry_msgs/msg/vector3.hpp" + + +using namespace std; + +namespace geometry_msgs +{ +namespace msg +{ +class Twist +{ +public: + uint8_t cntPub = 0; + uint8_t cntSub = 0; + + geometry_msgs::msg::Vector3 linear +; + + geometry_msgs::msg::Vector3 angular; + + + uint8_t copyToBuf(uint8_t *addrPtr) + { + + + cntPub += linear +.copyToBuf(addrPtr); + + + + + cntPub += angular.copyToBuf(addrPtr); + + + + + if (cntPub%4 >0){ + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + + return cntPub; + } + + uint8_t copyFromBuf(const uint8_t *rbuf) { + + + cntSub += linear +.copyFromBuf(rbuf); + + + + + cntSub += angular.copyFromBuf(rbuf); + + + + + return cntSub; + } + + uint8_t getTotalSize(){ + return cntPub ; + } + +private: + std::string type_name = "geometry_msgs::msg::dds_::Twist"; +}; +}; +} + +namespace message_traits +{ +template<> +struct TypeName { + static const char* value() + { + return "geometry_msgs::msg::dds_::Twist_"; + } +}; +} + +#endif \ No newline at end of file diff --git a/workspace/mros2_msgs/geometry_msgs/msg/vector3.hpp b/workspace/mros2_msgs/geometry_msgs/msg/vector3.hpp new file mode 100644 index 0000000..ddc398b --- /dev/null +++ b/workspace/mros2_msgs/geometry_msgs/msg/vector3.hpp @@ -0,0 +1,200 @@ +#ifndef _GEOMETRY_MSGS_MSG_VECTOR3_H +#define _GEOMETRY_MSGS_MSG_VECTOR3_H + +#include +#include +#include + + + +using namespace std; + +namespace geometry_msgs +{ +namespace msg +{ +class Vector3 +{ +public: + uint8_t cntPub = 0; + uint8_t cntSub = 0; + + double x +; + + double y +; + + double z; + + + uint8_t copyToBuf(uint8_t *addrPtr) + { + + + if (cntPub%4 >0 && 8 > 1){ + if ((8 <= (4-(cntPub%4)))&&(8==2)){ + for (int i=0; i<(4-(cntPub%4))-8; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += (4-(cntPub%4))-8; + } else { + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + } + memcpy(addrPtr,&x +,8); + addrPtr += 8; + cntPub += 8; + + + + + if (cntPub%4 >0 && 8 > 1){ + if ((8 <= (4-(cntPub%4)))&&(8==2)){ + for (int i=0; i<(4-(cntPub%4))-8; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += (4-(cntPub%4))-8; + } else { + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + } + memcpy(addrPtr,&y +,8); + addrPtr += 8; + cntPub += 8; + + + + + if (cntPub%4 >0 && 8 > 1){ + if ((8 <= (4-(cntPub%4)))&&(8==2)){ + for (int i=0; i<(4-(cntPub%4))-8; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += (4-(cntPub%4))-8; + } else { + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + } + memcpy(addrPtr,&z,8); + addrPtr += 8; + cntPub += 8; + + + + + if (cntPub%4 >0){ + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + + return cntPub; + } + + uint8_t copyFromBuf(const uint8_t *rbuf) { + + + if (cntSub%4 >0 && 8 > 1){ + if ((8 <= (4-(cntSub%4)))&&(8==2)){ + for (int i=0; i<(4-(cntSub%4))-8; i++){ + rbuf += 1; + } + cntSub += (4-(cntSub%4))-8; + } else { + for(int i=0; i<(4-(cntSub%4)) ; i++){ + rbuf += 1; + } + cntSub += 4-(cntSub%4); + } + } + memcpy(&x +,rbuf,8); + rbuf += 8; + cntSub += 8; + + + + if (cntSub%4 >0 && 8 > 1){ + if ((8 <= (4-(cntSub%4)))&&(8==2)){ + for (int i=0; i<(4-(cntSub%4))-8; i++){ + rbuf += 1; + } + cntSub += (4-(cntSub%4))-8; + } else { + for(int i=0; i<(4-(cntSub%4)) ; i++){ + rbuf += 1; + } + cntSub += 4-(cntSub%4); + } + } + memcpy(&y +,rbuf,8); + rbuf += 8; + cntSub += 8; + + + + if (cntSub%4 >0 && 8 > 1){ + if ((8 <= (4-(cntSub%4)))&&(8==2)){ + for (int i=0; i<(4-(cntSub%4))-8; i++){ + rbuf += 1; + } + cntSub += (4-(cntSub%4))-8; + } else { + for(int i=0; i<(4-(cntSub%4)) ; i++){ + rbuf += 1; + } + cntSub += 4-(cntSub%4); + } + } + memcpy(&z,rbuf,8); + rbuf += 8; + cntSub += 8; + + + + return cntSub; + } + + uint8_t getTotalSize(){ + return cntPub ; + } + +private: + std::string type_name = "geometry_msgs::msg::dds_::Vector3"; +}; +}; +} + +namespace message_traits +{ +template<> +struct TypeName { + static const char* value() + { + return "geometry_msgs::msg::dds_::Vector3_"; + } +}; +} + +#endif \ No newline at end of file diff --git a/workspace/mros2_msgs/health_msgs/msg/health.hpp b/workspace/mros2_msgs/health_msgs/msg/health.hpp new file mode 100644 index 0000000..dcbf2f1 --- /dev/null +++ b/workspace/mros2_msgs/health_msgs/msg/health.hpp @@ -0,0 +1,197 @@ +#ifndef _HEALTH_MSGS_MSG_HEALTH_H +#define _HEALTH_MSGS_MSG_HEALTH_H + +#include +#include +#include + + + +using namespace std; + +namespace health_msgs +{ +namespace msg +{ +class Health +{ +public: + uint8_t cntPub = 0; + uint8_t cntSub = 0; + + string name +; + + uint16_t height +; + + float weight; + + + uint8_t copyToBuf(uint8_t *addrPtr) + { + + + if (cntPub%4 >0){ + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + uint32_t stringSize = name +.size(); + memcpy(addrPtr,&stringSize,4); + addrPtr += 4; + cntPub += 4; + memcpy(addrPtr,name +.c_str(),stringSize); + addrPtr += stringSize; + cntPub += stringSize; + + + + + if (cntPub%4 >0 && 2 > 1){ + if ((2 <= (4-(cntPub%4)))&&(2==2)){ + for (int i=0; i<(4-(cntPub%4))-2; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += (4-(cntPub%4))-2; + } else { + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + } + memcpy(addrPtr,&height +,2); + addrPtr += 2; + cntPub += 2; + + + + + if (cntPub%4 >0 && 4 > 1){ + if ((4 <= (4-(cntPub%4)))&&(4==2)){ + for (int i=0; i<(4-(cntPub%4))-4; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += (4-(cntPub%4))-4; + } else { + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + } + memcpy(addrPtr,&weight,4); + addrPtr += 4; + cntPub += 4; + + + + + if (cntPub%4 >0){ + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + + return cntPub; + } + + uint8_t copyFromBuf(const uint8_t *rbuf) { + + + if (cntSub%4 >0){ + for(int i=0; i<(4-(cntSub%4)) ; i++){ + rbuf += 1; + } + cntSub += 4-(cntSub%4); + } + uint32_t stringSize; + memcpy(&stringSize, rbuf, 4); + rbuf += 4; + cntSub += 4; + name +.resize(stringSize); + memcpy(&name +[0],rbuf,stringSize); + rbuf += stringSize; + cntSub += stringSize; + + + + + if (cntSub%4 >0 && 2 > 1){ + if ((2 <= (4-(cntSub%4)))&&(2==2)){ + for (int i=0; i<(4-(cntSub%4))-2; i++){ + rbuf += 1; + } + cntSub += (4-(cntSub%4))-2; + } else { + for(int i=0; i<(4-(cntSub%4)) ; i++){ + rbuf += 1; + } + cntSub += 4-(cntSub%4); + } + } + memcpy(&height +,rbuf,2); + rbuf += 2; + cntSub += 2; + + + + if (cntSub%4 >0 && 4 > 1){ + if ((4 <= (4-(cntSub%4)))&&(4==2)){ + for (int i=0; i<(4-(cntSub%4))-4; i++){ + rbuf += 1; + } + cntSub += (4-(cntSub%4))-4; + } else { + for(int i=0; i<(4-(cntSub%4)) ; i++){ + rbuf += 1; + } + cntSub += 4-(cntSub%4); + } + } + memcpy(&weight,rbuf,4); + rbuf += 4; + cntSub += 4; + + + + return cntSub; + } + + uint8_t getTotalSize(){ + return cntPub ; + } + +private: + std::string type_name = "health_msgs::msg::dds_::Health"; +}; +}; +} + +namespace message_traits +{ +template<> +struct TypeName { + static const char* value() + { + return "health_msgs::msg::dds_::Health_"; + } +}; +} + +#endif \ No newline at end of file From 3f8808a4b65015ea182f98029da9d00da4202ca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 29 Dec 2021 01:27:38 +0900 Subject: [PATCH 37/80] compile flow changed much --- .../health_msgs}/health_msgs/msg/Health.msg | 0 .../health_msgs}/msg_settings.json | 2 +- .../mix_msgs}/mix_msgs/msg/Mix.msg | 0 .../custom_msgs/mix_msgs/msg_settings.json | 7 + .../geometry_msgs/msg/Point.msg} | 0 .../odometry_msgs/geometry_msgs/msg/Pose.msg | 2 + .../geometry_msgs/msg/PoseWithCovariance.msg | 2 + .../geometry_msgs/msg/Quaternion.msg | 4 + .../geometry_msgs/msg/Twist.msg | 0 .../geometry_msgs/msg/TwistWithCovariance.msg | 2 + .../geometry_msgs/msg/Vector3.msg | 3 + .../odometry_msgs/msg_settings.json | 35 +++ .../odometry_msgs/nav_msgs/msg/Odometry.msg | 4 + workspace/echoreply_health/msg_settings.json | 7 - workspace/echoreply_location/app.cpp | 44 ---- .../location_msgs/msg/Location.msg | 3 - .../echoreply_location/msg_settings.json | 7 - workspace/echoreply_mix/msg_settings.json | 7 - .../Makefile.inc | 0 .../README.md | 0 .../app.cdl | 0 .../app.cfg | 0 .../app.cpp | 14 +- .../app.h | 0 .../config/autosar_os_ext_asp3_user_config.c | 0 .../config/autosar_os_ext_asp3_user_config.h | 0 .../config/autosar_os_ext_user_config.c | 0 .../config/autosar_os_ext_user_config.h | 0 .../config/mros2_user_config.c | 0 .../config/task.cfg | 0 .../task_impl.c | 0 .../task_impl.h | 0 workspace/echoreply_twist/app.cpp | 2 +- workspace/echoreply_twist/msg_settings.json | 8 - workspace/echoreply_vector3/Makefile.inc | 27 --- workspace/echoreply_vector3/README.md | 68 ------ workspace/echoreply_vector3/app.cdl | 122 ----------- workspace/echoreply_vector3/app.cfg | 14 -- workspace/echoreply_vector3/app.h | 84 -------- .../config/autosar_os_ext_asp3_user_config.c | 24 --- .../config/autosar_os_ext_asp3_user_config.h | 10 - .../config/autosar_os_ext_user_config.c | 75 ------- .../config/autosar_os_ext_user_config.h | 22 -- .../config/mros2_user_config.c | 10 - workspace/echoreply_vector3/config/task.cfg | 24 --- workspace/echoreply_vector3/task_impl.c | 126 ----------- workspace/echoreply_vector3/task_impl.h | 54 ----- .../mros2_msgs/geometry_msgs/msg/twist.hpp | 94 -------- .../mros2_msgs/geometry_msgs/msg/vector3.hpp | 200 ------------------ .../mros2_msgs/health_msgs/msg/health.hpp | 197 ----------------- 50 files changed, 68 insertions(+), 1236 deletions(-) rename workspace/{echoreply_health => custom_msgs/health_msgs}/health_msgs/msg/Health.msg (100%) rename workspace/{echoreply_vector3 => custom_msgs/health_msgs}/msg_settings.json (52%) rename workspace/{echoreply_mix => custom_msgs/mix_msgs}/mix_msgs/msg/Mix.msg (100%) create mode 100644 workspace/custom_msgs/mix_msgs/msg_settings.json rename workspace/{echoreply_vector3/geometry_msgs/msg/Vector3.msg => custom_msgs/odometry_msgs/geometry_msgs/msg/Point.msg} (100%) create mode 100644 workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Pose.msg create mode 100644 workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg create mode 100644 workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Quaternion.msg rename workspace/{echoreply_twist => custom_msgs/odometry_msgs}/geometry_msgs/msg/Twist.msg (100%) create mode 100644 workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg create mode 100644 workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Vector3.msg create mode 100644 workspace/custom_msgs/odometry_msgs/msg_settings.json create mode 100644 workspace/custom_msgs/odometry_msgs/nav_msgs/msg/Odometry.msg delete mode 100644 workspace/echoreply_health/msg_settings.json delete mode 100644 workspace/echoreply_location/app.cpp delete mode 100644 workspace/echoreply_location/location_msgs/msg/Location.msg delete mode 100644 workspace/echoreply_location/msg_settings.json delete mode 100644 workspace/echoreply_mix/msg_settings.json rename workspace/{echoreply_location => echoreply_odometry}/Makefile.inc (100%) rename workspace/{echoreply_location => echoreply_odometry}/README.md (100%) rename workspace/{echoreply_location => echoreply_odometry}/app.cdl (100%) rename workspace/{echoreply_location => echoreply_odometry}/app.cfg (100%) rename workspace/{echoreply_vector3 => echoreply_odometry}/app.cpp (54%) rename workspace/{echoreply_location => echoreply_odometry}/app.h (100%) rename workspace/{echoreply_location => echoreply_odometry}/config/autosar_os_ext_asp3_user_config.c (100%) rename workspace/{echoreply_location => echoreply_odometry}/config/autosar_os_ext_asp3_user_config.h (100%) rename workspace/{echoreply_location => echoreply_odometry}/config/autosar_os_ext_user_config.c (100%) rename workspace/{echoreply_location => echoreply_odometry}/config/autosar_os_ext_user_config.h (100%) rename workspace/{echoreply_location => echoreply_odometry}/config/mros2_user_config.c (100%) rename workspace/{echoreply_location => echoreply_odometry}/config/task.cfg (100%) rename workspace/{echoreply_location => echoreply_odometry}/task_impl.c (100%) rename workspace/{echoreply_location => echoreply_odometry}/task_impl.h (100%) delete mode 100644 workspace/echoreply_twist/msg_settings.json delete mode 100644 workspace/echoreply_vector3/Makefile.inc delete mode 100644 workspace/echoreply_vector3/README.md delete mode 100644 workspace/echoreply_vector3/app.cdl delete mode 100644 workspace/echoreply_vector3/app.cfg delete mode 100644 workspace/echoreply_vector3/app.h delete mode 100644 workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.c delete mode 100644 workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.h delete mode 100644 workspace/echoreply_vector3/config/autosar_os_ext_user_config.c delete mode 100644 workspace/echoreply_vector3/config/autosar_os_ext_user_config.h delete mode 100644 workspace/echoreply_vector3/config/mros2_user_config.c delete mode 100644 workspace/echoreply_vector3/config/task.cfg delete mode 100644 workspace/echoreply_vector3/task_impl.c delete mode 100644 workspace/echoreply_vector3/task_impl.h delete mode 100644 workspace/mros2_msgs/geometry_msgs/msg/twist.hpp delete mode 100644 workspace/mros2_msgs/geometry_msgs/msg/vector3.hpp delete mode 100644 workspace/mros2_msgs/health_msgs/msg/health.hpp diff --git a/workspace/echoreply_health/health_msgs/msg/Health.msg b/workspace/custom_msgs/health_msgs/health_msgs/msg/Health.msg similarity index 100% rename from workspace/echoreply_health/health_msgs/msg/Health.msg rename to workspace/custom_msgs/health_msgs/health_msgs/msg/Health.msg diff --git a/workspace/echoreply_vector3/msg_settings.json b/workspace/custom_msgs/health_msgs/msg_settings.json similarity index 52% rename from workspace/echoreply_vector3/msg_settings.json rename to workspace/custom_msgs/health_msgs/msg_settings.json index 9aa05ac..b3636f9 100644 --- a/workspace/echoreply_vector3/msg_settings.json +++ b/workspace/custom_msgs/health_msgs/msg_settings.json @@ -1,7 +1,7 @@ { "includingMsgs": [ [ - "geometry_msgs/msg/Vector3.msg" + "health_msgs/msg/Health.msg" ] ] } \ No newline at end of file diff --git a/workspace/echoreply_mix/mix_msgs/msg/Mix.msg b/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg similarity index 100% rename from workspace/echoreply_mix/mix_msgs/msg/Mix.msg rename to workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg diff --git a/workspace/custom_msgs/mix_msgs/msg_settings.json b/workspace/custom_msgs/mix_msgs/msg_settings.json new file mode 100644 index 0000000..d5dda17 --- /dev/null +++ b/workspace/custom_msgs/mix_msgs/msg_settings.json @@ -0,0 +1,7 @@ +{ + "includingMsgs": [ + [ + "mix_msgs/msg/Mix.msg" + ] + ] +} \ No newline at end of file diff --git a/workspace/echoreply_vector3/geometry_msgs/msg/Vector3.msg b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Point.msg similarity index 100% rename from workspace/echoreply_vector3/geometry_msgs/msg/Vector3.msg rename to workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Point.msg diff --git a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Pose.msg b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Pose.msg new file mode 100644 index 0000000..1e1ff4b --- /dev/null +++ b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Pose.msg @@ -0,0 +1,2 @@ +Point position +Quaternion orientation \ No newline at end of file diff --git a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg new file mode 100644 index 0000000..99f717b --- /dev/null +++ b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg @@ -0,0 +1,2 @@ +Pose pose +float64[] covariance \ No newline at end of file diff --git a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Quaternion.msg b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Quaternion.msg new file mode 100644 index 0000000..e6c4bed --- /dev/null +++ b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Quaternion.msg @@ -0,0 +1,4 @@ +float64 x +float64 y +float64 z +float64 w \ No newline at end of file diff --git a/workspace/echoreply_twist/geometry_msgs/msg/Twist.msg b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Twist.msg similarity index 100% rename from workspace/echoreply_twist/geometry_msgs/msg/Twist.msg rename to workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Twist.msg diff --git a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg new file mode 100644 index 0000000..e4d35ba --- /dev/null +++ b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg @@ -0,0 +1,2 @@ +Twist twist +float64[] covariance \ No newline at end of file diff --git a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Vector3.msg b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Vector3.msg new file mode 100644 index 0000000..681257d --- /dev/null +++ b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Vector3.msg @@ -0,0 +1,3 @@ +float64 x +float64 y +float64 z \ No newline at end of file diff --git a/workspace/custom_msgs/odometry_msgs/msg_settings.json b/workspace/custom_msgs/odometry_msgs/msg_settings.json new file mode 100644 index 0000000..e5acf33 --- /dev/null +++ b/workspace/custom_msgs/odometry_msgs/msg_settings.json @@ -0,0 +1,35 @@ +{ + "includingMsgs": [ + [ + "geometry_msgs/msg/Point.msg" + ], + [ + "geometry_msgs/msg/Quaternion.msg" + ], + [ + "geometry_msgs/msg/Pose.msg", + "geometry_msgs/msg/point.hpp", + "geometry_msgs/msg/quaternion.hpp" + ], + [ + "geometry_msgs/msg/Vector3.msg" + ], + [ + "geometry_msgs/msg/Twist.msg", + "geometry_msgs/msg/vector3.hpp" + ], + [ + "geometry_msgs/msg/PoseWithCovariance.msg", + "geometry_msgs/msg/pose.hpp" + ], + [ + "geometry_msgs/msg/TwistWithCovariance.msg", + "geometry_msgs/msg/twist.hpp" + ], + [ + "nav_msgs/msg/Odometry.msg", + "geometry_msgs/msg/pose_with_covariance.hpp", + "geometry_msgs/msg/twist_with_covariance.hpp" + ] + ] +} \ No newline at end of file diff --git a/workspace/custom_msgs/odometry_msgs/nav_msgs/msg/Odometry.msg b/workspace/custom_msgs/odometry_msgs/nav_msgs/msg/Odometry.msg new file mode 100644 index 0000000..317b27f --- /dev/null +++ b/workspace/custom_msgs/odometry_msgs/nav_msgs/msg/Odometry.msg @@ -0,0 +1,4 @@ +header header +string child_frame_id +PoseWithCovariance pose +TwistWithCovariance twist diff --git a/workspace/echoreply_health/msg_settings.json b/workspace/echoreply_health/msg_settings.json deleted file mode 100644 index 905a5ed..0000000 --- a/workspace/echoreply_health/msg_settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "includingMsgs": [ - [ - "health_msgs/msg/Health.msg" - ] - ] -} \ No newline at end of file diff --git a/workspace/echoreply_location/app.cpp b/workspace/echoreply_location/app.cpp deleted file mode 100644 index a73deec..0000000 --- a/workspace/echoreply_location/app.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "app.h" -#include "mros2.h" -#include "location_msgs/msg/location.hpp" - -#include "stm32f7xx_nucleo_144.h" - -mros2::Subscriber sub; -mros2::Publisher pub; - -void userCallback(location_msgs::msg::Location *msg) -{ - MROS2_INFO("subscribed msg: { x: %d, y: %d, z: %d }", msg->x, msg->y, msg->z); - MROS2_INFO("publishing msg: { x: %d, y: %d, z: %d }", msg->x, msg->y, msg->z); - pub.publish(*msg); -} - -int main(int argc, char * argv[]) -{ - MROS2_INFO("mROS 2 application is started"); - - mros2::init(argc, argv); - MROS2_DEBUG("mROS 2 initialization is completed"); - BSP_LED_Toggle(LED1); - - mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - location_msgs::msg::Location msg; - - MROS2_INFO("ready to pub/sub message"); - mros2::spin(); - BSP_LED_Toggle(LED3); -} - -void main_task(void) -{ - main(0, NULL); -} - -void -led_cyclic_handler(intptr_t exinf) -{ - BSP_LED_Toggle(LED2); -} \ No newline at end of file diff --git a/workspace/echoreply_location/location_msgs/msg/Location.msg b/workspace/echoreply_location/location_msgs/msg/Location.msg deleted file mode 100644 index c69a678..0000000 --- a/workspace/echoreply_location/location_msgs/msg/Location.msg +++ /dev/null @@ -1,3 +0,0 @@ -int16 x -int16 y -int16 z \ No newline at end of file diff --git a/workspace/echoreply_location/msg_settings.json b/workspace/echoreply_location/msg_settings.json deleted file mode 100644 index d599774..0000000 --- a/workspace/echoreply_location/msg_settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "includingMsgs": [ - "location_msgs/msg/Location.msg" - ], - "dependingMsgs": [ - ] -} \ No newline at end of file diff --git a/workspace/echoreply_mix/msg_settings.json b/workspace/echoreply_mix/msg_settings.json deleted file mode 100644 index 6fa3fae..0000000 --- a/workspace/echoreply_mix/msg_settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "includingMsgs": [ - "mix_msgs/msg/Mix.msg" - ], - "dependingMsgs": [ - ] -} \ No newline at end of file diff --git a/workspace/echoreply_location/Makefile.inc b/workspace/echoreply_odometry/Makefile.inc similarity index 100% rename from workspace/echoreply_location/Makefile.inc rename to workspace/echoreply_odometry/Makefile.inc diff --git a/workspace/echoreply_location/README.md b/workspace/echoreply_odometry/README.md similarity index 100% rename from workspace/echoreply_location/README.md rename to workspace/echoreply_odometry/README.md diff --git a/workspace/echoreply_location/app.cdl b/workspace/echoreply_odometry/app.cdl similarity index 100% rename from workspace/echoreply_location/app.cdl rename to workspace/echoreply_odometry/app.cdl diff --git a/workspace/echoreply_location/app.cfg b/workspace/echoreply_odometry/app.cfg similarity index 100% rename from workspace/echoreply_location/app.cfg rename to workspace/echoreply_odometry/app.cfg diff --git a/workspace/echoreply_vector3/app.cpp b/workspace/echoreply_odometry/app.cpp similarity index 54% rename from workspace/echoreply_vector3/app.cpp rename to workspace/echoreply_odometry/app.cpp index 8596482..419f62f 100644 --- a/workspace/echoreply_vector3/app.cpp +++ b/workspace/echoreply_odometry/app.cpp @@ -1,16 +1,16 @@ #include "app.h" #include "mros2.h" -#include "geometry_msgs/msg/vector3.hpp" +#include "../mros2_msgs/nav_msgs/msg/odometry.hpp" #include "stm32f7xx_nucleo_144.h" mros2::Subscriber sub; mros2::Publisher pub; -void userCallback(geometry_msgs::msg::Vector3 *msg) +void userCallback(nav_msgs::msg::Odometry *msg) { - MROS2_INFO("subscribed msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); - MROS2_INFO("publishing msg: { x: %f, y: %f, z: %f }", msg->x, msg->y, msg->z); + MROS2_INFO("subscribed!"); + MROS2_INFO("publishing!"); pub.publish(*msg); } @@ -23,9 +23,9 @@ int main(int argc, char * argv[]) BSP_LED_Toggle(LED1); mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - geometry_msgs::msg::Vector3 msg; + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + nav_msgs::msg::Odometry msg; MROS2_INFO("ready to pub/sub message"); mros2::spin(); diff --git a/workspace/echoreply_location/app.h b/workspace/echoreply_odometry/app.h similarity index 100% rename from workspace/echoreply_location/app.h rename to workspace/echoreply_odometry/app.h diff --git a/workspace/echoreply_location/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_odometry/config/autosar_os_ext_asp3_user_config.c similarity index 100% rename from workspace/echoreply_location/config/autosar_os_ext_asp3_user_config.c rename to workspace/echoreply_odometry/config/autosar_os_ext_asp3_user_config.c diff --git a/workspace/echoreply_location/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_odometry/config/autosar_os_ext_asp3_user_config.h similarity index 100% rename from workspace/echoreply_location/config/autosar_os_ext_asp3_user_config.h rename to workspace/echoreply_odometry/config/autosar_os_ext_asp3_user_config.h diff --git a/workspace/echoreply_location/config/autosar_os_ext_user_config.c b/workspace/echoreply_odometry/config/autosar_os_ext_user_config.c similarity index 100% rename from workspace/echoreply_location/config/autosar_os_ext_user_config.c rename to workspace/echoreply_odometry/config/autosar_os_ext_user_config.c diff --git a/workspace/echoreply_location/config/autosar_os_ext_user_config.h b/workspace/echoreply_odometry/config/autosar_os_ext_user_config.h similarity index 100% rename from workspace/echoreply_location/config/autosar_os_ext_user_config.h rename to workspace/echoreply_odometry/config/autosar_os_ext_user_config.h diff --git a/workspace/echoreply_location/config/mros2_user_config.c b/workspace/echoreply_odometry/config/mros2_user_config.c similarity index 100% rename from workspace/echoreply_location/config/mros2_user_config.c rename to workspace/echoreply_odometry/config/mros2_user_config.c diff --git a/workspace/echoreply_location/config/task.cfg b/workspace/echoreply_odometry/config/task.cfg similarity index 100% rename from workspace/echoreply_location/config/task.cfg rename to workspace/echoreply_odometry/config/task.cfg diff --git a/workspace/echoreply_location/task_impl.c b/workspace/echoreply_odometry/task_impl.c similarity index 100% rename from workspace/echoreply_location/task_impl.c rename to workspace/echoreply_odometry/task_impl.c diff --git a/workspace/echoreply_location/task_impl.h b/workspace/echoreply_odometry/task_impl.h similarity index 100% rename from workspace/echoreply_location/task_impl.h rename to workspace/echoreply_odometry/task_impl.h diff --git a/workspace/echoreply_twist/app.cpp b/workspace/echoreply_twist/app.cpp index d5be014..12c48d0 100644 --- a/workspace/echoreply_twist/app.cpp +++ b/workspace/echoreply_twist/app.cpp @@ -1,6 +1,6 @@ #include "app.h" #include "mros2.h" -#include "geometry_msgs/msg/twist.hpp" +#include "../mros2_msgs/geometry_msgs/msg/twist.hpp" #include "stm32f7xx_nucleo_144.h" diff --git a/workspace/echoreply_twist/msg_settings.json b/workspace/echoreply_twist/msg_settings.json deleted file mode 100644 index 3bc68b1..0000000 --- a/workspace/echoreply_twist/msg_settings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "includingMsgs": [ - [ - "geometry_msgs/msg/Twist.msg", - "geometry_msgs/msg/Vector3.msg" - ] - ] -} \ No newline at end of file diff --git a/workspace/echoreply_vector3/Makefile.inc b/workspace/echoreply_vector3/Makefile.inc deleted file mode 100644 index f807ac1..0000000 --- a/workspace/echoreply_vector3/Makefile.inc +++ /dev/null @@ -1,27 +0,0 @@ -# -# Makefile definition for mros2 application -# - -# name of main application -APPLNAME = app - -# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) -# NOTE: also check `initLogMask` in app.cdl for syslog setting -CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 - -# information for directory tree -APPLDIR := $(APPDIR) -APPLDIR += $(APPDIR)/config - -# link option for C++ code -SRCLANG = c++ -APPL_CXXLIBS += -specs=nano.specs - -# compile switch -CDEFS += -DUSE_ASP3_FOR_STM - -# additional files for configuration -APPL_COBJS := task_impl.o -APPL_COBJS += autosar_os_ext_user_config.o -APPL_COBJS += autosar_os_ext_asp3_user_config.o -APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_vector3/README.md b/workspace/echoreply_vector3/README.md deleted file mode 100644 index a6ee6cb..0000000 --- a/workspace/echoreply_vector3/README.md +++ /dev/null @@ -1,68 +0,0 @@ -### EmbeddedRTPS動作確認用アプリ - -EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 -利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 - -#### LINUX側の準備 -1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします -``` -git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 -``` -2. 通信用アプリをビルドします -``` -cd embeddedRTPS-STM32 -cd linux -mkdir build -cd build -cmake -DTHIRDPARTY=ON .. -make -``` -3. PC上のファイヤウォールの設定を切ります - -#### STM側の設定 -1. IPアドレスを設定します。 -`application/src/lwip.c L69-L80` -``` - IP_ADDRESS[0] = 192; - IP_ADDRESS[1] = 168; - IP_ADDRESS[2] = 11; - IP_ADDRESS[3] = 2; - NETMASK_ADDRESS[0] = 255; - NETMASK_ADDRESS[1] = 255; - NETMASK_ADDRESS[2] = 255; - NETMASK_ADDRESS[3] = 0; - GATEWAY_ADDRESS[0] = 192; - GATEWAY_ADDRESS[1] = 168; - GATEWAY_ADDRESS[2] = 11; - GATEWAY_ADDRESS[3] = 1; - ``` -`embeddedRTPS/include/rtps/config.h L36-L37` -``` -const std::array IP_ADDRESS = { - 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. -``` -2. 本アプリをビルドします - -#### 実行 -1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します -2. ビルドしたlinuxのアプリを実行します -3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です -``` -Conducting new Test... -Send message to the STM32. -Received message from STM32 with len:10 -0 : 10 -1 : 10 -2 : 10 -3 : 10 -4 : 10 -5 : 10 -6 : 10 -7 : 10 -8 : 10 -9 : 10 - -Conducting new Test... -Send message to the STM32. - -``` diff --git a/workspace/echoreply_vector3/app.cdl b/workspace/echoreply_vector3/app.cdl deleted file mode 100644 index 176c5a6..0000000 --- a/workspace/echoreply_vector3/app.cdl +++ /dev/null @@ -1,122 +0,0 @@ -/* - * サンプルプログラム(1)のコンポーネント記述ファイル - * - * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ - */ -/* - * カーネルオブジェクトの定義 - */ -import(); - -/* - * ターゲット非依存のセルタイプの定義 - */ -import("syssvc/tSerialPort.cdl"); -import("syssvc/tSerialAdapter.cdl"); -import("syssvc/tSysLog.cdl"); -import("syssvc/tSysLogAdapter.cdl"); -import("syssvc/tLogTask.cdl"); -import("syssvc/tBanner.cdl"); - -/* - * ターゲット依存部の取り込み - */ -import("target.cdl"); - -/* - * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" - * の行までのことを言う. - */ - -/* - * システムログ機能のアダプタの組上げ記述 - * - * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー - * スのシステムログ機能を呼び出すためのセルである.システムログ機能の - * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び - * 出さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSysLogAdapter SysLogAdapter { - cSysLog = SysLog.eSysLog; -}; - -/* - * シリアルインタフェースドライバのアダプタの組上げ記述 - * - * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー - * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための - * セルである.シリアルインタフェースドライバのサービスコールを呼び出 - * さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSerialAdapter SerialAdapter { - cSerialPort[0] = SerialPort1.eSerialPort; -}; - -/* - * システムログ機能の組上げ記述 - * - * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ - * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, - * システムログタスクはシステムログ機能を使用するため,それも外すこと - * が必要である.また,システムログ機能のアダプタも外さなければならな - * い.tecsgenが警告メッセージを出すが,無視してよい. - */ -cell tSysLog SysLog { - logBufferSize = 32; /* ログバッファのサイズ */ - initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); - /* ログバッファに記録すべき重要度 */ - initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); - /* 低レベル出力すべき重要度 */ - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * シリアルインタフェースドライバの組上げ記述 - * - * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 - * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー - * スドライバを使用するため,それも外すことが必要である.また,シリア - * ルインタフェースドライバのアダプタも外さなければならない. - */ -cell tSerialPort SerialPort1 { - receiveBufferSize = 256; /* 受信バッファのサイズ */ - sendBufferSize = 256; /* 送信バッファのサイズ */ - - /* ターゲット依存部との結合 */ - cSIOPort = SIOPortTarget1.eSIOPort; - eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ -}; - -/* - * システムログタスクの組上げ記述 - * - * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ - * ばよい. - */ -cell tLogTask LogTask { - priority = 3; /* システムログタスクの優先度 */ - stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ - - /* シリアルインタフェースドライバとの結合 */ - cSerialPort = SerialPort1.eSerialPort; - cnSerialPortManage = SerialPort1.enSerialPortManage; - - /* システムログ機能との結合 */ - cSysLog = SysLog.eSysLog; - - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * カーネル起動メッセージ出力の組上げ記述 - * - * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 - * を削除すればよい. - */ -cell tBanner Banner { - /* 属性の設定 */ - targetName = BannerTargetName; - copyrightNotice = BannerCopyrightNotice; -}; diff --git a/workspace/echoreply_vector3/app.cfg b/workspace/echoreply_vector3/app.cfg deleted file mode 100644 index eb0495d..0000000 --- a/workspace/echoreply_vector3/app.cfg +++ /dev/null @@ -1,14 +0,0 @@ -/* - * サンプルプログラム(1)のシステムコンフィギュレーションファイル - */ -INCLUDE("tecsgen.cfg"); -INCLUDE("asp3ext.cfg"); -INCLUDE("task.cfg"); - -#include "app.h" -#include "stm32f7xx_it.h" -CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); -CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); -CFG_INT(77, {TA_EDGE, -4}); - -CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_vector3/app.h b/workspace/echoreply_vector3/app.h deleted file mode 100644 index 36eb6cf..0000000 --- a/workspace/echoreply_vector3/app.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * TOPPERS/ASP Kernel - * Toyohashi Open Platform for Embedded Real-Time Systems/ - * Advanced Standard Profile Kernel - * - * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory - * Toyohashi Univ. of Technology, JAPAN - * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory - * Graduate School of Information Science, Nagoya Univ., JAPAN - * - * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ - * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 - * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. - * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 - * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー - * スコード中に含まれていること. - * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 - * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 - * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 - * の無保証規定を掲載すること. - * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 - * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ - * と. - * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 - * 作権表示,この利用条件および下記の無保証規定を掲載すること. - * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに - * 報告すること. - * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 - * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. - * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 - * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを - * 免責すること. - * - * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お - * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 - * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ - * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ - * の責任を負わない. - * - * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ - */ - -/* - * header file for the mros2 application - */ - -#include - -/* - * Priorities for TOPPERS tasks - */ - -#define MAIN_PRIORITY 5 - -#define HIGH_PRIORITY 9 -#define MID_PRIORITY 10 -#define LOW_PRIORITY 11 - -/* - * Constants that may depend on the target - */ - -#ifndef TASK_PORTID -#define TASK_PORTID 1 -#endif /* TASK_PORTID */ - -#ifndef STACK_SIZE -#define STACK_SIZE 4096 -#endif /* STACK_SIZE */ - -/* - * Declaration of prototyle functions - */ -#ifndef TOPPERS_MACRO_ONLY -#ifdef __cplusplus -extern "C" { -#endif -void main_task(void); -extern void led_cyclic_handler(intptr_t exinf); -#ifdef __cplusplus -} -#endif -void Error_Handler(); -#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.c deleted file mode 100644 index 41ef1da..0000000 --- a/workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "autosar_os_ext_asp3_user_config.h" - -const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), -}; - -const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) -{ - return autosar_os_ext_flag_user_map; -} - -int cmsis_get_flag_user_num(void) -{ - return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; -} diff --git a/workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.h deleted file mode 100644 index 7ad08bf..0000000 --- a/workspace/echoreply_vector3/config/autosar_os_ext_asp3_user_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ - -#include "cmsis_config_utl.h" - -#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) - -extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; - -#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_vector3/config/autosar_os_ext_user_config.c b/workspace/echoreply_vector3/config/autosar_os_ext_user_config.c deleted file mode 100644 index 940941b..0000000 --- a/workspace/echoreply_vector3/config/autosar_os_ext_user_config.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "cmsis_os.h" -#include "autosar_os_ext_user_config.h" - -extern void tcpip_thread(void *arg); -extern void ethernetif_set_link(void* argument); -extern void ethernetif_input(void* argument); -extern void callHbPubFunc(void *arg); -extern void callHbSubFunc(void *arg); -extern void StartDefaultTask(void * argument); -extern void callWriterThreadFunction(void *arg); -extern void callReaderThreadFunction(void *arg); -extern void callRunBroadcast(void *args); -extern void mros2_init(void *args); - - -UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { - { - .taskID = AutosarOsExtTcpTask, - .func = tcpip_thread, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthIfLinkTask, - .func = ethernetif_set_link, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthInputTask, - .func = ethernetif_input, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBPubTask, - .func = callHbPubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBSubTask, - .func = callHbSubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtSPDPTask, - .func = callRunBroadcast, - .argument = NULL, - }, - { - .taskID = AutosarOsExtWriterTask, - .func = callWriterThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtReaderTask, - .func = callReaderThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtMROS2Task, - .func = mros2_init, - .argument = NULL, - }, -}; - -UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) -{ - return user_thread_autosar_ostask_map; -} -int cmsis_get_app_heap_size(void) -{ - return APP_HEAP_SIZE; -} -int cmsis_get_user_thread_num(void) -{ - return USER_THREAD_NUM; -} diff --git a/workspace/echoreply_vector3/config/autosar_os_ext_user_config.h b/workspace/echoreply_vector3/config/autosar_os_ext_user_config.h deleted file mode 100644 index bab78d3..0000000 --- a/workspace/echoreply_vector3/config/autosar_os_ext_user_config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ - -#include "cmsis_os.h" -#include "cmsis_config_utl.h" - -/*********************************************** - * - * MEMORY - * - ***********************************************/ -#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ - - -/*********************************************** - * - * THREAD - * - ***********************************************/ -#define USER_THREAD_NUM 9U - -#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_vector3/config/mros2_user_config.c b/workspace/echoreply_vector3/config/mros2_user_config.c deleted file mode 100644 index 7d2c110..0000000 --- a/workspace/echoreply_vector3/config/mros2_user_config.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#define SUB_MSG_COUNT 10 - -int mros2_get_submsg_count(void) -{ - return SUB_MSG_COUNT; -} - - diff --git a/workspace/echoreply_vector3/config/task.cfg b/workspace/echoreply_vector3/config/task.cfg deleted file mode 100644 index f577110..0000000 --- a/workspace/echoreply_vector3/config/task.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#include "task_impl.h" - -CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); -CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); -CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); -CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); -CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); -CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); -CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); -CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); -CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); -CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); - -CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_vector3/task_impl.c b/workspace/echoreply_vector3/task_impl.c deleted file mode 100644 index afb9fca..0000000 --- a/workspace/echoreply_vector3/task_impl.c +++ /dev/null @@ -1,126 +0,0 @@ -#include "cmsis_os.h" -#include "cmsis_config_utl.h" -#include "task_impl.h" - -TASK(AutosarOsExtTcpTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthIfLinkTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthInputTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBPubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBSubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtSPDPTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtWriterTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtReaderTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtUserDefaultTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtMROS2Task) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} diff --git a/workspace/echoreply_vector3/task_impl.h b/workspace/echoreply_vector3/task_impl.h deleted file mode 100644 index 11e7a81..0000000 --- a/workspace/echoreply_vector3/task_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_TEST_H_ -#define _AUTOSAR_OS_EXT_TEST_H_ - -#include "cmsis_config_utl.h" - -extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); - -/* - * priorities of mROS 2 tasks for RTPS - * - * TODO: We assigned relatevely lower priorities for EthIfLinkTask and - * EthInputTask than the application. Check whether these are appropriate. - */ -#define MROS2_HIGH_PRIORITY MAIN_PRIORITY -#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 - -/* - * experimental: stack size of mROS 2 tasks for RTPS - * Each comment refers the location of original definition - */ -// application/include/lwipopt.h -// #define TCPIP_THREAD_STACKSIZE 1024 -#define MROS2_STACK_SIZE_TcpTask 1024 -// application/src/lwip.c -// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) -#define MROS2_STACK_SIZE_EthIfLinkTask 1024 -// application/src/ethernet.c -// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) -#define MROS2_STACK_SIZE_EthInputTask 350 -// embeddedRTPS/include/config.h -// const int HEARTBEAT_STACKSIZE = 1200; // byte -#define MROS2_STACK_SIZE_HBPubTask 1200 -#define MROS2_STACK_SIZE_HBSubTask 1200 -// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte -#define MROS2_STACK_SIZE_SPDPTask 550 -// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte -#define MROS2_STACK_SIZE_WriterTask 1100 -// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte -#define MROS2_STACK_SIZE_ReaderTask 1600 -// embeddedRTPS-STM32/stm32/Src/main.cpp -// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); -#define MROS2_STACK_SIZE_UserDefaultTask 250 - - -#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/mros2_msgs/geometry_msgs/msg/twist.hpp b/workspace/mros2_msgs/geometry_msgs/msg/twist.hpp deleted file mode 100644 index 6691ca2..0000000 --- a/workspace/mros2_msgs/geometry_msgs/msg/twist.hpp +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef _GEOMETRY_MSGS_MSG_TWIST_H -#define _GEOMETRY_MSGS_MSG_TWIST_H - -#include -#include -#include - - -#include "geometry_msgs/msg/vector3.hpp" - - -using namespace std; - -namespace geometry_msgs -{ -namespace msg -{ -class Twist -{ -public: - uint8_t cntPub = 0; - uint8_t cntSub = 0; - - geometry_msgs::msg::Vector3 linear -; - - geometry_msgs::msg::Vector3 angular; - - - uint8_t copyToBuf(uint8_t *addrPtr) - { - - - cntPub += linear -.copyToBuf(addrPtr); - - - - - cntPub += angular.copyToBuf(addrPtr); - - - - - if (cntPub%4 >0){ - for(int i=0; i<(4-(cntPub%4)) ; i++){ - *addrPtr = 0; - addrPtr += 1; - } - cntPub += 4-(cntPub%4); - } - - return cntPub; - } - - uint8_t copyFromBuf(const uint8_t *rbuf) { - - - cntSub += linear -.copyFromBuf(rbuf); - - - - - cntSub += angular.copyFromBuf(rbuf); - - - - - return cntSub; - } - - uint8_t getTotalSize(){ - return cntPub ; - } - -private: - std::string type_name = "geometry_msgs::msg::dds_::Twist"; -}; -}; -} - -namespace message_traits -{ -template<> -struct TypeName { - static const char* value() - { - return "geometry_msgs::msg::dds_::Twist_"; - } -}; -} - -#endif \ No newline at end of file diff --git a/workspace/mros2_msgs/geometry_msgs/msg/vector3.hpp b/workspace/mros2_msgs/geometry_msgs/msg/vector3.hpp deleted file mode 100644 index ddc398b..0000000 --- a/workspace/mros2_msgs/geometry_msgs/msg/vector3.hpp +++ /dev/null @@ -1,200 +0,0 @@ -#ifndef _GEOMETRY_MSGS_MSG_VECTOR3_H -#define _GEOMETRY_MSGS_MSG_VECTOR3_H - -#include -#include -#include - - - -using namespace std; - -namespace geometry_msgs -{ -namespace msg -{ -class Vector3 -{ -public: - uint8_t cntPub = 0; - uint8_t cntSub = 0; - - double x -; - - double y -; - - double z; - - - uint8_t copyToBuf(uint8_t *addrPtr) - { - - - if (cntPub%4 >0 && 8 > 1){ - if ((8 <= (4-(cntPub%4)))&&(8==2)){ - for (int i=0; i<(4-(cntPub%4))-8; i++){ - *addrPtr = 0; - addrPtr += 1; - } - cntPub += (4-(cntPub%4))-8; - } else { - for(int i=0; i<(4-(cntPub%4)) ; i++){ - *addrPtr = 0; - addrPtr += 1; - } - cntPub += 4-(cntPub%4); - } - } - memcpy(addrPtr,&x -,8); - addrPtr += 8; - cntPub += 8; - - - - - if (cntPub%4 >0 && 8 > 1){ - if ((8 <= (4-(cntPub%4)))&&(8==2)){ - for (int i=0; i<(4-(cntPub%4))-8; i++){ - *addrPtr = 0; - addrPtr += 1; - } - cntPub += (4-(cntPub%4))-8; - } else { - for(int i=0; i<(4-(cntPub%4)) ; i++){ - *addrPtr = 0; - addrPtr += 1; - } - cntPub += 4-(cntPub%4); - } - } - memcpy(addrPtr,&y -,8); - addrPtr += 8; - cntPub += 8; - - - - - if (cntPub%4 >0 && 8 > 1){ - if ((8 <= (4-(cntPub%4)))&&(8==2)){ - for (int i=0; i<(4-(cntPub%4))-8; i++){ - *addrPtr = 0; - addrPtr += 1; - } - cntPub += (4-(cntPub%4))-8; - } else { - for(int i=0; i<(4-(cntPub%4)) ; i++){ - *addrPtr = 0; - addrPtr += 1; - } - cntPub += 4-(cntPub%4); - } - } - memcpy(addrPtr,&z,8); - addrPtr += 8; - cntPub += 8; - - - - - if (cntPub%4 >0){ - for(int i=0; i<(4-(cntPub%4)) ; i++){ - *addrPtr = 0; - addrPtr += 1; - } - cntPub += 4-(cntPub%4); - } - - return cntPub; - } - - uint8_t copyFromBuf(const uint8_t *rbuf) { - - - if (cntSub%4 >0 && 8 > 1){ - if ((8 <= (4-(cntSub%4)))&&(8==2)){ - for (int i=0; i<(4-(cntSub%4))-8; i++){ - rbuf += 1; - } - cntSub += (4-(cntSub%4))-8; - } else { - for(int i=0; i<(4-(cntSub%4)) ; i++){ - rbuf += 1; - } - cntSub += 4-(cntSub%4); - } - } - memcpy(&x -,rbuf,8); - rbuf += 8; - cntSub += 8; - - - - if (cntSub%4 >0 && 8 > 1){ - if ((8 <= (4-(cntSub%4)))&&(8==2)){ - for (int i=0; i<(4-(cntSub%4))-8; i++){ - rbuf += 1; - } - cntSub += (4-(cntSub%4))-8; - } else { - for(int i=0; i<(4-(cntSub%4)) ; i++){ - rbuf += 1; - } - cntSub += 4-(cntSub%4); - } - } - memcpy(&y -,rbuf,8); - rbuf += 8; - cntSub += 8; - - - - if (cntSub%4 >0 && 8 > 1){ - if ((8 <= (4-(cntSub%4)))&&(8==2)){ - for (int i=0; i<(4-(cntSub%4))-8; i++){ - rbuf += 1; - } - cntSub += (4-(cntSub%4))-8; - } else { - for(int i=0; i<(4-(cntSub%4)) ; i++){ - rbuf += 1; - } - cntSub += 4-(cntSub%4); - } - } - memcpy(&z,rbuf,8); - rbuf += 8; - cntSub += 8; - - - - return cntSub; - } - - uint8_t getTotalSize(){ - return cntPub ; - } - -private: - std::string type_name = "geometry_msgs::msg::dds_::Vector3"; -}; -}; -} - -namespace message_traits -{ -template<> -struct TypeName { - static const char* value() - { - return "geometry_msgs::msg::dds_::Vector3_"; - } -}; -} - -#endif \ No newline at end of file diff --git a/workspace/mros2_msgs/health_msgs/msg/health.hpp b/workspace/mros2_msgs/health_msgs/msg/health.hpp deleted file mode 100644 index dcbf2f1..0000000 --- a/workspace/mros2_msgs/health_msgs/msg/health.hpp +++ /dev/null @@ -1,197 +0,0 @@ -#ifndef _HEALTH_MSGS_MSG_HEALTH_H -#define _HEALTH_MSGS_MSG_HEALTH_H - -#include -#include -#include - - - -using namespace std; - -namespace health_msgs -{ -namespace msg -{ -class Health -{ -public: - uint8_t cntPub = 0; - uint8_t cntSub = 0; - - string name -; - - uint16_t height -; - - float weight; - - - uint8_t copyToBuf(uint8_t *addrPtr) - { - - - if (cntPub%4 >0){ - for(int i=0; i<(4-(cntPub%4)) ; i++){ - *addrPtr = 0; - addrPtr += 1; - } - cntPub += 4-(cntPub%4); - } - uint32_t stringSize = name -.size(); - memcpy(addrPtr,&stringSize,4); - addrPtr += 4; - cntPub += 4; - memcpy(addrPtr,name -.c_str(),stringSize); - addrPtr += stringSize; - cntPub += stringSize; - - - - - if (cntPub%4 >0 && 2 > 1){ - if ((2 <= (4-(cntPub%4)))&&(2==2)){ - for (int i=0; i<(4-(cntPub%4))-2; i++){ - *addrPtr = 0; - addrPtr += 1; - } - cntPub += (4-(cntPub%4))-2; - } else { - for(int i=0; i<(4-(cntPub%4)) ; i++){ - *addrPtr = 0; - addrPtr += 1; - } - cntPub += 4-(cntPub%4); - } - } - memcpy(addrPtr,&height -,2); - addrPtr += 2; - cntPub += 2; - - - - - if (cntPub%4 >0 && 4 > 1){ - if ((4 <= (4-(cntPub%4)))&&(4==2)){ - for (int i=0; i<(4-(cntPub%4))-4; i++){ - *addrPtr = 0; - addrPtr += 1; - } - cntPub += (4-(cntPub%4))-4; - } else { - for(int i=0; i<(4-(cntPub%4)) ; i++){ - *addrPtr = 0; - addrPtr += 1; - } - cntPub += 4-(cntPub%4); - } - } - memcpy(addrPtr,&weight,4); - addrPtr += 4; - cntPub += 4; - - - - - if (cntPub%4 >0){ - for(int i=0; i<(4-(cntPub%4)) ; i++){ - *addrPtr = 0; - addrPtr += 1; - } - cntPub += 4-(cntPub%4); - } - - return cntPub; - } - - uint8_t copyFromBuf(const uint8_t *rbuf) { - - - if (cntSub%4 >0){ - for(int i=0; i<(4-(cntSub%4)) ; i++){ - rbuf += 1; - } - cntSub += 4-(cntSub%4); - } - uint32_t stringSize; - memcpy(&stringSize, rbuf, 4); - rbuf += 4; - cntSub += 4; - name -.resize(stringSize); - memcpy(&name -[0],rbuf,stringSize); - rbuf += stringSize; - cntSub += stringSize; - - - - - if (cntSub%4 >0 && 2 > 1){ - if ((2 <= (4-(cntSub%4)))&&(2==2)){ - for (int i=0; i<(4-(cntSub%4))-2; i++){ - rbuf += 1; - } - cntSub += (4-(cntSub%4))-2; - } else { - for(int i=0; i<(4-(cntSub%4)) ; i++){ - rbuf += 1; - } - cntSub += 4-(cntSub%4); - } - } - memcpy(&height -,rbuf,2); - rbuf += 2; - cntSub += 2; - - - - if (cntSub%4 >0 && 4 > 1){ - if ((4 <= (4-(cntSub%4)))&&(4==2)){ - for (int i=0; i<(4-(cntSub%4))-4; i++){ - rbuf += 1; - } - cntSub += (4-(cntSub%4))-4; - } else { - for(int i=0; i<(4-(cntSub%4)) ; i++){ - rbuf += 1; - } - cntSub += 4-(cntSub%4); - } - } - memcpy(&weight,rbuf,4); - rbuf += 4; - cntSub += 4; - - - - return cntSub; - } - - uint8_t getTotalSize(){ - return cntPub ; - } - -private: - std::string type_name = "health_msgs::msg::dds_::Health"; -}; -}; -} - -namespace message_traits -{ -template<> -struct TypeName { - static const char* value() - { - return "health_msgs::msg::dds_::Health_"; - } -}; -} - -#endif \ No newline at end of file From 8447e95f12f207c374e9cbe9143ea4a6700478d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 29 Dec 2021 23:17:50 +0900 Subject: [PATCH 38/80] support header type and echoreply_header app added --- .../custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg | 2 +- .../geometry_msgs/msg/PoseWithCovariance.msg | 2 +- .../geometry_msgs/msg/TwistWithCovariance.msg | 2 +- workspace/echoreply_header/Makefile.inc | 27 ++++ workspace/echoreply_header/README.md | 24 ++++ workspace/echoreply_header/app.cdl | 122 +++++++++++++++++ workspace/echoreply_header/app.cfg | 14 ++ workspace/echoreply_header/app.cpp | 44 ++++++ workspace/echoreply_header/app.h | 84 ++++++++++++ .../config/autosar_os_ext_asp3_user_config.c | 24 ++++ .../config/autosar_os_ext_asp3_user_config.h | 10 ++ .../config/autosar_os_ext_user_config.c | 75 +++++++++++ .../config/autosar_os_ext_user_config.h | 22 +++ .../config/mros2_user_config.c | 10 ++ workspace/echoreply_header/config/task.cfg | 24 ++++ workspace/echoreply_header/task_impl.c | 126 ++++++++++++++++++ workspace/echoreply_header/task_impl.h | 54 ++++++++ workspace/echoreply_health/app.cpp | 2 +- workspace/echoreply_mix/app.cpp | 6 +- workspace/echoreply_twist/app.cpp | 4 +- 20 files changed, 669 insertions(+), 9 deletions(-) create mode 100644 workspace/echoreply_header/Makefile.inc create mode 100644 workspace/echoreply_header/README.md create mode 100644 workspace/echoreply_header/app.cdl create mode 100644 workspace/echoreply_header/app.cfg create mode 100644 workspace/echoreply_header/app.cpp create mode 100644 workspace/echoreply_header/app.h create mode 100644 workspace/echoreply_header/config/autosar_os_ext_asp3_user_config.c create mode 100644 workspace/echoreply_header/config/autosar_os_ext_asp3_user_config.h create mode 100644 workspace/echoreply_header/config/autosar_os_ext_user_config.c create mode 100644 workspace/echoreply_header/config/autosar_os_ext_user_config.h create mode 100644 workspace/echoreply_header/config/mros2_user_config.c create mode 100644 workspace/echoreply_header/config/task.cfg create mode 100644 workspace/echoreply_header/task_impl.c create mode 100644 workspace/echoreply_header/task_impl.h diff --git a/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg b/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg index 4e55741..18da24f 100644 --- a/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg +++ b/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg @@ -1,4 +1,4 @@ string name uint16 height float32 weight -uint16[] array \ No newline at end of file +float64[36] array \ No newline at end of file diff --git a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg index 99f717b..b253beb 100644 --- a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg +++ b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg @@ -1,2 +1,2 @@ Pose pose -float64[] covariance \ No newline at end of file +float64[36] covariance \ No newline at end of file diff --git a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg index e4d35ba..06a7469 100644 --- a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg +++ b/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg @@ -1,2 +1,2 @@ Twist twist -float64[] covariance \ No newline at end of file +float64[36] covariance \ No newline at end of file diff --git a/workspace/echoreply_header/Makefile.inc b/workspace/echoreply_header/Makefile.inc new file mode 100644 index 0000000..f807ac1 --- /dev/null +++ b/workspace/echoreply_header/Makefile.inc @@ -0,0 +1,27 @@ +# +# Makefile definition for mros2 application +# + +# name of main application +APPLNAME = app + +# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) +# NOTE: also check `initLogMask` in app.cdl for syslog setting +CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 + +# information for directory tree +APPLDIR := $(APPDIR) +APPLDIR += $(APPDIR)/config + +# link option for C++ code +SRCLANG = c++ +APPL_CXXLIBS += -specs=nano.specs + +# compile switch +CDEFS += -DUSE_ASP3_FOR_STM + +# additional files for configuration +APPL_COBJS := task_impl.o +APPL_COBJS += autosar_os_ext_user_config.o +APPL_COBJS += autosar_os_ext_asp3_user_config.o +APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_header/README.md b/workspace/echoreply_header/README.md new file mode 100644 index 0000000..6ae2132 --- /dev/null +++ b/workspace/echoreply_header/README.md @@ -0,0 +1,24 @@ +### string型通信動作確認用アプリ + +string型の通信の動作確認をするためのサンプルアプリです。 +以下の手順で確認できます。 + +1.workspaceディレクトリにて、`make app=echoreply_string` によりアプリをビルド + +2.Serial Console (picocomなど) を立ち上げて、初期化 + +3.hostのros2アプリからstring型のmessageを送信 + +4.messageを受信、これを再びhostのros2アプリに向かって送信 (以下) + +``` +Subscribed msg : Hello, world! 1 +Publishing msg : Hello, world! 1 +Subscribed msg : Hello, world! 2 +Publishing msg : Hello, world! 2 +Subscribed msg : Hello, world! 3 +Publishing msg : Hello, world! 3 +Subscribed msg : Hello, world! 4 +Publishing msg : Hello, world! 4 +... +``` diff --git a/workspace/echoreply_header/app.cdl b/workspace/echoreply_header/app.cdl new file mode 100644 index 0000000..176c5a6 --- /dev/null +++ b/workspace/echoreply_header/app.cdl @@ -0,0 +1,122 @@ +/* + * サンプルプログラム(1)のコンポーネント記述ファイル + * + * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ + */ +/* + * カーネルオブジェクトの定義 + */ +import(); + +/* + * ターゲット非依存のセルタイプの定義 + */ +import("syssvc/tSerialPort.cdl"); +import("syssvc/tSerialAdapter.cdl"); +import("syssvc/tSysLog.cdl"); +import("syssvc/tSysLogAdapter.cdl"); +import("syssvc/tLogTask.cdl"); +import("syssvc/tBanner.cdl"); + +/* + * ターゲット依存部の取り込み + */ +import("target.cdl"); + +/* + * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" + * の行までのことを言う. + */ + +/* + * システムログ機能のアダプタの組上げ記述 + * + * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー + * スのシステムログ機能を呼び出すためのセルである.システムログ機能の + * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び + * 出さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSysLogAdapter SysLogAdapter { + cSysLog = SysLog.eSysLog; +}; + +/* + * シリアルインタフェースドライバのアダプタの組上げ記述 + * + * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー + * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための + * セルである.シリアルインタフェースドライバのサービスコールを呼び出 + * さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSerialAdapter SerialAdapter { + cSerialPort[0] = SerialPort1.eSerialPort; +}; + +/* + * システムログ機能の組上げ記述 + * + * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ + * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, + * システムログタスクはシステムログ機能を使用するため,それも外すこと + * が必要である.また,システムログ機能のアダプタも外さなければならな + * い.tecsgenが警告メッセージを出すが,無視してよい. + */ +cell tSysLog SysLog { + logBufferSize = 32; /* ログバッファのサイズ */ + initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); + /* ログバッファに記録すべき重要度 */ + initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); + /* 低レベル出力すべき重要度 */ + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * シリアルインタフェースドライバの組上げ記述 + * + * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 + * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー + * スドライバを使用するため,それも外すことが必要である.また,シリア + * ルインタフェースドライバのアダプタも外さなければならない. + */ +cell tSerialPort SerialPort1 { + receiveBufferSize = 256; /* 受信バッファのサイズ */ + sendBufferSize = 256; /* 送信バッファのサイズ */ + + /* ターゲット依存部との結合 */ + cSIOPort = SIOPortTarget1.eSIOPort; + eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ +}; + +/* + * システムログタスクの組上げ記述 + * + * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ + * ばよい. + */ +cell tLogTask LogTask { + priority = 3; /* システムログタスクの優先度 */ + stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ + + /* シリアルインタフェースドライバとの結合 */ + cSerialPort = SerialPort1.eSerialPort; + cnSerialPortManage = SerialPort1.enSerialPortManage; + + /* システムログ機能との結合 */ + cSysLog = SysLog.eSysLog; + + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * カーネル起動メッセージ出力の組上げ記述 + * + * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 + * を削除すればよい. + */ +cell tBanner Banner { + /* 属性の設定 */ + targetName = BannerTargetName; + copyrightNotice = BannerCopyrightNotice; +}; diff --git a/workspace/echoreply_header/app.cfg b/workspace/echoreply_header/app.cfg new file mode 100644 index 0000000..eb0495d --- /dev/null +++ b/workspace/echoreply_header/app.cfg @@ -0,0 +1,14 @@ +/* + * サンプルプログラム(1)のシステムコンフィギュレーションファイル + */ +INCLUDE("tecsgen.cfg"); +INCLUDE("asp3ext.cfg"); +INCLUDE("task.cfg"); + +#include "app.h" +#include "stm32f7xx_it.h" +CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); +CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); +CFG_INT(77, {TA_EDGE, -4}); + +CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_header/app.cpp b/workspace/echoreply_header/app.cpp new file mode 100644 index 0000000..e43cdc2 --- /dev/null +++ b/workspace/echoreply_header/app.cpp @@ -0,0 +1,44 @@ +#include "app.h" +#include "mros2.h" +#include "std_msgs/msg/header.hpp" + +#include "stm32f7xx_nucleo_144.h" + +mros2::Subscriber sub; +mros2::Publisher pub; + +void userCallback(std_msgs::msg::Header *msg) +{ + MROS2_INFO("subscribed msg!"); + MROS2_INFO("publishing msg!"); + pub.publish(*msg); +} + +int main(int argc, char * argv[]) +{ + MROS2_INFO("mROS 2 application is started"); + + mros2::init(argc, argv); + MROS2_DEBUG("mROS 2 initialization is completed"); + BSP_LED_Toggle(LED1); + + mros2::Node node = mros2::Node::create_node("mros2_node"); + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + std_msgs::msg::Header msg; + + MROS2_INFO("ready to pub/sub message"); + mros2::spin(); + BSP_LED_Toggle(LED3); +} + +void main_task(void) +{ + main(0, NULL); +} + +void +led_cyclic_handler(intptr_t exinf) +{ + BSP_LED_Toggle(LED2); +} diff --git a/workspace/echoreply_header/app.h b/workspace/echoreply_header/app.h new file mode 100644 index 0000000..36eb6cf --- /dev/null +++ b/workspace/echoreply_header/app.h @@ -0,0 +1,84 @@ +/* + * TOPPERS/ASP Kernel + * Toyohashi Open Platform for Embedded Real-Time Systems/ + * Advanced Standard Profile Kernel + * + * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory + * Toyohashi Univ. of Technology, JAPAN + * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory + * Graduate School of Information Science, Nagoya Univ., JAPAN + * + * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ + * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 + * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. + * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 + * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー + * スコード中に含まれていること. + * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 + * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 + * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 + * の無保証規定を掲載すること. + * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 + * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ + * と. + * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 + * 作権表示,この利用条件および下記の無保証規定を掲載すること. + * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに + * 報告すること. + * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 + * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. + * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 + * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを + * 免責すること. + * + * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お + * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 + * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ + * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ + * の責任を負わない. + * + * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ + */ + +/* + * header file for the mros2 application + */ + +#include + +/* + * Priorities for TOPPERS tasks + */ + +#define MAIN_PRIORITY 5 + +#define HIGH_PRIORITY 9 +#define MID_PRIORITY 10 +#define LOW_PRIORITY 11 + +/* + * Constants that may depend on the target + */ + +#ifndef TASK_PORTID +#define TASK_PORTID 1 +#endif /* TASK_PORTID */ + +#ifndef STACK_SIZE +#define STACK_SIZE 4096 +#endif /* STACK_SIZE */ + +/* + * Declaration of prototyle functions + */ +#ifndef TOPPERS_MACRO_ONLY +#ifdef __cplusplus +extern "C" { +#endif +void main_task(void); +extern void led_cyclic_handler(intptr_t exinf); +#ifdef __cplusplus +} +#endif +void Error_Handler(); +#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_header/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_header/config/autosar_os_ext_asp3_user_config.c new file mode 100644 index 0000000..41ef1da --- /dev/null +++ b/workspace/echoreply_header/config/autosar_os_ext_asp3_user_config.c @@ -0,0 +1,24 @@ +#include "autosar_os_ext_asp3_user_config.h" + +const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), +}; + +const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) +{ + return autosar_os_ext_flag_user_map; +} + +int cmsis_get_flag_user_num(void) +{ + return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; +} diff --git a/workspace/echoreply_header/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_header/config/autosar_os_ext_asp3_user_config.h new file mode 100644 index 0000000..7ad08bf --- /dev/null +++ b/workspace/echoreply_header/config/autosar_os_ext_asp3_user_config.h @@ -0,0 +1,10 @@ +#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ + +#include "cmsis_config_utl.h" + +#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) + +extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; + +#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_header/config/autosar_os_ext_user_config.c b/workspace/echoreply_header/config/autosar_os_ext_user_config.c new file mode 100644 index 0000000..940941b --- /dev/null +++ b/workspace/echoreply_header/config/autosar_os_ext_user_config.c @@ -0,0 +1,75 @@ +#include "cmsis_os.h" +#include "autosar_os_ext_user_config.h" + +extern void tcpip_thread(void *arg); +extern void ethernetif_set_link(void* argument); +extern void ethernetif_input(void* argument); +extern void callHbPubFunc(void *arg); +extern void callHbSubFunc(void *arg); +extern void StartDefaultTask(void * argument); +extern void callWriterThreadFunction(void *arg); +extern void callReaderThreadFunction(void *arg); +extern void callRunBroadcast(void *args); +extern void mros2_init(void *args); + + +UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { + { + .taskID = AutosarOsExtTcpTask, + .func = tcpip_thread, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthIfLinkTask, + .func = ethernetif_set_link, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthInputTask, + .func = ethernetif_input, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBPubTask, + .func = callHbPubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBSubTask, + .func = callHbSubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtSPDPTask, + .func = callRunBroadcast, + .argument = NULL, + }, + { + .taskID = AutosarOsExtWriterTask, + .func = callWriterThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtReaderTask, + .func = callReaderThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtMROS2Task, + .func = mros2_init, + .argument = NULL, + }, +}; + +UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) +{ + return user_thread_autosar_ostask_map; +} +int cmsis_get_app_heap_size(void) +{ + return APP_HEAP_SIZE; +} +int cmsis_get_user_thread_num(void) +{ + return USER_THREAD_NUM; +} diff --git a/workspace/echoreply_header/config/autosar_os_ext_user_config.h b/workspace/echoreply_header/config/autosar_os_ext_user_config.h new file mode 100644 index 0000000..bab78d3 --- /dev/null +++ b/workspace/echoreply_header/config/autosar_os_ext_user_config.h @@ -0,0 +1,22 @@ +#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ + +#include "cmsis_os.h" +#include "cmsis_config_utl.h" + +/*********************************************** + * + * MEMORY + * + ***********************************************/ +#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ + + +/*********************************************** + * + * THREAD + * + ***********************************************/ +#define USER_THREAD_NUM 9U + +#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_header/config/mros2_user_config.c b/workspace/echoreply_header/config/mros2_user_config.c new file mode 100644 index 0000000..7d2c110 --- /dev/null +++ b/workspace/echoreply_header/config/mros2_user_config.c @@ -0,0 +1,10 @@ + + +#define SUB_MSG_COUNT 10 + +int mros2_get_submsg_count(void) +{ + return SUB_MSG_COUNT; +} + + diff --git a/workspace/echoreply_header/config/task.cfg b/workspace/echoreply_header/config/task.cfg new file mode 100644 index 0000000..f577110 --- /dev/null +++ b/workspace/echoreply_header/config/task.cfg @@ -0,0 +1,24 @@ +#include "task_impl.h" + +CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); +CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); +CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); +CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); +CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); +CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); +CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); +CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); +CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); +CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); + +CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_header/task_impl.c b/workspace/echoreply_header/task_impl.c new file mode 100644 index 0000000..afb9fca --- /dev/null +++ b/workspace/echoreply_header/task_impl.c @@ -0,0 +1,126 @@ +#include "cmsis_os.h" +#include "cmsis_config_utl.h" +#include "task_impl.h" + +TASK(AutosarOsExtTcpTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthIfLinkTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthInputTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBPubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBSubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtSPDPTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtWriterTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtReaderTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtUserDefaultTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtMROS2Task) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} diff --git a/workspace/echoreply_header/task_impl.h b/workspace/echoreply_header/task_impl.h new file mode 100644 index 0000000..11e7a81 --- /dev/null +++ b/workspace/echoreply_header/task_impl.h @@ -0,0 +1,54 @@ +#ifndef _AUTOSAR_OS_EXT_TEST_H_ +#define _AUTOSAR_OS_EXT_TEST_H_ + +#include "cmsis_config_utl.h" + +extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); + +/* + * priorities of mROS 2 tasks for RTPS + * + * TODO: We assigned relatevely lower priorities for EthIfLinkTask and + * EthInputTask than the application. Check whether these are appropriate. + */ +#define MROS2_HIGH_PRIORITY MAIN_PRIORITY +#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 + +/* + * experimental: stack size of mROS 2 tasks for RTPS + * Each comment refers the location of original definition + */ +// application/include/lwipopt.h +// #define TCPIP_THREAD_STACKSIZE 1024 +#define MROS2_STACK_SIZE_TcpTask 1024 +// application/src/lwip.c +// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) +#define MROS2_STACK_SIZE_EthIfLinkTask 1024 +// application/src/ethernet.c +// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) +#define MROS2_STACK_SIZE_EthInputTask 350 +// embeddedRTPS/include/config.h +// const int HEARTBEAT_STACKSIZE = 1200; // byte +#define MROS2_STACK_SIZE_HBPubTask 1200 +#define MROS2_STACK_SIZE_HBSubTask 1200 +// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte +#define MROS2_STACK_SIZE_SPDPTask 550 +// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte +#define MROS2_STACK_SIZE_WriterTask 1100 +// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte +#define MROS2_STACK_SIZE_ReaderTask 1600 +// embeddedRTPS-STM32/stm32/Src/main.cpp +// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); +#define MROS2_STACK_SIZE_UserDefaultTask 250 + + +#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/echoreply_health/app.cpp b/workspace/echoreply_health/app.cpp index 18d2e5b..7d0ba6a 100644 --- a/workspace/echoreply_health/app.cpp +++ b/workspace/echoreply_health/app.cpp @@ -1,6 +1,6 @@ #include "app.h" #include "mros2.h" -#include "health_msgs/msg/health.hpp" +#include "../mros2_msgs/health_msgs/msg/health.hpp" #include "stm32f7xx_nucleo_144.h" diff --git a/workspace/echoreply_mix/app.cpp b/workspace/echoreply_mix/app.cpp index 1bf72f8..b8642ac 100644 --- a/workspace/echoreply_mix/app.cpp +++ b/workspace/echoreply_mix/app.cpp @@ -1,6 +1,6 @@ #include "app.h" #include "mros2.h" -#include "mix_msgs/msg/mix.hpp" +#include "../mros2_msgs/mix_msgs/msg/mix.hpp" #include "stm32f7xx_nucleo_144.h" @@ -9,8 +9,8 @@ mros2::Publisher pub; void userCallback(mix_msgs::msg::Mix *msg) { - MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg, array: {%u,%u,%u} }", msg->name.c_str(), msg->height, msg->weight, msg->array[0], msg->array[1], msg->array[2]); - MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg, array: {%u,%u,%u} }", msg->name.c_str(), msg->height, msg->weight, msg->array[0], msg->array[1], msg->array[2]); + MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg, array: {%f,%f,%f} }", msg->name.c_str(), msg->height, msg->weight, msg->array[0], msg->array[1], msg->array[2]); + MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg, array: {%f,%f,%f} }", msg->name.c_str(), msg->height, msg->weight, msg->array[0], msg->array[1], msg->array[2]); pub.publish(*msg); } diff --git a/workspace/echoreply_twist/app.cpp b/workspace/echoreply_twist/app.cpp index 12c48d0..8519513 100644 --- a/workspace/echoreply_twist/app.cpp +++ b/workspace/echoreply_twist/app.cpp @@ -9,8 +9,8 @@ mros2::Publisher pub; void userCallback(geometry_msgs::msg::Twist *msg) { - MROS2_INFO("subscribed msg: { linear: { x: , y: , z: }, angular: { x: , y: , z: } }"); - MROS2_INFO("publishing msg: { linear: { x: , y: , z: }, angular: { x: , y: , z: } }"); + MROS2_INFO("subscribed msg!"); + MROS2_INFO("publishing msg!"); pub.publish(*msg); } From 80b936dfcf53fcf069cde87d30f050aea6393444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 30 Dec 2021 01:00:56 +0900 Subject: [PATCH 39/80] mix app modified --- .../custom_msgs/mix_msgs/mix_msgs/msg/IntVector3.msg | 3 +++ workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg | 3 ++- workspace/custom_msgs/mix_msgs/msg_settings.json | 8 ++++++-- workspace/echoreply_mix/app.cpp | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 workspace/custom_msgs/mix_msgs/mix_msgs/msg/IntVector3.msg diff --git a/workspace/custom_msgs/mix_msgs/mix_msgs/msg/IntVector3.msg b/workspace/custom_msgs/mix_msgs/mix_msgs/msg/IntVector3.msg new file mode 100644 index 0000000..e8b93b2 --- /dev/null +++ b/workspace/custom_msgs/mix_msgs/mix_msgs/msg/IntVector3.msg @@ -0,0 +1,3 @@ +uint16 x +uint16 y +uint16 z \ No newline at end of file diff --git a/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg b/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg index 18da24f..b5bc382 100644 --- a/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg +++ b/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg @@ -1,4 +1,5 @@ string name +IntVector3 vec3 uint16 height float32 weight -float64[36] array \ No newline at end of file +float64[] array \ No newline at end of file diff --git a/workspace/custom_msgs/mix_msgs/msg_settings.json b/workspace/custom_msgs/mix_msgs/msg_settings.json index d5dda17..33112ac 100644 --- a/workspace/custom_msgs/mix_msgs/msg_settings.json +++ b/workspace/custom_msgs/mix_msgs/msg_settings.json @@ -1,7 +1,11 @@ { - "includingMsgs": [ + "includingMsgs": [ [ - "mix_msgs/msg/Mix.msg" + "mix_msgs/msg/IntVector3.msg" + ], + [ + "mix_msgs/msg/Mix.msg", + "mix_msgs/msg/int_vector3.hpp" ] ] } \ No newline at end of file diff --git a/workspace/echoreply_mix/app.cpp b/workspace/echoreply_mix/app.cpp index b8642ac..ac56293 100644 --- a/workspace/echoreply_mix/app.cpp +++ b/workspace/echoreply_mix/app.cpp @@ -9,8 +9,8 @@ mros2::Publisher pub; void userCallback(mix_msgs::msg::Mix *msg) { - MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg, array: {%f,%f,%f} }", msg->name.c_str(), msg->height, msg->weight, msg->array[0], msg->array[1], msg->array[2]); - MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg, array: {%f,%f,%f} }", msg->name.c_str(), msg->height, msg->weight, msg->array[0], msg->array[1], msg->array[2]); + MROS2_INFO("subscribed msg!"); + MROS2_INFO("publishing msg!"); pub.publish(*msg); } From 5ebe5ad44a36c08014abe47b229808036cabeb7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Fri, 31 Dec 2021 00:52:57 +0900 Subject: [PATCH 40/80] Makefile modified --- workspace/Makefile | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 workspace/Makefile diff --git a/workspace/Makefile b/workspace/Makefile new file mode 100644 index 0000000..6e40691 --- /dev/null +++ b/workspace/Makefile @@ -0,0 +1,38 @@ + +# get the app name with the argument of make +APPNAME := ${app} +BUILDSPACE := build + +BOARDNAME := NODE_F767ZI +BOARDPATH := /Volumes/${BOARDNAME} + +MSGDIR := custom_msgs/${msg} +MROS2DIR := ../mros2 +HEADERGEN_FILE := $(MROS2DIR)/mros2_header_generator/header_generator.py + +ifdef app +# nothing to do +else +usage: + @echo Please specify the application + @echo Usage Guide:make app="" +endif + +all: clean + @cd $(BUILDSPACE) && make -j4 -f Makefile.common app=${APPNAME} + @cp $(BUILDSPACE)/asp.bin . && cp $(BUILDSPACE)/asp.elf . + @echo "Build complete successfully" + @if [ -d "$(BOARDPATH)" ]; then \ + echo "Copying binary to the board..."; \ + cp asp.bin $(BOARDPATH); \ + echo "completed"; \ + fi + +clean: + @cd $(BUILDSPACE) && make -f Makefile.common clean + rm -f asp.* + +gen-msg: + @if [ -a $(MSGDIR)/msg_settings.json ]; then \ + python $(HEADERGEN_FILE) $(MROS2DIR) $(MSGDIR); \ + fi From 27f7bbbeb239822f3c67b0931d437b525dbf3c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Fri, 31 Dec 2021 00:53:52 +0900 Subject: [PATCH 41/80] Makefile modified --- workspace/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/Makefile b/workspace/Makefile index 6e40691..9d565d1 100644 --- a/workspace/Makefile +++ b/workspace/Makefile @@ -4,7 +4,7 @@ APPNAME := ${app} BUILDSPACE := build BOARDNAME := NODE_F767ZI -BOARDPATH := /Volumes/${BOARDNAME} +BOARDPATH := /Volumes/${BOARDNAME} # this path is MacOS's case; not Linux's case MSGDIR := custom_msgs/${msg} MROS2DIR := ../mros2 From a5eb4ba798380ba34f973dd724ceab81aa1a2381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Fri, 31 Dec 2021 01:23:05 +0900 Subject: [PATCH 42/80] joint_state app added --- .../custom_msgs/sensor_msgs/msg_settings.json | 7 + .../sensor_msgs/msg/JointState.msg | 5 + workspace/echoreply_joint_state/Makefile.inc | 27 ++++ workspace/echoreply_joint_state/README.md | 68 ++++++++++ workspace/echoreply_joint_state/app.cdl | 122 +++++++++++++++++ workspace/echoreply_joint_state/app.cfg | 14 ++ workspace/echoreply_joint_state/app.cpp | 44 ++++++ workspace/echoreply_joint_state/app.h | 84 ++++++++++++ .../config/autosar_os_ext_asp3_user_config.c | 24 ++++ .../config/autosar_os_ext_asp3_user_config.h | 10 ++ .../config/autosar_os_ext_user_config.c | 75 +++++++++++ .../config/autosar_os_ext_user_config.h | 22 +++ .../config/mros2_user_config.c | 10 ++ .../echoreply_joint_state/config/task.cfg | 24 ++++ workspace/echoreply_joint_state/task_impl.c | 126 ++++++++++++++++++ workspace/echoreply_joint_state/task_impl.h | 54 ++++++++ 16 files changed, 716 insertions(+) create mode 100644 workspace/custom_msgs/sensor_msgs/msg_settings.json create mode 100644 workspace/custom_msgs/sensor_msgs/sensor_msgs/msg/JointState.msg create mode 100644 workspace/echoreply_joint_state/Makefile.inc create mode 100644 workspace/echoreply_joint_state/README.md create mode 100644 workspace/echoreply_joint_state/app.cdl create mode 100644 workspace/echoreply_joint_state/app.cfg create mode 100644 workspace/echoreply_joint_state/app.cpp create mode 100644 workspace/echoreply_joint_state/app.h create mode 100644 workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.c create mode 100644 workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.h create mode 100644 workspace/echoreply_joint_state/config/autosar_os_ext_user_config.c create mode 100644 workspace/echoreply_joint_state/config/autosar_os_ext_user_config.h create mode 100644 workspace/echoreply_joint_state/config/mros2_user_config.c create mode 100644 workspace/echoreply_joint_state/config/task.cfg create mode 100644 workspace/echoreply_joint_state/task_impl.c create mode 100644 workspace/echoreply_joint_state/task_impl.h diff --git a/workspace/custom_msgs/sensor_msgs/msg_settings.json b/workspace/custom_msgs/sensor_msgs/msg_settings.json new file mode 100644 index 0000000..a82ff9c --- /dev/null +++ b/workspace/custom_msgs/sensor_msgs/msg_settings.json @@ -0,0 +1,7 @@ +{ + "includingMsgs": [ + [ + "sensor_msgs/msg/JointState.msg" + ] + ] +} \ No newline at end of file diff --git a/workspace/custom_msgs/sensor_msgs/sensor_msgs/msg/JointState.msg b/workspace/custom_msgs/sensor_msgs/sensor_msgs/msg/JointState.msg new file mode 100644 index 0000000..5f4e133 --- /dev/null +++ b/workspace/custom_msgs/sensor_msgs/sensor_msgs/msg/JointState.msg @@ -0,0 +1,5 @@ +header header +string[] name +float64[] position +float64[] velocity +float64[] effort \ No newline at end of file diff --git a/workspace/echoreply_joint_state/Makefile.inc b/workspace/echoreply_joint_state/Makefile.inc new file mode 100644 index 0000000..f807ac1 --- /dev/null +++ b/workspace/echoreply_joint_state/Makefile.inc @@ -0,0 +1,27 @@ +# +# Makefile definition for mros2 application +# + +# name of main application +APPLNAME = app + +# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) +# NOTE: also check `initLogMask` in app.cdl for syslog setting +CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 + +# information for directory tree +APPLDIR := $(APPDIR) +APPLDIR += $(APPDIR)/config + +# link option for C++ code +SRCLANG = c++ +APPL_CXXLIBS += -specs=nano.specs + +# compile switch +CDEFS += -DUSE_ASP3_FOR_STM + +# additional files for configuration +APPL_COBJS := task_impl.o +APPL_COBJS += autosar_os_ext_user_config.o +APPL_COBJS += autosar_os_ext_asp3_user_config.o +APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_joint_state/README.md b/workspace/echoreply_joint_state/README.md new file mode 100644 index 0000000..a6ee6cb --- /dev/null +++ b/workspace/echoreply_joint_state/README.md @@ -0,0 +1,68 @@ +### EmbeddedRTPS動作確認用アプリ + +EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 +利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 + +#### LINUX側の準備 +1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします +``` +git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 +``` +2. 通信用アプリをビルドします +``` +cd embeddedRTPS-STM32 +cd linux +mkdir build +cd build +cmake -DTHIRDPARTY=ON .. +make +``` +3. PC上のファイヤウォールの設定を切ります + +#### STM側の設定 +1. IPアドレスを設定します。 +`application/src/lwip.c L69-L80` +``` + IP_ADDRESS[0] = 192; + IP_ADDRESS[1] = 168; + IP_ADDRESS[2] = 11; + IP_ADDRESS[3] = 2; + NETMASK_ADDRESS[0] = 255; + NETMASK_ADDRESS[1] = 255; + NETMASK_ADDRESS[2] = 255; + NETMASK_ADDRESS[3] = 0; + GATEWAY_ADDRESS[0] = 192; + GATEWAY_ADDRESS[1] = 168; + GATEWAY_ADDRESS[2] = 11; + GATEWAY_ADDRESS[3] = 1; + ``` +`embeddedRTPS/include/rtps/config.h L36-L37` +``` +const std::array IP_ADDRESS = { + 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. +``` +2. 本アプリをビルドします + +#### 実行 +1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します +2. ビルドしたlinuxのアプリを実行します +3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です +``` +Conducting new Test... +Send message to the STM32. +Received message from STM32 with len:10 +0 : 10 +1 : 10 +2 : 10 +3 : 10 +4 : 10 +5 : 10 +6 : 10 +7 : 10 +8 : 10 +9 : 10 + +Conducting new Test... +Send message to the STM32. + +``` diff --git a/workspace/echoreply_joint_state/app.cdl b/workspace/echoreply_joint_state/app.cdl new file mode 100644 index 0000000..176c5a6 --- /dev/null +++ b/workspace/echoreply_joint_state/app.cdl @@ -0,0 +1,122 @@ +/* + * サンプルプログラム(1)のコンポーネント記述ファイル + * + * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ + */ +/* + * カーネルオブジェクトの定義 + */ +import(); + +/* + * ターゲット非依存のセルタイプの定義 + */ +import("syssvc/tSerialPort.cdl"); +import("syssvc/tSerialAdapter.cdl"); +import("syssvc/tSysLog.cdl"); +import("syssvc/tSysLogAdapter.cdl"); +import("syssvc/tLogTask.cdl"); +import("syssvc/tBanner.cdl"); + +/* + * ターゲット依存部の取り込み + */ +import("target.cdl"); + +/* + * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" + * の行までのことを言う. + */ + +/* + * システムログ機能のアダプタの組上げ記述 + * + * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー + * スのシステムログ機能を呼び出すためのセルである.システムログ機能の + * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び + * 出さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSysLogAdapter SysLogAdapter { + cSysLog = SysLog.eSysLog; +}; + +/* + * シリアルインタフェースドライバのアダプタの組上げ記述 + * + * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー + * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための + * セルである.シリアルインタフェースドライバのサービスコールを呼び出 + * さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSerialAdapter SerialAdapter { + cSerialPort[0] = SerialPort1.eSerialPort; +}; + +/* + * システムログ機能の組上げ記述 + * + * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ + * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, + * システムログタスクはシステムログ機能を使用するため,それも外すこと + * が必要である.また,システムログ機能のアダプタも外さなければならな + * い.tecsgenが警告メッセージを出すが,無視してよい. + */ +cell tSysLog SysLog { + logBufferSize = 32; /* ログバッファのサイズ */ + initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); + /* ログバッファに記録すべき重要度 */ + initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); + /* 低レベル出力すべき重要度 */ + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * シリアルインタフェースドライバの組上げ記述 + * + * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 + * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー + * スドライバを使用するため,それも外すことが必要である.また,シリア + * ルインタフェースドライバのアダプタも外さなければならない. + */ +cell tSerialPort SerialPort1 { + receiveBufferSize = 256; /* 受信バッファのサイズ */ + sendBufferSize = 256; /* 送信バッファのサイズ */ + + /* ターゲット依存部との結合 */ + cSIOPort = SIOPortTarget1.eSIOPort; + eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ +}; + +/* + * システムログタスクの組上げ記述 + * + * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ + * ばよい. + */ +cell tLogTask LogTask { + priority = 3; /* システムログタスクの優先度 */ + stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ + + /* シリアルインタフェースドライバとの結合 */ + cSerialPort = SerialPort1.eSerialPort; + cnSerialPortManage = SerialPort1.enSerialPortManage; + + /* システムログ機能との結合 */ + cSysLog = SysLog.eSysLog; + + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * カーネル起動メッセージ出力の組上げ記述 + * + * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 + * を削除すればよい. + */ +cell tBanner Banner { + /* 属性の設定 */ + targetName = BannerTargetName; + copyrightNotice = BannerCopyrightNotice; +}; diff --git a/workspace/echoreply_joint_state/app.cfg b/workspace/echoreply_joint_state/app.cfg new file mode 100644 index 0000000..eb0495d --- /dev/null +++ b/workspace/echoreply_joint_state/app.cfg @@ -0,0 +1,14 @@ +/* + * サンプルプログラム(1)のシステムコンフィギュレーションファイル + */ +INCLUDE("tecsgen.cfg"); +INCLUDE("asp3ext.cfg"); +INCLUDE("task.cfg"); + +#include "app.h" +#include "stm32f7xx_it.h" +CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); +CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); +CFG_INT(77, {TA_EDGE, -4}); + +CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_joint_state/app.cpp b/workspace/echoreply_joint_state/app.cpp new file mode 100644 index 0000000..b1af090 --- /dev/null +++ b/workspace/echoreply_joint_state/app.cpp @@ -0,0 +1,44 @@ +#include "app.h" +#include "mros2.h" +#include "../mros2_msgs/sensor_msgs/msg/joint_state.hpp" + +#include "stm32f7xx_nucleo_144.h" + +mros2::Subscriber sub; +mros2::Publisher pub; + +void userCallback(sensor_msgs::msg::JointState *msg) +{ + MROS2_INFO("subscribed msg!"); + MROS2_INFO("publishing msg!"); + pub.publish(*msg); +} + +int main(int argc, char * argv[]) +{ + MROS2_INFO("mROS 2 application is started"); + + mros2::init(argc, argv); + MROS2_DEBUG("mROS 2 initialization is completed"); + BSP_LED_Toggle(LED1); + + mros2::Node node = mros2::Node::create_node("mros2_node"); + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + sensor_msgs::msg::JointState msg; + + MROS2_INFO("ready to pub/sub message"); + mros2::spin(); + BSP_LED_Toggle(LED3); +} + +void main_task(void) +{ + main(0, NULL); +} + +void +led_cyclic_handler(intptr_t exinf) +{ + BSP_LED_Toggle(LED2); +} \ No newline at end of file diff --git a/workspace/echoreply_joint_state/app.h b/workspace/echoreply_joint_state/app.h new file mode 100644 index 0000000..36eb6cf --- /dev/null +++ b/workspace/echoreply_joint_state/app.h @@ -0,0 +1,84 @@ +/* + * TOPPERS/ASP Kernel + * Toyohashi Open Platform for Embedded Real-Time Systems/ + * Advanced Standard Profile Kernel + * + * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory + * Toyohashi Univ. of Technology, JAPAN + * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory + * Graduate School of Information Science, Nagoya Univ., JAPAN + * + * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ + * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 + * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. + * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 + * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー + * スコード中に含まれていること. + * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 + * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 + * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 + * の無保証規定を掲載すること. + * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 + * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ + * と. + * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 + * 作権表示,この利用条件および下記の無保証規定を掲載すること. + * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに + * 報告すること. + * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 + * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. + * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 + * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを + * 免責すること. + * + * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お + * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 + * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ + * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ + * の責任を負わない. + * + * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ + */ + +/* + * header file for the mros2 application + */ + +#include + +/* + * Priorities for TOPPERS tasks + */ + +#define MAIN_PRIORITY 5 + +#define HIGH_PRIORITY 9 +#define MID_PRIORITY 10 +#define LOW_PRIORITY 11 + +/* + * Constants that may depend on the target + */ + +#ifndef TASK_PORTID +#define TASK_PORTID 1 +#endif /* TASK_PORTID */ + +#ifndef STACK_SIZE +#define STACK_SIZE 4096 +#endif /* STACK_SIZE */ + +/* + * Declaration of prototyle functions + */ +#ifndef TOPPERS_MACRO_ONLY +#ifdef __cplusplus +extern "C" { +#endif +void main_task(void); +extern void led_cyclic_handler(intptr_t exinf); +#ifdef __cplusplus +} +#endif +void Error_Handler(); +#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.c new file mode 100644 index 0000000..41ef1da --- /dev/null +++ b/workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.c @@ -0,0 +1,24 @@ +#include "autosar_os_ext_asp3_user_config.h" + +const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), +}; + +const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) +{ + return autosar_os_ext_flag_user_map; +} + +int cmsis_get_flag_user_num(void) +{ + return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; +} diff --git a/workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.h new file mode 100644 index 0000000..7ad08bf --- /dev/null +++ b/workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.h @@ -0,0 +1,10 @@ +#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ + +#include "cmsis_config_utl.h" + +#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) + +extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; + +#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_joint_state/config/autosar_os_ext_user_config.c b/workspace/echoreply_joint_state/config/autosar_os_ext_user_config.c new file mode 100644 index 0000000..940941b --- /dev/null +++ b/workspace/echoreply_joint_state/config/autosar_os_ext_user_config.c @@ -0,0 +1,75 @@ +#include "cmsis_os.h" +#include "autosar_os_ext_user_config.h" + +extern void tcpip_thread(void *arg); +extern void ethernetif_set_link(void* argument); +extern void ethernetif_input(void* argument); +extern void callHbPubFunc(void *arg); +extern void callHbSubFunc(void *arg); +extern void StartDefaultTask(void * argument); +extern void callWriterThreadFunction(void *arg); +extern void callReaderThreadFunction(void *arg); +extern void callRunBroadcast(void *args); +extern void mros2_init(void *args); + + +UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { + { + .taskID = AutosarOsExtTcpTask, + .func = tcpip_thread, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthIfLinkTask, + .func = ethernetif_set_link, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthInputTask, + .func = ethernetif_input, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBPubTask, + .func = callHbPubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBSubTask, + .func = callHbSubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtSPDPTask, + .func = callRunBroadcast, + .argument = NULL, + }, + { + .taskID = AutosarOsExtWriterTask, + .func = callWriterThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtReaderTask, + .func = callReaderThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtMROS2Task, + .func = mros2_init, + .argument = NULL, + }, +}; + +UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) +{ + return user_thread_autosar_ostask_map; +} +int cmsis_get_app_heap_size(void) +{ + return APP_HEAP_SIZE; +} +int cmsis_get_user_thread_num(void) +{ + return USER_THREAD_NUM; +} diff --git a/workspace/echoreply_joint_state/config/autosar_os_ext_user_config.h b/workspace/echoreply_joint_state/config/autosar_os_ext_user_config.h new file mode 100644 index 0000000..bab78d3 --- /dev/null +++ b/workspace/echoreply_joint_state/config/autosar_os_ext_user_config.h @@ -0,0 +1,22 @@ +#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ + +#include "cmsis_os.h" +#include "cmsis_config_utl.h" + +/*********************************************** + * + * MEMORY + * + ***********************************************/ +#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ + + +/*********************************************** + * + * THREAD + * + ***********************************************/ +#define USER_THREAD_NUM 9U + +#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_joint_state/config/mros2_user_config.c b/workspace/echoreply_joint_state/config/mros2_user_config.c new file mode 100644 index 0000000..7d2c110 --- /dev/null +++ b/workspace/echoreply_joint_state/config/mros2_user_config.c @@ -0,0 +1,10 @@ + + +#define SUB_MSG_COUNT 10 + +int mros2_get_submsg_count(void) +{ + return SUB_MSG_COUNT; +} + + diff --git a/workspace/echoreply_joint_state/config/task.cfg b/workspace/echoreply_joint_state/config/task.cfg new file mode 100644 index 0000000..f577110 --- /dev/null +++ b/workspace/echoreply_joint_state/config/task.cfg @@ -0,0 +1,24 @@ +#include "task_impl.h" + +CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); +CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); +CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); +CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); +CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); +CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); +CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); +CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); +CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); +CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); + +CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_joint_state/task_impl.c b/workspace/echoreply_joint_state/task_impl.c new file mode 100644 index 0000000..afb9fca --- /dev/null +++ b/workspace/echoreply_joint_state/task_impl.c @@ -0,0 +1,126 @@ +#include "cmsis_os.h" +#include "cmsis_config_utl.h" +#include "task_impl.h" + +TASK(AutosarOsExtTcpTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthIfLinkTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthInputTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBPubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBSubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtSPDPTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtWriterTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtReaderTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtUserDefaultTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtMROS2Task) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} diff --git a/workspace/echoreply_joint_state/task_impl.h b/workspace/echoreply_joint_state/task_impl.h new file mode 100644 index 0000000..11e7a81 --- /dev/null +++ b/workspace/echoreply_joint_state/task_impl.h @@ -0,0 +1,54 @@ +#ifndef _AUTOSAR_OS_EXT_TEST_H_ +#define _AUTOSAR_OS_EXT_TEST_H_ + +#include "cmsis_config_utl.h" + +extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); + +/* + * priorities of mROS 2 tasks for RTPS + * + * TODO: We assigned relatevely lower priorities for EthIfLinkTask and + * EthInputTask than the application. Check whether these are appropriate. + */ +#define MROS2_HIGH_PRIORITY MAIN_PRIORITY +#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 + +/* + * experimental: stack size of mROS 2 tasks for RTPS + * Each comment refers the location of original definition + */ +// application/include/lwipopt.h +// #define TCPIP_THREAD_STACKSIZE 1024 +#define MROS2_STACK_SIZE_TcpTask 1024 +// application/src/lwip.c +// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) +#define MROS2_STACK_SIZE_EthIfLinkTask 1024 +// application/src/ethernet.c +// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) +#define MROS2_STACK_SIZE_EthInputTask 350 +// embeddedRTPS/include/config.h +// const int HEARTBEAT_STACKSIZE = 1200; // byte +#define MROS2_STACK_SIZE_HBPubTask 1200 +#define MROS2_STACK_SIZE_HBSubTask 1200 +// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte +#define MROS2_STACK_SIZE_SPDPTask 550 +// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte +#define MROS2_STACK_SIZE_WriterTask 1100 +// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte +#define MROS2_STACK_SIZE_ReaderTask 1600 +// embeddedRTPS-STM32/stm32/Src/main.cpp +// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); +#define MROS2_STACK_SIZE_UserDefaultTask 250 + + +#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ From 25d1eec3ad3b0b8dc5df75fef00b7f789153c6a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Fri, 31 Dec 2021 21:21:46 +0900 Subject: [PATCH 43/80] WIP: string array & bounded array 2021 Final Commit --- workspace/Makefile | 2 +- workspace/echoreply_joint_state/app.cpp | 4 ++-- workspace/echoreply_mix/app.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/workspace/Makefile b/workspace/Makefile index 9d565d1..6e40691 100644 --- a/workspace/Makefile +++ b/workspace/Makefile @@ -4,7 +4,7 @@ APPNAME := ${app} BUILDSPACE := build BOARDNAME := NODE_F767ZI -BOARDPATH := /Volumes/${BOARDNAME} # this path is MacOS's case; not Linux's case +BOARDPATH := /Volumes/${BOARDNAME} MSGDIR := custom_msgs/${msg} MROS2DIR := ../mros2 diff --git a/workspace/echoreply_joint_state/app.cpp b/workspace/echoreply_joint_state/app.cpp index b1af090..c985418 100644 --- a/workspace/echoreply_joint_state/app.cpp +++ b/workspace/echoreply_joint_state/app.cpp @@ -9,8 +9,8 @@ mros2::Publisher pub; void userCallback(sensor_msgs::msg::JointState *msg) { - MROS2_INFO("subscribed msg!"); - MROS2_INFO("publishing msg!"); + MROS2_INFO("subscribed msg!!"); + MROS2_INFO("publishing msg!!"); pub.publish(*msg); } diff --git a/workspace/echoreply_mix/app.cpp b/workspace/echoreply_mix/app.cpp index ac56293..ec9d692 100644 --- a/workspace/echoreply_mix/app.cpp +++ b/workspace/echoreply_mix/app.cpp @@ -9,8 +9,8 @@ mros2::Publisher pub; void userCallback(mix_msgs::msg::Mix *msg) { - MROS2_INFO("subscribed msg!"); - MROS2_INFO("publishing msg!"); + MROS2_INFO("subscribed msg!!"); + MROS2_INFO("publishing msg!!"); pub.publish(*msg); } From c80521b56a37c9f29cb37845cfa255dbf8e7e165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sun, 2 Jan 2022 17:22:00 +0900 Subject: [PATCH 44/80] add comment (about BOARDPATH) to workspace/Makefile --- workspace/.asp 9.bin.icloud | Bin 0 -> 159 bytes workspace/.asp 9.elf.icloud | Bin 0 -> 159 bytes workspace/Makefile | 1 + 3 files changed, 1 insertion(+) create mode 100755 workspace/.asp 9.bin.icloud create mode 100755 workspace/.asp 9.elf.icloud diff --git a/workspace/.asp 9.bin.icloud b/workspace/.asp 9.bin.icloud new file mode 100755 index 0000000000000000000000000000000000000000..a9fcebdcba560da10b7fd6e625f2bdf2d1d3074e GIT binary patch literal 159 zcmYc)$jK}&F)+By$i&RT$`<1n92(@~mzbOComv?$AOPmNW#*&?XI4RkB;Z0psm1xF zMaiill?5QF$i(6T1xvl8%se3m<}!tN0U4|+gHqE=a}tX<_+|9HLLwQ!fRPbGGq6Kx H7*zoPO(-d| literal 0 HcmV?d00001 diff --git a/workspace/.asp 9.elf.icloud b/workspace/.asp 9.elf.icloud new file mode 100755 index 0000000000000000000000000000000000000000..d3cc099a7ab1987b7063d490362c8cee0c6b0dd9 GIT binary patch literal 159 zcmYc)$jK}&F)+By$i&RT$`<1n92(@~mzbOComv?$AOPmNW#*&?XI4RkB;Z0psm1xF zMaiill?5QF$i(6T1xvluoHQW@)yoR;0y0=t2BoH#<|Gzz@XP3Xg+wxd0V5-XW?+ZX HFscFoaC0g! literal 0 HcmV?d00001 diff --git a/workspace/Makefile b/workspace/Makefile index 6e40691..8840d70 100644 --- a/workspace/Makefile +++ b/workspace/Makefile @@ -4,6 +4,7 @@ APPNAME := ${app} BUILDSPACE := build BOARDNAME := NODE_F767ZI +# this BOARDPATH is for MAC OS (not for Linux) BOARDPATH := /Volumes/${BOARDNAME} MSGDIR := custom_msgs/${msg} From bdc67f5ef0e198747fc32ba0d25e0e842009517a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Mon, 3 Jan 2022 02:24:34 +0900 Subject: [PATCH 45/80] echoreply_twist_string app added (WIP) --- workspace/.asp 9.bin.icloud | Bin 159 -> 0 bytes workspace/.asp 9.elf.icloud | Bin 159 -> 0 bytes workspace/echoreply_twist_string/Makefile.inc | 27 ++++ workspace/echoreply_twist_string/README.md | 68 ++++++++++ workspace/echoreply_twist_string/app.cdl | 122 +++++++++++++++++ workspace/echoreply_twist_string/app.cfg | 14 ++ workspace/echoreply_twist_string/app.cpp | 71 ++++++++++ workspace/echoreply_twist_string/app.h | 84 ++++++++++++ .../config/autosar_os_ext_asp3_user_config.c | 24 ++++ .../config/autosar_os_ext_asp3_user_config.h | 10 ++ .../config/autosar_os_ext_user_config.c | 75 +++++++++++ .../config/autosar_os_ext_user_config.h | 22 +++ .../config/mros2_user_config.c | 10 ++ .../echoreply_twist_string/config/task.cfg | 24 ++++ workspace/echoreply_twist_string/task_impl.c | 126 ++++++++++++++++++ workspace/echoreply_twist_string/task_impl.h | 54 ++++++++ 16 files changed, 731 insertions(+) delete mode 100755 workspace/.asp 9.bin.icloud delete mode 100755 workspace/.asp 9.elf.icloud create mode 100644 workspace/echoreply_twist_string/Makefile.inc create mode 100644 workspace/echoreply_twist_string/README.md create mode 100644 workspace/echoreply_twist_string/app.cdl create mode 100644 workspace/echoreply_twist_string/app.cfg create mode 100644 workspace/echoreply_twist_string/app.cpp create mode 100644 workspace/echoreply_twist_string/app.h create mode 100644 workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.c create mode 100644 workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.h create mode 100644 workspace/echoreply_twist_string/config/autosar_os_ext_user_config.c create mode 100644 workspace/echoreply_twist_string/config/autosar_os_ext_user_config.h create mode 100644 workspace/echoreply_twist_string/config/mros2_user_config.c create mode 100644 workspace/echoreply_twist_string/config/task.cfg create mode 100644 workspace/echoreply_twist_string/task_impl.c create mode 100644 workspace/echoreply_twist_string/task_impl.h diff --git a/workspace/.asp 9.bin.icloud b/workspace/.asp 9.bin.icloud deleted file mode 100755 index a9fcebdcba560da10b7fd6e625f2bdf2d1d3074e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 159 zcmYc)$jK}&F)+By$i&RT$`<1n92(@~mzbOComv?$AOPmNW#*&?XI4RkB;Z0psm1xF zMaiill?5QF$i(6T1xvl8%se3m<}!tN0U4|+gHqE=a}tX<_+|9HLLwQ!fRPbGGq6Kx H7*zoPO(-d| diff --git a/workspace/.asp 9.elf.icloud b/workspace/.asp 9.elf.icloud deleted file mode 100755 index d3cc099a7ab1987b7063d490362c8cee0c6b0dd9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 159 zcmYc)$jK}&F)+By$i&RT$`<1n92(@~mzbOComv?$AOPmNW#*&?XI4RkB;Z0psm1xF zMaiill?5QF$i(6T1xvluoHQW@)yoR;0y0=t2BoH#<|Gzz@XP3Xg+wxd0V5-XW?+ZX HFscFoaC0g! diff --git a/workspace/echoreply_twist_string/Makefile.inc b/workspace/echoreply_twist_string/Makefile.inc new file mode 100644 index 0000000..f807ac1 --- /dev/null +++ b/workspace/echoreply_twist_string/Makefile.inc @@ -0,0 +1,27 @@ +# +# Makefile definition for mros2 application +# + +# name of main application +APPLNAME = app + +# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) +# NOTE: also check `initLogMask` in app.cdl for syslog setting +CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 + +# information for directory tree +APPLDIR := $(APPDIR) +APPLDIR += $(APPDIR)/config + +# link option for C++ code +SRCLANG = c++ +APPL_CXXLIBS += -specs=nano.specs + +# compile switch +CDEFS += -DUSE_ASP3_FOR_STM + +# additional files for configuration +APPL_COBJS := task_impl.o +APPL_COBJS += autosar_os_ext_user_config.o +APPL_COBJS += autosar_os_ext_asp3_user_config.o +APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_twist_string/README.md b/workspace/echoreply_twist_string/README.md new file mode 100644 index 0000000..a6ee6cb --- /dev/null +++ b/workspace/echoreply_twist_string/README.md @@ -0,0 +1,68 @@ +### EmbeddedRTPS動作確認用アプリ + +EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 +利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 + +#### LINUX側の準備 +1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします +``` +git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 +``` +2. 通信用アプリをビルドします +``` +cd embeddedRTPS-STM32 +cd linux +mkdir build +cd build +cmake -DTHIRDPARTY=ON .. +make +``` +3. PC上のファイヤウォールの設定を切ります + +#### STM側の設定 +1. IPアドレスを設定します。 +`application/src/lwip.c L69-L80` +``` + IP_ADDRESS[0] = 192; + IP_ADDRESS[1] = 168; + IP_ADDRESS[2] = 11; + IP_ADDRESS[3] = 2; + NETMASK_ADDRESS[0] = 255; + NETMASK_ADDRESS[1] = 255; + NETMASK_ADDRESS[2] = 255; + NETMASK_ADDRESS[3] = 0; + GATEWAY_ADDRESS[0] = 192; + GATEWAY_ADDRESS[1] = 168; + GATEWAY_ADDRESS[2] = 11; + GATEWAY_ADDRESS[3] = 1; + ``` +`embeddedRTPS/include/rtps/config.h L36-L37` +``` +const std::array IP_ADDRESS = { + 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. +``` +2. 本アプリをビルドします + +#### 実行 +1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します +2. ビルドしたlinuxのアプリを実行します +3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です +``` +Conducting new Test... +Send message to the STM32. +Received message from STM32 with len:10 +0 : 10 +1 : 10 +2 : 10 +3 : 10 +4 : 10 +5 : 10 +6 : 10 +7 : 10 +8 : 10 +9 : 10 + +Conducting new Test... +Send message to the STM32. + +``` diff --git a/workspace/echoreply_twist_string/app.cdl b/workspace/echoreply_twist_string/app.cdl new file mode 100644 index 0000000..176c5a6 --- /dev/null +++ b/workspace/echoreply_twist_string/app.cdl @@ -0,0 +1,122 @@ +/* + * サンプルプログラム(1)のコンポーネント記述ファイル + * + * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ + */ +/* + * カーネルオブジェクトの定義 + */ +import(); + +/* + * ターゲット非依存のセルタイプの定義 + */ +import("syssvc/tSerialPort.cdl"); +import("syssvc/tSerialAdapter.cdl"); +import("syssvc/tSysLog.cdl"); +import("syssvc/tSysLogAdapter.cdl"); +import("syssvc/tLogTask.cdl"); +import("syssvc/tBanner.cdl"); + +/* + * ターゲット依存部の取り込み + */ +import("target.cdl"); + +/* + * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" + * の行までのことを言う. + */ + +/* + * システムログ機能のアダプタの組上げ記述 + * + * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー + * スのシステムログ機能を呼び出すためのセルである.システムログ機能の + * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び + * 出さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSysLogAdapter SysLogAdapter { + cSysLog = SysLog.eSysLog; +}; + +/* + * シリアルインタフェースドライバのアダプタの組上げ記述 + * + * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー + * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための + * セルである.シリアルインタフェースドライバのサービスコールを呼び出 + * さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSerialAdapter SerialAdapter { + cSerialPort[0] = SerialPort1.eSerialPort; +}; + +/* + * システムログ機能の組上げ記述 + * + * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ + * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, + * システムログタスクはシステムログ機能を使用するため,それも外すこと + * が必要である.また,システムログ機能のアダプタも外さなければならな + * い.tecsgenが警告メッセージを出すが,無視してよい. + */ +cell tSysLog SysLog { + logBufferSize = 32; /* ログバッファのサイズ */ + initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); + /* ログバッファに記録すべき重要度 */ + initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); + /* 低レベル出力すべき重要度 */ + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * シリアルインタフェースドライバの組上げ記述 + * + * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 + * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー + * スドライバを使用するため,それも外すことが必要である.また,シリア + * ルインタフェースドライバのアダプタも外さなければならない. + */ +cell tSerialPort SerialPort1 { + receiveBufferSize = 256; /* 受信バッファのサイズ */ + sendBufferSize = 256; /* 送信バッファのサイズ */ + + /* ターゲット依存部との結合 */ + cSIOPort = SIOPortTarget1.eSIOPort; + eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ +}; + +/* + * システムログタスクの組上げ記述 + * + * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ + * ばよい. + */ +cell tLogTask LogTask { + priority = 3; /* システムログタスクの優先度 */ + stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ + + /* シリアルインタフェースドライバとの結合 */ + cSerialPort = SerialPort1.eSerialPort; + cnSerialPortManage = SerialPort1.enSerialPortManage; + + /* システムログ機能との結合 */ + cSysLog = SysLog.eSysLog; + + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * カーネル起動メッセージ出力の組上げ記述 + * + * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 + * を削除すればよい. + */ +cell tBanner Banner { + /* 属性の設定 */ + targetName = BannerTargetName; + copyrightNotice = BannerCopyrightNotice; +}; diff --git a/workspace/echoreply_twist_string/app.cfg b/workspace/echoreply_twist_string/app.cfg new file mode 100644 index 0000000..eb0495d --- /dev/null +++ b/workspace/echoreply_twist_string/app.cfg @@ -0,0 +1,14 @@ +/* + * サンプルプログラム(1)のシステムコンフィギュレーションファイル + */ +INCLUDE("tecsgen.cfg"); +INCLUDE("asp3ext.cfg"); +INCLUDE("task.cfg"); + +#include "app.h" +#include "stm32f7xx_it.h" +CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); +CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); +CFG_INT(77, {TA_EDGE, -4}); + +CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_twist_string/app.cpp b/workspace/echoreply_twist_string/app.cpp new file mode 100644 index 0000000..d2f6b4f --- /dev/null +++ b/workspace/echoreply_twist_string/app.cpp @@ -0,0 +1,71 @@ +#include "app.h" +#include "mros2.h" +#include "std_msgs/msg/string.hpp" +#include + +#include "stm32f7xx_nucleo_144.h" + +mros2::Subscriber sub; +mros2::Publisher pub; + +void userCallback(std_msgs::msg::String *msg) +{ + MROS2_INFO("subscribed msg!"); + + std::string sub_str1 = msg->data.substr(0,8); + std::string sub_str2 = msg->data.substr(8,8); + std::string sub_str3 = msg->data.substr(16,8); + std::string sub_str4 = msg->data.substr(24,8); + std::string sub_str5 = msg->data.substr(32,8); + std::string sub_str6 = msg->data.substr(40,8); + + double linear_x = 0.000000; // std::stod(sub_str1); + double linear_y = 0.000002; // std::stod(sub_str2); + double linear_z = 0.000004; // std::stod(sub_str3); + double angluar_x = 0.000006; // std::stod(sub_str4); + double angluar_y = 0.000008; // std::stod(sub_str5); + double angluar_z = 0.000010; // std::stod(sub_str6); + + auto reconverted_message = std_msgs::msg::String(); + + std::string pub_str1 = "0.000000"; // std::to_string(linear_x); + std::string pub_str2 = "0.000002"; // std::to_string(linear_y); + std::string pub_str3 = "0.000004"; // std::to_string(linear_z); + std::string pub_str4 = "0.000006"; // std::to_string(angular_x); + std::string pub_str5 = "0.000008"; // std::to_string(angular_y); + std::string pub_str6 = "0.000010"; // std::to_string(angular_z); + + std::string pub_str = "0.0000000.0000020.0000040.0000060.0000080.000010"; // pub_str1 + pub_str2 + pub_str3 + pub_str4 + pub_str5 + pub_str6; + reconverted_message.data = pub_str; + MROS2_INFO("publishing msg!"); + pub.publish(reconverted_message); +} + +int main(int argc, char * argv[]) +{ + MROS2_INFO("mROS 2 application is started"); + + mros2::init(argc, argv); + MROS2_DEBUG("mROS 2 initialization is completed"); + BSP_LED_Toggle(LED1); + + mros2::Node node = mros2::Node::create_node("mros2_node"); + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + std_msgs::msg::String msg; + + MROS2_INFO("ready to pub/sub message"); + mros2::spin(); + BSP_LED_Toggle(LED3); +} + +void main_task(void) +{ + main(0, NULL); +} + +void +led_cyclic_handler(intptr_t exinf) +{ + BSP_LED_Toggle(LED2); +} \ No newline at end of file diff --git a/workspace/echoreply_twist_string/app.h b/workspace/echoreply_twist_string/app.h new file mode 100644 index 0000000..36eb6cf --- /dev/null +++ b/workspace/echoreply_twist_string/app.h @@ -0,0 +1,84 @@ +/* + * TOPPERS/ASP Kernel + * Toyohashi Open Platform for Embedded Real-Time Systems/ + * Advanced Standard Profile Kernel + * + * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory + * Toyohashi Univ. of Technology, JAPAN + * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory + * Graduate School of Information Science, Nagoya Univ., JAPAN + * + * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ + * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 + * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. + * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 + * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー + * スコード中に含まれていること. + * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 + * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 + * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 + * の無保証規定を掲載すること. + * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 + * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ + * と. + * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 + * 作権表示,この利用条件および下記の無保証規定を掲載すること. + * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに + * 報告すること. + * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 + * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. + * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 + * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを + * 免責すること. + * + * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お + * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 + * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ + * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ + * の責任を負わない. + * + * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ + */ + +/* + * header file for the mros2 application + */ + +#include + +/* + * Priorities for TOPPERS tasks + */ + +#define MAIN_PRIORITY 5 + +#define HIGH_PRIORITY 9 +#define MID_PRIORITY 10 +#define LOW_PRIORITY 11 + +/* + * Constants that may depend on the target + */ + +#ifndef TASK_PORTID +#define TASK_PORTID 1 +#endif /* TASK_PORTID */ + +#ifndef STACK_SIZE +#define STACK_SIZE 4096 +#endif /* STACK_SIZE */ + +/* + * Declaration of prototyle functions + */ +#ifndef TOPPERS_MACRO_ONLY +#ifdef __cplusplus +extern "C" { +#endif +void main_task(void); +extern void led_cyclic_handler(intptr_t exinf); +#ifdef __cplusplus +} +#endif +void Error_Handler(); +#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.c new file mode 100644 index 0000000..41ef1da --- /dev/null +++ b/workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.c @@ -0,0 +1,24 @@ +#include "autosar_os_ext_asp3_user_config.h" + +const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), +}; + +const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) +{ + return autosar_os_ext_flag_user_map; +} + +int cmsis_get_flag_user_num(void) +{ + return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; +} diff --git a/workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.h new file mode 100644 index 0000000..7ad08bf --- /dev/null +++ b/workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.h @@ -0,0 +1,10 @@ +#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ + +#include "cmsis_config_utl.h" + +#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) + +extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; + +#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_twist_string/config/autosar_os_ext_user_config.c b/workspace/echoreply_twist_string/config/autosar_os_ext_user_config.c new file mode 100644 index 0000000..940941b --- /dev/null +++ b/workspace/echoreply_twist_string/config/autosar_os_ext_user_config.c @@ -0,0 +1,75 @@ +#include "cmsis_os.h" +#include "autosar_os_ext_user_config.h" + +extern void tcpip_thread(void *arg); +extern void ethernetif_set_link(void* argument); +extern void ethernetif_input(void* argument); +extern void callHbPubFunc(void *arg); +extern void callHbSubFunc(void *arg); +extern void StartDefaultTask(void * argument); +extern void callWriterThreadFunction(void *arg); +extern void callReaderThreadFunction(void *arg); +extern void callRunBroadcast(void *args); +extern void mros2_init(void *args); + + +UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { + { + .taskID = AutosarOsExtTcpTask, + .func = tcpip_thread, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthIfLinkTask, + .func = ethernetif_set_link, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthInputTask, + .func = ethernetif_input, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBPubTask, + .func = callHbPubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBSubTask, + .func = callHbSubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtSPDPTask, + .func = callRunBroadcast, + .argument = NULL, + }, + { + .taskID = AutosarOsExtWriterTask, + .func = callWriterThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtReaderTask, + .func = callReaderThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtMROS2Task, + .func = mros2_init, + .argument = NULL, + }, +}; + +UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) +{ + return user_thread_autosar_ostask_map; +} +int cmsis_get_app_heap_size(void) +{ + return APP_HEAP_SIZE; +} +int cmsis_get_user_thread_num(void) +{ + return USER_THREAD_NUM; +} diff --git a/workspace/echoreply_twist_string/config/autosar_os_ext_user_config.h b/workspace/echoreply_twist_string/config/autosar_os_ext_user_config.h new file mode 100644 index 0000000..bab78d3 --- /dev/null +++ b/workspace/echoreply_twist_string/config/autosar_os_ext_user_config.h @@ -0,0 +1,22 @@ +#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ + +#include "cmsis_os.h" +#include "cmsis_config_utl.h" + +/*********************************************** + * + * MEMORY + * + ***********************************************/ +#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ + + +/*********************************************** + * + * THREAD + * + ***********************************************/ +#define USER_THREAD_NUM 9U + +#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_twist_string/config/mros2_user_config.c b/workspace/echoreply_twist_string/config/mros2_user_config.c new file mode 100644 index 0000000..7d2c110 --- /dev/null +++ b/workspace/echoreply_twist_string/config/mros2_user_config.c @@ -0,0 +1,10 @@ + + +#define SUB_MSG_COUNT 10 + +int mros2_get_submsg_count(void) +{ + return SUB_MSG_COUNT; +} + + diff --git a/workspace/echoreply_twist_string/config/task.cfg b/workspace/echoreply_twist_string/config/task.cfg new file mode 100644 index 0000000..f577110 --- /dev/null +++ b/workspace/echoreply_twist_string/config/task.cfg @@ -0,0 +1,24 @@ +#include "task_impl.h" + +CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); +CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); +CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); +CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); +CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); +CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); +CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); +CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); +CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); +CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); + +CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_twist_string/task_impl.c b/workspace/echoreply_twist_string/task_impl.c new file mode 100644 index 0000000..afb9fca --- /dev/null +++ b/workspace/echoreply_twist_string/task_impl.c @@ -0,0 +1,126 @@ +#include "cmsis_os.h" +#include "cmsis_config_utl.h" +#include "task_impl.h" + +TASK(AutosarOsExtTcpTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthIfLinkTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthInputTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBPubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBSubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtSPDPTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtWriterTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtReaderTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtUserDefaultTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtMROS2Task) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} diff --git a/workspace/echoreply_twist_string/task_impl.h b/workspace/echoreply_twist_string/task_impl.h new file mode 100644 index 0000000..11e7a81 --- /dev/null +++ b/workspace/echoreply_twist_string/task_impl.h @@ -0,0 +1,54 @@ +#ifndef _AUTOSAR_OS_EXT_TEST_H_ +#define _AUTOSAR_OS_EXT_TEST_H_ + +#include "cmsis_config_utl.h" + +extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); + +/* + * priorities of mROS 2 tasks for RTPS + * + * TODO: We assigned relatevely lower priorities for EthIfLinkTask and + * EthInputTask than the application. Check whether these are appropriate. + */ +#define MROS2_HIGH_PRIORITY MAIN_PRIORITY +#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 + +/* + * experimental: stack size of mROS 2 tasks for RTPS + * Each comment refers the location of original definition + */ +// application/include/lwipopt.h +// #define TCPIP_THREAD_STACKSIZE 1024 +#define MROS2_STACK_SIZE_TcpTask 1024 +// application/src/lwip.c +// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) +#define MROS2_STACK_SIZE_EthIfLinkTask 1024 +// application/src/ethernet.c +// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) +#define MROS2_STACK_SIZE_EthInputTask 350 +// embeddedRTPS/include/config.h +// const int HEARTBEAT_STACKSIZE = 1200; // byte +#define MROS2_STACK_SIZE_HBPubTask 1200 +#define MROS2_STACK_SIZE_HBSubTask 1200 +// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte +#define MROS2_STACK_SIZE_SPDPTask 550 +// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte +#define MROS2_STACK_SIZE_WriterTask 1100 +// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte +#define MROS2_STACK_SIZE_ReaderTask 1600 +// embeddedRTPS-STM32/stm32/Src/main.cpp +// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); +#define MROS2_STACK_SIZE_UserDefaultTask 250 + + +#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ From 20a591e5a7a48b978aa234252d31603e297328e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Mon, 3 Jan 2022 22:59:06 +0900 Subject: [PATCH 46/80] header_includer pushed --- header_includer/header_includer.hpp | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 header_includer/header_includer.hpp diff --git a/header_includer/header_includer.hpp b/header_includer/header_includer.hpp new file mode 100644 index 0000000..7aab79e --- /dev/null +++ b/header_includer/header_includer.hpp @@ -0,0 +1,30 @@ +#include "../../mros2_msgs/nav_msgs/msg/odometry.hpp" +#include "../../mros2_msgs/geometry_msgs/msg/twist.hpp" +#include "../../mros2_msgs/mix_msgs/msg/mix.hpp" +#include "../../mros2_msgs/health_msgs/msg/health.hpp" +#include "../../mros2_msgs/sensor_msgs/msg/joint_state.hpp" + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(nav_msgs::msg::Odometry*)); +template void mros2::Publisher::publish(nav_msgs::msg::Odometry &msg); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(geometry_msgs::msg::Twist*)); +template void mros2::Publisher::publish(geometry_msgs::msg::Twist &msg); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(mix_msgs::msg::Mix*)); +template void mros2::Publisher::publish(mix_msgs::msg::Mix &msg); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(health_msgs::msg::Health*)); +template void mros2::Publisher::publish(health_msgs::msg::Health &msg); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(sensor_msgs::msg::JointState*)); +template void mros2::Publisher::publish(sensor_msgs::msg::JointState &msg); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); \ No newline at end of file From 8423c9ee3261089629b35917d3c634b25e232151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Tue, 4 Jan 2022 14:33:11 +0900 Subject: [PATCH 47/80] README for health_app d added --- .gitignore | 11 ++++ .vscode/settings.json | 46 ++++++++++++++ mros2 | 2 +- workspace/echoreply_health/README.md | 91 ++++++++++------------------ 4 files changed, 89 insertions(+), 61 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 12c9049..07e29ab 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,14 @@ gen/ .project .settings/ *.launch + +mros2/ +asp3-f767zi/ +cmsis-asp3/ +STM32CubeF7/ + +workspace/build/ +workspace/asp* +workspace/Makefile +mros2_msgs/ + diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..87c4e06 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,46 @@ +{ + "files.associations": { + "array": "cpp", + "string_view": "cpp", + "initializer_list": "cpp", + "utility": "cpp", + "atomic": "cpp", + "*.tcc": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "optional": "cpp", + "string": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "fstream": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "new": "cpp", + "ostream": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "cinttypes": "cpp", + "typeinfo": "cpp" + } +} \ No newline at end of file diff --git a/mros2 b/mros2 index 05dea7d..f3e3a60 160000 --- a/mros2 +++ b/mros2 @@ -1 +1 @@ -Subproject commit 05dea7d2969fc16291b651cd36a50d0c5e6b0482 +Subproject commit f3e3a600dee6a8b14c55f2f4517fe82fceb13f5c diff --git a/workspace/echoreply_health/README.md b/workspace/echoreply_health/README.md index a6ee6cb..4431607 100644 --- a/workspace/echoreply_health/README.md +++ b/workspace/echoreply_health/README.md @@ -1,68 +1,39 @@ -### EmbeddedRTPS動作確認用アプリ +### health型通信動作確認用アプリ -EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 -利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 +health型の通信の動作確認をするためのサンプルアプリです。 +health型とは、string, uint16, float32型の組み合わせからなるメッセージ型です。 +以下の手順で確認できます。 -#### LINUX側の準備 -1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします -``` -git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 -``` -2. 通信用アプリをビルドします -``` -cd embeddedRTPS-STM32 -cd linux -mkdir build -cd build -cmake -DTHIRDPARTY=ON .. -make -``` -3. PC上のファイヤウォールの設定を切ります +1.workspace/custom_msgsで、health_msgs/msg/Health.msgを作成し、そこに以下のようにROS2の.msgファイルと同様の形式でhealth型を定義する + ``` + string name + uint16 height + float32 weight + ``` -#### STM側の設定 -1. IPアドレスを設定します。 -`application/src/lwip.c L69-L80` -``` - IP_ADDRESS[0] = 192; - IP_ADDRESS[1] = 168; - IP_ADDRESS[2] = 11; - IP_ADDRESS[3] = 2; - NETMASK_ADDRESS[0] = 255; - NETMASK_ADDRESS[1] = 255; - NETMASK_ADDRESS[2] = 255; - NETMASK_ADDRESS[3] = 0; - GATEWAY_ADDRESS[0] = 192; - GATEWAY_ADDRESS[1] = 168; - GATEWAY_ADDRESS[2] = 11; - GATEWAY_ADDRESS[3] = 1; - ``` -`embeddedRTPS/include/rtps/config.h L36-L37` +2.health_msgs内にmsg_settings.jsonを作成し、以下のように書き込む ``` -const std::array IP_ADDRESS = { - 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. + { + "includingMsgs": [ + [ + "health_msgs/msg/Health.msg" + ] + ] + } ``` -2. 本アプリをビルドします -#### 実行 -1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します -2. ビルドしたlinuxのアプリを実行します -3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です -``` -Conducting new Test... -Send message to the STM32. -Received message from STM32 with len:10 -0 : 10 -1 : 10 -2 : 10 -3 : 10 -4 : 10 -5 : 10 -6 : 10 -7 : 10 -8 : 10 -9 : 10 +3.workspaceディレクトリにて、`make gen-msg msg=health_msgs` によりhealth.hppを生成する -Conducting new Test... -Send message to the STM32. +4.mros2-asp3-f767ziディレクトリにmros2_msgs/health_msgs/msg/health.hppが生成されていることを確認 -``` +5.echoreply_healthアプリ内で、生成したhealth.hppをincludeして使用する。 + +6.workspaceディレクトリにて、`make app=echoreply_health` によりアプリをビルド + +7.Serial Console (picocomなど) を立ち上げて、初期化 + +8.hostのros2アプリからhealth型のmessageを送信 + +9.messageを受信、これを再びhostのros2アプリに向かって送信 + +10.host側で、publishしたメッセージとsubscribeしたメッセージが一致していることを確認 \ No newline at end of file From 5de95591b00082d2efbd81fb1c153202215ac960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 5 Jan 2022 23:13:02 +0900 Subject: [PATCH 48/80] custom_msgs dir recategorized --- .../geometry_msgs/msg/Point.msg | 0 .../geometry_msgs/msg/Pose.msg | 0 .../geometry_msgs/msg/PoseWithCovariance.msg | 0 .../geometry_msgs/msg/Quaternion.msg | 0 .../geometry_msgs/msg/Twist.msg | 0 .../geometry_msgs/msg/TwistWithCovariance.msg | 0 .../geometry_msgs/msg/Vector3.msg | 0 .../{odometry_msgs => geometry_msgs}/msg_settings.json | 5 ----- workspace/custom_msgs/nav_msgs/msg_settings.json | 9 +++++++++ .../nav_msgs/msg/Odometry.msg | 0 10 files changed, 9 insertions(+), 5 deletions(-) rename workspace/custom_msgs/{odometry_msgs => geometry_msgs}/geometry_msgs/msg/Point.msg (100%) rename workspace/custom_msgs/{odometry_msgs => geometry_msgs}/geometry_msgs/msg/Pose.msg (100%) rename workspace/custom_msgs/{odometry_msgs => geometry_msgs}/geometry_msgs/msg/PoseWithCovariance.msg (100%) rename workspace/custom_msgs/{odometry_msgs => geometry_msgs}/geometry_msgs/msg/Quaternion.msg (100%) rename workspace/custom_msgs/{odometry_msgs => geometry_msgs}/geometry_msgs/msg/Twist.msg (100%) rename workspace/custom_msgs/{odometry_msgs => geometry_msgs}/geometry_msgs/msg/TwistWithCovariance.msg (100%) rename workspace/custom_msgs/{odometry_msgs => geometry_msgs}/geometry_msgs/msg/Vector3.msg (100%) rename workspace/custom_msgs/{odometry_msgs => geometry_msgs}/msg_settings.json (79%) create mode 100644 workspace/custom_msgs/nav_msgs/msg_settings.json rename workspace/custom_msgs/{odometry_msgs => nav_msgs}/nav_msgs/msg/Odometry.msg (100%) diff --git a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Point.msg b/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Point.msg similarity index 100% rename from workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Point.msg rename to workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Point.msg diff --git a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Pose.msg b/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Pose.msg similarity index 100% rename from workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Pose.msg rename to workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Pose.msg diff --git a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg b/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg similarity index 100% rename from workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg rename to workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg diff --git a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Quaternion.msg b/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Quaternion.msg similarity index 100% rename from workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Quaternion.msg rename to workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Quaternion.msg diff --git a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Twist.msg b/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Twist.msg similarity index 100% rename from workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Twist.msg rename to workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Twist.msg diff --git a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg b/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg similarity index 100% rename from workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg rename to workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg diff --git a/workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Vector3.msg b/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Vector3.msg similarity index 100% rename from workspace/custom_msgs/odometry_msgs/geometry_msgs/msg/Vector3.msg rename to workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Vector3.msg diff --git a/workspace/custom_msgs/odometry_msgs/msg_settings.json b/workspace/custom_msgs/geometry_msgs/msg_settings.json similarity index 79% rename from workspace/custom_msgs/odometry_msgs/msg_settings.json rename to workspace/custom_msgs/geometry_msgs/msg_settings.json index e5acf33..47f6077 100644 --- a/workspace/custom_msgs/odometry_msgs/msg_settings.json +++ b/workspace/custom_msgs/geometry_msgs/msg_settings.json @@ -25,11 +25,6 @@ [ "geometry_msgs/msg/TwistWithCovariance.msg", "geometry_msgs/msg/twist.hpp" - ], - [ - "nav_msgs/msg/Odometry.msg", - "geometry_msgs/msg/pose_with_covariance.hpp", - "geometry_msgs/msg/twist_with_covariance.hpp" ] ] } \ No newline at end of file diff --git a/workspace/custom_msgs/nav_msgs/msg_settings.json b/workspace/custom_msgs/nav_msgs/msg_settings.json new file mode 100644 index 0000000..51bc9bf --- /dev/null +++ b/workspace/custom_msgs/nav_msgs/msg_settings.json @@ -0,0 +1,9 @@ +{ + "includingMsgs": [ + [ + "nav_msgs/msg/Odometry.msg", + "geometry_msgs/msg/pose_with_covariance.hpp", + "geometry_msgs/msg/twist_with_covariance.hpp" + ] + ] +} \ No newline at end of file diff --git a/workspace/custom_msgs/odometry_msgs/nav_msgs/msg/Odometry.msg b/workspace/custom_msgs/nav_msgs/nav_msgs/msg/Odometry.msg similarity index 100% rename from workspace/custom_msgs/odometry_msgs/nav_msgs/msg/Odometry.msg rename to workspace/custom_msgs/nav_msgs/nav_msgs/msg/Odometry.msg From 8297558190872de4c64718994b6f5cdc76715479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 6 Jan 2022 14:54:22 +0900 Subject: [PATCH 49/80] mix_msgs modified --- workspace/.asp 9.elf.icloud | Bin 0 -> 159 bytes workspace/README.md | 11 +++++++++++ .../custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg | 2 +- workspace/custom_msgs/nav_msgs/msg_settings.json | 9 --------- 4 files changed, 12 insertions(+), 10 deletions(-) create mode 100755 workspace/.asp 9.elf.icloud delete mode 100644 workspace/custom_msgs/nav_msgs/msg_settings.json diff --git a/workspace/.asp 9.elf.icloud b/workspace/.asp 9.elf.icloud new file mode 100755 index 0000000000000000000000000000000000000000..d3cc099a7ab1987b7063d490362c8cee0c6b0dd9 GIT binary patch literal 159 zcmYc)$jK}&F)+By$i&RT$`<1n92(@~mzbOComv?$AOPmNW#*&?XI4RkB;Z0psm1xF zMaiill?5QF$i(6T1xvluoHQW@)yoR;0y0=t2BoH#<|Gzz@XP3Xg+wxd0V5-XW?+ZX HFscFoaC0g! literal 0 HcmV?d00001 diff --git a/workspace/README.md b/workspace/README.md index 31d7ceb..df8a5cc 100644 --- a/workspace/README.md +++ b/workspace/README.md @@ -39,6 +39,17 @@ Please also check [mROS-base/mros2-host-examples](https://github.com/mROS-base/m - `$ ros2 run mros2_echoback_float32 pub_node` - `$ ros2 run mros2_echoback_float32 sub_node` +## echoreply_header + +- Description: + - The mROS 2 node on the embedded board subscribes `header` (`std_msgs::msg::Header`) message from `/to_stm` topic. + - And then publishes this `header` message as it is to `/to_linux` as the reply. +- Host operation: + - `$ ros2 launch mros2_echoback_header launch.py` + - or, at two terminals: + - `$ ros2 run mros2_echoback_header pub_node` + - `$ ros2 run mros2_echoback_header sub_node` + ## pub_string - Description: diff --git a/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg b/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg index b5bc382..da24ec0 100644 --- a/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg +++ b/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg @@ -2,4 +2,4 @@ string name IntVector3 vec3 uint16 height float32 weight -float64[] array \ No newline at end of file +float64[8] array \ No newline at end of file diff --git a/workspace/custom_msgs/nav_msgs/msg_settings.json b/workspace/custom_msgs/nav_msgs/msg_settings.json deleted file mode 100644 index 51bc9bf..0000000 --- a/workspace/custom_msgs/nav_msgs/msg_settings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "includingMsgs": [ - [ - "nav_msgs/msg/Odometry.msg", - "geometry_msgs/msg/pose_with_covariance.hpp", - "geometry_msgs/msg/twist_with_covariance.hpp" - ] - ] -} \ No newline at end of file From b3ab405ccfd8527823c1611478dd1261e536c144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 6 Jan 2022 15:00:00 +0900 Subject: [PATCH 50/80] msg_settings.json added to nav_msgs --- workspace/custom_msgs/nav_msgs/msg_settings.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 workspace/custom_msgs/nav_msgs/msg_settings.json diff --git a/workspace/custom_msgs/nav_msgs/msg_settings.json b/workspace/custom_msgs/nav_msgs/msg_settings.json new file mode 100644 index 0000000..3e36606 --- /dev/null +++ b/workspace/custom_msgs/nav_msgs/msg_settings.json @@ -0,0 +1,9 @@ +{ + "includingMsgs": [ + [ + "nav_msgs/msg/Odometry.msg", + "geometry_msgs/msg/pose_with_covariance.hpp", + "geometry_msgs/msg/twist_with_covariance.hpp" + ] + ] +} \ No newline at end of file From a89a62ea069be6d2ecdbbbc5e08a0a506eded308 Mon Sep 17 00:00:00 2001 From: Yoichiro Hibara <51713871+Hibagon1go@users.noreply.github.com> Date: Thu, 6 Jan 2022 15:00:45 +0900 Subject: [PATCH 51/80] Delete .asp 9.elf.icloud --- workspace/.asp 9.elf.icloud | Bin 159 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 workspace/.asp 9.elf.icloud diff --git a/workspace/.asp 9.elf.icloud b/workspace/.asp 9.elf.icloud deleted file mode 100755 index d3cc099a7ab1987b7063d490362c8cee0c6b0dd9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 159 zcmYc)$jK}&F)+By$i&RT$`<1n92(@~mzbOComv?$AOPmNW#*&?XI4RkB;Z0psm1xF zMaiill?5QF$i(6T1xvluoHQW@)yoR;0y0=t2BoH#<|Gzz@XP3Xg+wxd0V5-XW?+ZX HFscFoaC0g! From bf9aa43c11d0713acf2ec430d09a35e14045d7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Fri, 7 Jan 2022 20:40:01 +0900 Subject: [PATCH 52/80] clean msg header include path etc. --- workspace/build/Makefile.common | 4 +- .../geometry_msgs/geometry_msgs/msg/Pose.msg | 2 - .../geometry_msgs/msg/PoseWithCovariance.msg | 2 - .../geometry_msgs/geometry_msgs/msg/Twist.msg | 2 - .../geometry_msgs/msg/TwistWithCovariance.msg | 2 - .../{geometry_msgs => }/msg/Point.msg | 0 .../custom_msgs/geometry_msgs/msg/Pose.msg | 2 + .../geometry_msgs/msg/PoseWithCovariance.msg | 2 + .../{geometry_msgs => }/msg/Quaternion.msg | 0 .../custom_msgs/geometry_msgs/msg/Twist.msg | 2 + .../geometry_msgs/msg/TwistWithCovariance.msg | 2 + .../{geometry_msgs => }/msg/Vector3.msg | 0 .../geometry_msgs/msg_settings.json | 27 +--- .../{health_msgs => }/msg/Health.msg | 0 .../custom_msgs/health_msgs/msg_settings.json | 2 - .../{mix_msgs => }/msg/IntVector3.msg | 0 .../mix_msgs/{mix_msgs => }/msg/Mix.msg | 2 +- .../custom_msgs/mix_msgs/msg_settings.json | 8 +- .../custom_msgs/nav_msgs/msg/Odometry.msg | 4 + .../custom_msgs/nav_msgs/msg_settings.json | 6 +- .../nav_msgs/nav_msgs/msg/Odometry.msg | 4 - .../{sensor_msgs => }/msg/JointState.msg | 0 .../custom_msgs/sensor_msgs/msg_settings.json | 4 +- workspace/custom_msgs/shape_msgs/msg/Mesh.msg | 2 + .../shape_msgs/msg/MeshTriangle.msg | 1 + .../custom_msgs/shape_msgs/msg_settings.json | 5 + workspace/echoreply_health/app.cpp | 2 +- workspace/echoreply_joint_state/app.cpp | 2 +- workspace/echoreply_mesh/Makefile.inc | 27 ++++ workspace/echoreply_mesh/README.md | 68 ++++++++++ workspace/echoreply_mesh/app.cdl | 122 +++++++++++++++++ workspace/echoreply_mesh/app.cfg | 14 ++ workspace/echoreply_mesh/app.cpp | 44 ++++++ workspace/echoreply_mesh/app.h | 84 ++++++++++++ .../config/autosar_os_ext_asp3_user_config.c | 24 ++++ .../config/autosar_os_ext_asp3_user_config.h | 10 ++ .../config/autosar_os_ext_user_config.c | 75 +++++++++++ .../config/autosar_os_ext_user_config.h | 22 +++ .../echoreply_mesh/config/mros2_user_config.c | 10 ++ workspace/echoreply_mesh/config/task.cfg | 24 ++++ workspace/echoreply_mesh/task_impl.c | 126 ++++++++++++++++++ workspace/echoreply_mesh/task_impl.h | 54 ++++++++ workspace/echoreply_mix/app.cpp | 2 +- workspace/echoreply_odometry/app.cpp | 2 +- workspace/echoreply_twist/app.cpp | 2 +- 45 files changed, 736 insertions(+), 63 deletions(-) delete mode 100644 workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Pose.msg delete mode 100644 workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg delete mode 100644 workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Twist.msg delete mode 100644 workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg rename workspace/custom_msgs/geometry_msgs/{geometry_msgs => }/msg/Point.msg (100%) create mode 100644 workspace/custom_msgs/geometry_msgs/msg/Pose.msg create mode 100644 workspace/custom_msgs/geometry_msgs/msg/PoseWithCovariance.msg rename workspace/custom_msgs/geometry_msgs/{geometry_msgs => }/msg/Quaternion.msg (100%) create mode 100644 workspace/custom_msgs/geometry_msgs/msg/Twist.msg create mode 100644 workspace/custom_msgs/geometry_msgs/msg/TwistWithCovariance.msg rename workspace/custom_msgs/geometry_msgs/{geometry_msgs => }/msg/Vector3.msg (100%) rename workspace/custom_msgs/health_msgs/{health_msgs => }/msg/Health.msg (100%) rename workspace/custom_msgs/mix_msgs/{mix_msgs => }/msg/IntVector3.msg (100%) rename workspace/custom_msgs/mix_msgs/{mix_msgs => }/msg/Mix.msg (66%) create mode 100644 workspace/custom_msgs/nav_msgs/msg/Odometry.msg delete mode 100644 workspace/custom_msgs/nav_msgs/nav_msgs/msg/Odometry.msg rename workspace/custom_msgs/sensor_msgs/{sensor_msgs => }/msg/JointState.msg (100%) create mode 100644 workspace/custom_msgs/shape_msgs/msg/Mesh.msg create mode 100644 workspace/custom_msgs/shape_msgs/msg/MeshTriangle.msg create mode 100644 workspace/custom_msgs/shape_msgs/msg_settings.json create mode 100644 workspace/echoreply_mesh/Makefile.inc create mode 100644 workspace/echoreply_mesh/README.md create mode 100644 workspace/echoreply_mesh/app.cdl create mode 100644 workspace/echoreply_mesh/app.cfg create mode 100644 workspace/echoreply_mesh/app.cpp create mode 100644 workspace/echoreply_mesh/app.h create mode 100644 workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.c create mode 100644 workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.h create mode 100644 workspace/echoreply_mesh/config/autosar_os_ext_user_config.c create mode 100644 workspace/echoreply_mesh/config/autosar_os_ext_user_config.h create mode 100644 workspace/echoreply_mesh/config/mros2_user_config.c create mode 100644 workspace/echoreply_mesh/config/task.cfg create mode 100644 workspace/echoreply_mesh/task_impl.c create mode 100644 workspace/echoreply_mesh/task_impl.h diff --git a/workspace/build/Makefile.common b/workspace/build/Makefile.common index 407e67a..d01416c 100644 --- a/workspace/build/Makefile.common +++ b/workspace/build/Makefile.common @@ -15,7 +15,7 @@ APPDIR := ${ROOTDIR}/workspace/${APPNAME} DRIVERSDIR := $(ROOTDIR)/STM32CubeF7/Drivers MIDDLESDIR := $(ROOTDIR)/STM32CubeF7/Middlewares CMSIS_MAKEFILEDIR := ${ROOTDIR}/cmsis-asp3 -MROS2_MAKEFILEDIR := ${ROOTDIR}/mros2/makefiles +MROS2_MAKEFILEDIR := ${ROOTDIR}/makefiles ASP3_MAKEFILEDIR := ${ROOTDIR}/asp3-f767zi # workspace app makefile include @@ -32,4 +32,4 @@ include ${MROS2_MAKEFILEDIR}/Makefile.rtps include ${MROS2_MAKEFILEDIR}/Makefile.mros2 # asp3-f767zi makefiles include -include ${ASP3_MAKEFILEDIR}/Makefile.mros2 +include ${ASP3_MAKEFILEDIR}/Makefile.mros2 \ No newline at end of file diff --git a/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Pose.msg b/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Pose.msg deleted file mode 100644 index 1e1ff4b..0000000 --- a/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Pose.msg +++ /dev/null @@ -1,2 +0,0 @@ -Point position -Quaternion orientation \ No newline at end of file diff --git a/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg b/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg deleted file mode 100644 index b253beb..0000000 --- a/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/PoseWithCovariance.msg +++ /dev/null @@ -1,2 +0,0 @@ -Pose pose -float64[36] covariance \ No newline at end of file diff --git a/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Twist.msg b/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Twist.msg deleted file mode 100644 index 4cdb251..0000000 --- a/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Twist.msg +++ /dev/null @@ -1,2 +0,0 @@ -Vector3 linear -Vector3 angular \ No newline at end of file diff --git a/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg b/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg deleted file mode 100644 index 06a7469..0000000 --- a/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/TwistWithCovariance.msg +++ /dev/null @@ -1,2 +0,0 @@ -Twist twist -float64[36] covariance \ No newline at end of file diff --git a/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Point.msg b/workspace/custom_msgs/geometry_msgs/msg/Point.msg similarity index 100% rename from workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Point.msg rename to workspace/custom_msgs/geometry_msgs/msg/Point.msg diff --git a/workspace/custom_msgs/geometry_msgs/msg/Pose.msg b/workspace/custom_msgs/geometry_msgs/msg/Pose.msg new file mode 100644 index 0000000..21eed4b --- /dev/null +++ b/workspace/custom_msgs/geometry_msgs/msg/Pose.msg @@ -0,0 +1,2 @@ +geometry_msgs/msg/Point position +geometry_msgs/msg/Quaternion orientation \ No newline at end of file diff --git a/workspace/custom_msgs/geometry_msgs/msg/PoseWithCovariance.msg b/workspace/custom_msgs/geometry_msgs/msg/PoseWithCovariance.msg new file mode 100644 index 0000000..bfef6c5 --- /dev/null +++ b/workspace/custom_msgs/geometry_msgs/msg/PoseWithCovariance.msg @@ -0,0 +1,2 @@ +geometry_msgs/msg/Pose pose +float64[36] covariance \ No newline at end of file diff --git a/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Quaternion.msg b/workspace/custom_msgs/geometry_msgs/msg/Quaternion.msg similarity index 100% rename from workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Quaternion.msg rename to workspace/custom_msgs/geometry_msgs/msg/Quaternion.msg diff --git a/workspace/custom_msgs/geometry_msgs/msg/Twist.msg b/workspace/custom_msgs/geometry_msgs/msg/Twist.msg new file mode 100644 index 0000000..a888447 --- /dev/null +++ b/workspace/custom_msgs/geometry_msgs/msg/Twist.msg @@ -0,0 +1,2 @@ +geometry_msgs/msg/Vector3 linear +geometry_msgs/msg/Vector3 angular \ No newline at end of file diff --git a/workspace/custom_msgs/geometry_msgs/msg/TwistWithCovariance.msg b/workspace/custom_msgs/geometry_msgs/msg/TwistWithCovariance.msg new file mode 100644 index 0000000..82b175c --- /dev/null +++ b/workspace/custom_msgs/geometry_msgs/msg/TwistWithCovariance.msg @@ -0,0 +1,2 @@ +geometry_msgs/msg/Twist twist +float64[36] covariance \ No newline at end of file diff --git a/workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Vector3.msg b/workspace/custom_msgs/geometry_msgs/msg/Vector3.msg similarity index 100% rename from workspace/custom_msgs/geometry_msgs/geometry_msgs/msg/Vector3.msg rename to workspace/custom_msgs/geometry_msgs/msg/Vector3.msg diff --git a/workspace/custom_msgs/geometry_msgs/msg_settings.json b/workspace/custom_msgs/geometry_msgs/msg_settings.json index 47f6077..c1c9767 100644 --- a/workspace/custom_msgs/geometry_msgs/msg_settings.json +++ b/workspace/custom_msgs/geometry_msgs/msg_settings.json @@ -1,30 +1,5 @@ { "includingMsgs": [ - [ - "geometry_msgs/msg/Point.msg" - ], - [ - "geometry_msgs/msg/Quaternion.msg" - ], - [ - "geometry_msgs/msg/Pose.msg", - "geometry_msgs/msg/point.hpp", - "geometry_msgs/msg/quaternion.hpp" - ], - [ - "geometry_msgs/msg/Vector3.msg" - ], - [ - "geometry_msgs/msg/Twist.msg", - "geometry_msgs/msg/vector3.hpp" - ], - [ - "geometry_msgs/msg/PoseWithCovariance.msg", - "geometry_msgs/msg/pose.hpp" - ], - [ - "geometry_msgs/msg/TwistWithCovariance.msg", - "geometry_msgs/msg/twist.hpp" - ] + "geometry_msgs/msg/Twist.msg" ] } \ No newline at end of file diff --git a/workspace/custom_msgs/health_msgs/health_msgs/msg/Health.msg b/workspace/custom_msgs/health_msgs/msg/Health.msg similarity index 100% rename from workspace/custom_msgs/health_msgs/health_msgs/msg/Health.msg rename to workspace/custom_msgs/health_msgs/msg/Health.msg diff --git a/workspace/custom_msgs/health_msgs/msg_settings.json b/workspace/custom_msgs/health_msgs/msg_settings.json index b3636f9..a90982f 100644 --- a/workspace/custom_msgs/health_msgs/msg_settings.json +++ b/workspace/custom_msgs/health_msgs/msg_settings.json @@ -1,7 +1,5 @@ { "includingMsgs": [ - [ "health_msgs/msg/Health.msg" - ] ] } \ No newline at end of file diff --git a/workspace/custom_msgs/mix_msgs/mix_msgs/msg/IntVector3.msg b/workspace/custom_msgs/mix_msgs/msg/IntVector3.msg similarity index 100% rename from workspace/custom_msgs/mix_msgs/mix_msgs/msg/IntVector3.msg rename to workspace/custom_msgs/mix_msgs/msg/IntVector3.msg diff --git a/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg b/workspace/custom_msgs/mix_msgs/msg/Mix.msg similarity index 66% rename from workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg rename to workspace/custom_msgs/mix_msgs/msg/Mix.msg index da24ec0..fc1507e 100644 --- a/workspace/custom_msgs/mix_msgs/mix_msgs/msg/Mix.msg +++ b/workspace/custom_msgs/mix_msgs/msg/Mix.msg @@ -1,5 +1,5 @@ string name -IntVector3 vec3 +mix_msgs/msg/IntVector3 vec3 uint16 height float32 weight float64[8] array \ No newline at end of file diff --git a/workspace/custom_msgs/mix_msgs/msg_settings.json b/workspace/custom_msgs/mix_msgs/msg_settings.json index 33112ac..c0d3a58 100644 --- a/workspace/custom_msgs/mix_msgs/msg_settings.json +++ b/workspace/custom_msgs/mix_msgs/msg_settings.json @@ -1,11 +1,5 @@ { "includingMsgs": [ - [ - "mix_msgs/msg/IntVector3.msg" - ], - [ - "mix_msgs/msg/Mix.msg", - "mix_msgs/msg/int_vector3.hpp" - ] + "mix_msgs/msg/IntVector3.msg" ] } \ No newline at end of file diff --git a/workspace/custom_msgs/nav_msgs/msg/Odometry.msg b/workspace/custom_msgs/nav_msgs/msg/Odometry.msg new file mode 100644 index 0000000..7c775a9 --- /dev/null +++ b/workspace/custom_msgs/nav_msgs/msg/Odometry.msg @@ -0,0 +1,4 @@ +header header +string child_frame_id +geometry_msgs/msg/PoseWithCovariance pose +geometry_msgs/msg/TwistWithCovariance twist diff --git a/workspace/custom_msgs/nav_msgs/msg_settings.json b/workspace/custom_msgs/nav_msgs/msg_settings.json index 3e36606..dff18d6 100644 --- a/workspace/custom_msgs/nav_msgs/msg_settings.json +++ b/workspace/custom_msgs/nav_msgs/msg_settings.json @@ -1,9 +1,5 @@ { "includingMsgs": [ - [ - "nav_msgs/msg/Odometry.msg", - "geometry_msgs/msg/pose_with_covariance.hpp", - "geometry_msgs/msg/twist_with_covariance.hpp" - ] + "nav_msgs/msg/Odometry.msg" ] } \ No newline at end of file diff --git a/workspace/custom_msgs/nav_msgs/nav_msgs/msg/Odometry.msg b/workspace/custom_msgs/nav_msgs/nav_msgs/msg/Odometry.msg deleted file mode 100644 index 317b27f..0000000 --- a/workspace/custom_msgs/nav_msgs/nav_msgs/msg/Odometry.msg +++ /dev/null @@ -1,4 +0,0 @@ -header header -string child_frame_id -PoseWithCovariance pose -TwistWithCovariance twist diff --git a/workspace/custom_msgs/sensor_msgs/sensor_msgs/msg/JointState.msg b/workspace/custom_msgs/sensor_msgs/msg/JointState.msg similarity index 100% rename from workspace/custom_msgs/sensor_msgs/sensor_msgs/msg/JointState.msg rename to workspace/custom_msgs/sensor_msgs/msg/JointState.msg diff --git a/workspace/custom_msgs/sensor_msgs/msg_settings.json b/workspace/custom_msgs/sensor_msgs/msg_settings.json index a82ff9c..b13ce1a 100644 --- a/workspace/custom_msgs/sensor_msgs/msg_settings.json +++ b/workspace/custom_msgs/sensor_msgs/msg_settings.json @@ -1,7 +1,5 @@ { "includingMsgs": [ - [ - "sensor_msgs/msg/JointState.msg" - ] + "sensor_msgs/msg/JointState.msg" ] } \ No newline at end of file diff --git a/workspace/custom_msgs/shape_msgs/msg/Mesh.msg b/workspace/custom_msgs/shape_msgs/msg/Mesh.msg new file mode 100644 index 0000000..1f36e2f --- /dev/null +++ b/workspace/custom_msgs/shape_msgs/msg/Mesh.msg @@ -0,0 +1,2 @@ +shape_msgs/msg/MeshTriangle[] triangles +geometry_msgs/msg/Point[] vertices \ No newline at end of file diff --git a/workspace/custom_msgs/shape_msgs/msg/MeshTriangle.msg b/workspace/custom_msgs/shape_msgs/msg/MeshTriangle.msg new file mode 100644 index 0000000..35b1b4d --- /dev/null +++ b/workspace/custom_msgs/shape_msgs/msg/MeshTriangle.msg @@ -0,0 +1 @@ +uint32[3] vertex_indices \ No newline at end of file diff --git a/workspace/custom_msgs/shape_msgs/msg_settings.json b/workspace/custom_msgs/shape_msgs/msg_settings.json new file mode 100644 index 0000000..d82adce --- /dev/null +++ b/workspace/custom_msgs/shape_msgs/msg_settings.json @@ -0,0 +1,5 @@ +{ + "includingMsgs": [ + "shape_msgs/msg/MeshTriangle.msg" + ] +} \ No newline at end of file diff --git a/workspace/echoreply_health/app.cpp b/workspace/echoreply_health/app.cpp index 7d0ba6a..18d2e5b 100644 --- a/workspace/echoreply_health/app.cpp +++ b/workspace/echoreply_health/app.cpp @@ -1,6 +1,6 @@ #include "app.h" #include "mros2.h" -#include "../mros2_msgs/health_msgs/msg/health.hpp" +#include "health_msgs/msg/health.hpp" #include "stm32f7xx_nucleo_144.h" diff --git a/workspace/echoreply_joint_state/app.cpp b/workspace/echoreply_joint_state/app.cpp index c985418..1885dac 100644 --- a/workspace/echoreply_joint_state/app.cpp +++ b/workspace/echoreply_joint_state/app.cpp @@ -1,6 +1,6 @@ #include "app.h" #include "mros2.h" -#include "../mros2_msgs/sensor_msgs/msg/joint_state.hpp" +#include "sensor_msgs/msg/joint_state.hpp" #include "stm32f7xx_nucleo_144.h" diff --git a/workspace/echoreply_mesh/Makefile.inc b/workspace/echoreply_mesh/Makefile.inc new file mode 100644 index 0000000..f807ac1 --- /dev/null +++ b/workspace/echoreply_mesh/Makefile.inc @@ -0,0 +1,27 @@ +# +# Makefile definition for mros2 application +# + +# name of main application +APPLNAME = app + +# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) +# NOTE: also check `initLogMask` in app.cdl for syslog setting +CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 + +# information for directory tree +APPLDIR := $(APPDIR) +APPLDIR += $(APPDIR)/config + +# link option for C++ code +SRCLANG = c++ +APPL_CXXLIBS += -specs=nano.specs + +# compile switch +CDEFS += -DUSE_ASP3_FOR_STM + +# additional files for configuration +APPL_COBJS := task_impl.o +APPL_COBJS += autosar_os_ext_user_config.o +APPL_COBJS += autosar_os_ext_asp3_user_config.o +APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_mesh/README.md b/workspace/echoreply_mesh/README.md new file mode 100644 index 0000000..a6ee6cb --- /dev/null +++ b/workspace/echoreply_mesh/README.md @@ -0,0 +1,68 @@ +### EmbeddedRTPS動作確認用アプリ + +EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 +利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 + +#### LINUX側の準備 +1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします +``` +git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 +``` +2. 通信用アプリをビルドします +``` +cd embeddedRTPS-STM32 +cd linux +mkdir build +cd build +cmake -DTHIRDPARTY=ON .. +make +``` +3. PC上のファイヤウォールの設定を切ります + +#### STM側の設定 +1. IPアドレスを設定します。 +`application/src/lwip.c L69-L80` +``` + IP_ADDRESS[0] = 192; + IP_ADDRESS[1] = 168; + IP_ADDRESS[2] = 11; + IP_ADDRESS[3] = 2; + NETMASK_ADDRESS[0] = 255; + NETMASK_ADDRESS[1] = 255; + NETMASK_ADDRESS[2] = 255; + NETMASK_ADDRESS[3] = 0; + GATEWAY_ADDRESS[0] = 192; + GATEWAY_ADDRESS[1] = 168; + GATEWAY_ADDRESS[2] = 11; + GATEWAY_ADDRESS[3] = 1; + ``` +`embeddedRTPS/include/rtps/config.h L36-L37` +``` +const std::array IP_ADDRESS = { + 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. +``` +2. 本アプリをビルドします + +#### 実行 +1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します +2. ビルドしたlinuxのアプリを実行します +3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です +``` +Conducting new Test... +Send message to the STM32. +Received message from STM32 with len:10 +0 : 10 +1 : 10 +2 : 10 +3 : 10 +4 : 10 +5 : 10 +6 : 10 +7 : 10 +8 : 10 +9 : 10 + +Conducting new Test... +Send message to the STM32. + +``` diff --git a/workspace/echoreply_mesh/app.cdl b/workspace/echoreply_mesh/app.cdl new file mode 100644 index 0000000..176c5a6 --- /dev/null +++ b/workspace/echoreply_mesh/app.cdl @@ -0,0 +1,122 @@ +/* + * サンプルプログラム(1)のコンポーネント記述ファイル + * + * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ + */ +/* + * カーネルオブジェクトの定義 + */ +import(); + +/* + * ターゲット非依存のセルタイプの定義 + */ +import("syssvc/tSerialPort.cdl"); +import("syssvc/tSerialAdapter.cdl"); +import("syssvc/tSysLog.cdl"); +import("syssvc/tSysLogAdapter.cdl"); +import("syssvc/tLogTask.cdl"); +import("syssvc/tBanner.cdl"); + +/* + * ターゲット依存部の取り込み + */ +import("target.cdl"); + +/* + * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" + * の行までのことを言う. + */ + +/* + * システムログ機能のアダプタの組上げ記述 + * + * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー + * スのシステムログ機能を呼び出すためのセルである.システムログ機能の + * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び + * 出さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSysLogAdapter SysLogAdapter { + cSysLog = SysLog.eSysLog; +}; + +/* + * シリアルインタフェースドライバのアダプタの組上げ記述 + * + * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー + * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための + * セルである.シリアルインタフェースドライバのサービスコールを呼び出 + * さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSerialAdapter SerialAdapter { + cSerialPort[0] = SerialPort1.eSerialPort; +}; + +/* + * システムログ機能の組上げ記述 + * + * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ + * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, + * システムログタスクはシステムログ機能を使用するため,それも外すこと + * が必要である.また,システムログ機能のアダプタも外さなければならな + * い.tecsgenが警告メッセージを出すが,無視してよい. + */ +cell tSysLog SysLog { + logBufferSize = 32; /* ログバッファのサイズ */ + initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); + /* ログバッファに記録すべき重要度 */ + initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); + /* 低レベル出力すべき重要度 */ + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * シリアルインタフェースドライバの組上げ記述 + * + * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 + * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー + * スドライバを使用するため,それも外すことが必要である.また,シリア + * ルインタフェースドライバのアダプタも外さなければならない. + */ +cell tSerialPort SerialPort1 { + receiveBufferSize = 256; /* 受信バッファのサイズ */ + sendBufferSize = 256; /* 送信バッファのサイズ */ + + /* ターゲット依存部との結合 */ + cSIOPort = SIOPortTarget1.eSIOPort; + eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ +}; + +/* + * システムログタスクの組上げ記述 + * + * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ + * ばよい. + */ +cell tLogTask LogTask { + priority = 3; /* システムログタスクの優先度 */ + stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ + + /* シリアルインタフェースドライバとの結合 */ + cSerialPort = SerialPort1.eSerialPort; + cnSerialPortManage = SerialPort1.enSerialPortManage; + + /* システムログ機能との結合 */ + cSysLog = SysLog.eSysLog; + + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * カーネル起動メッセージ出力の組上げ記述 + * + * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 + * を削除すればよい. + */ +cell tBanner Banner { + /* 属性の設定 */ + targetName = BannerTargetName; + copyrightNotice = BannerCopyrightNotice; +}; diff --git a/workspace/echoreply_mesh/app.cfg b/workspace/echoreply_mesh/app.cfg new file mode 100644 index 0000000..eb0495d --- /dev/null +++ b/workspace/echoreply_mesh/app.cfg @@ -0,0 +1,14 @@ +/* + * サンプルプログラム(1)のシステムコンフィギュレーションファイル + */ +INCLUDE("tecsgen.cfg"); +INCLUDE("asp3ext.cfg"); +INCLUDE("task.cfg"); + +#include "app.h" +#include "stm32f7xx_it.h" +CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); +CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); +CFG_INT(77, {TA_EDGE, -4}); + +CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_mesh/app.cpp b/workspace/echoreply_mesh/app.cpp new file mode 100644 index 0000000..91ee598 --- /dev/null +++ b/workspace/echoreply_mesh/app.cpp @@ -0,0 +1,44 @@ +#include "app.h" +#include "mros2.h" +#include "shape_msgs/msg/mesh.hpp" + +#include "stm32f7xx_nucleo_144.h" + +mros2::Subscriber sub; +mros2::Publisher pub; + +void userCallback(shape_msgs::msg::Mesh *msg) +{ + MROS2_INFO("subscribed!"); + MROS2_INFO("publishing!"); + pub.publish(*msg); +} + +int main(int argc, char * argv[]) +{ + MROS2_INFO("mROS 2 application is started"); + + mros2::init(argc, argv); + MROS2_DEBUG("mROS 2 initialization is completed"); + BSP_LED_Toggle(LED1); + + mros2::Node node = mros2::Node::create_node("mros2_node"); + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + shape_msgs::msg::Mesh msg; + + MROS2_INFO("ready to pub/sub message"); + mros2::spin(); + BSP_LED_Toggle(LED3); +} + +void main_task(void) +{ + main(0, NULL); +} + +void +led_cyclic_handler(intptr_t exinf) +{ + BSP_LED_Toggle(LED2); +} \ No newline at end of file diff --git a/workspace/echoreply_mesh/app.h b/workspace/echoreply_mesh/app.h new file mode 100644 index 0000000..36eb6cf --- /dev/null +++ b/workspace/echoreply_mesh/app.h @@ -0,0 +1,84 @@ +/* + * TOPPERS/ASP Kernel + * Toyohashi Open Platform for Embedded Real-Time Systems/ + * Advanced Standard Profile Kernel + * + * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory + * Toyohashi Univ. of Technology, JAPAN + * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory + * Graduate School of Information Science, Nagoya Univ., JAPAN + * + * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ + * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 + * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. + * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 + * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー + * スコード中に含まれていること. + * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 + * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 + * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 + * の無保証規定を掲載すること. + * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 + * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ + * と. + * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 + * 作権表示,この利用条件および下記の無保証規定を掲載すること. + * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに + * 報告すること. + * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 + * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. + * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 + * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを + * 免責すること. + * + * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お + * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 + * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ + * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ + * の責任を負わない. + * + * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ + */ + +/* + * header file for the mros2 application + */ + +#include + +/* + * Priorities for TOPPERS tasks + */ + +#define MAIN_PRIORITY 5 + +#define HIGH_PRIORITY 9 +#define MID_PRIORITY 10 +#define LOW_PRIORITY 11 + +/* + * Constants that may depend on the target + */ + +#ifndef TASK_PORTID +#define TASK_PORTID 1 +#endif /* TASK_PORTID */ + +#ifndef STACK_SIZE +#define STACK_SIZE 4096 +#endif /* STACK_SIZE */ + +/* + * Declaration of prototyle functions + */ +#ifndef TOPPERS_MACRO_ONLY +#ifdef __cplusplus +extern "C" { +#endif +void main_task(void); +extern void led_cyclic_handler(intptr_t exinf); +#ifdef __cplusplus +} +#endif +void Error_Handler(); +#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.c new file mode 100644 index 0000000..41ef1da --- /dev/null +++ b/workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.c @@ -0,0 +1,24 @@ +#include "autosar_os_ext_asp3_user_config.h" + +const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), +}; + +const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) +{ + return autosar_os_ext_flag_user_map; +} + +int cmsis_get_flag_user_num(void) +{ + return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; +} diff --git a/workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.h new file mode 100644 index 0000000..7ad08bf --- /dev/null +++ b/workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.h @@ -0,0 +1,10 @@ +#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ + +#include "cmsis_config_utl.h" + +#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) + +extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; + +#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_mesh/config/autosar_os_ext_user_config.c b/workspace/echoreply_mesh/config/autosar_os_ext_user_config.c new file mode 100644 index 0000000..940941b --- /dev/null +++ b/workspace/echoreply_mesh/config/autosar_os_ext_user_config.c @@ -0,0 +1,75 @@ +#include "cmsis_os.h" +#include "autosar_os_ext_user_config.h" + +extern void tcpip_thread(void *arg); +extern void ethernetif_set_link(void* argument); +extern void ethernetif_input(void* argument); +extern void callHbPubFunc(void *arg); +extern void callHbSubFunc(void *arg); +extern void StartDefaultTask(void * argument); +extern void callWriterThreadFunction(void *arg); +extern void callReaderThreadFunction(void *arg); +extern void callRunBroadcast(void *args); +extern void mros2_init(void *args); + + +UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { + { + .taskID = AutosarOsExtTcpTask, + .func = tcpip_thread, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthIfLinkTask, + .func = ethernetif_set_link, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthInputTask, + .func = ethernetif_input, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBPubTask, + .func = callHbPubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBSubTask, + .func = callHbSubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtSPDPTask, + .func = callRunBroadcast, + .argument = NULL, + }, + { + .taskID = AutosarOsExtWriterTask, + .func = callWriterThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtReaderTask, + .func = callReaderThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtMROS2Task, + .func = mros2_init, + .argument = NULL, + }, +}; + +UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) +{ + return user_thread_autosar_ostask_map; +} +int cmsis_get_app_heap_size(void) +{ + return APP_HEAP_SIZE; +} +int cmsis_get_user_thread_num(void) +{ + return USER_THREAD_NUM; +} diff --git a/workspace/echoreply_mesh/config/autosar_os_ext_user_config.h b/workspace/echoreply_mesh/config/autosar_os_ext_user_config.h new file mode 100644 index 0000000..bab78d3 --- /dev/null +++ b/workspace/echoreply_mesh/config/autosar_os_ext_user_config.h @@ -0,0 +1,22 @@ +#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ + +#include "cmsis_os.h" +#include "cmsis_config_utl.h" + +/*********************************************** + * + * MEMORY + * + ***********************************************/ +#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ + + +/*********************************************** + * + * THREAD + * + ***********************************************/ +#define USER_THREAD_NUM 9U + +#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_mesh/config/mros2_user_config.c b/workspace/echoreply_mesh/config/mros2_user_config.c new file mode 100644 index 0000000..7d2c110 --- /dev/null +++ b/workspace/echoreply_mesh/config/mros2_user_config.c @@ -0,0 +1,10 @@ + + +#define SUB_MSG_COUNT 10 + +int mros2_get_submsg_count(void) +{ + return SUB_MSG_COUNT; +} + + diff --git a/workspace/echoreply_mesh/config/task.cfg b/workspace/echoreply_mesh/config/task.cfg new file mode 100644 index 0000000..f577110 --- /dev/null +++ b/workspace/echoreply_mesh/config/task.cfg @@ -0,0 +1,24 @@ +#include "task_impl.h" + +CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); +CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); +CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); +CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); +CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); +CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); +CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); +CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); +CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); +CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); + +CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_mesh/task_impl.c b/workspace/echoreply_mesh/task_impl.c new file mode 100644 index 0000000..afb9fca --- /dev/null +++ b/workspace/echoreply_mesh/task_impl.c @@ -0,0 +1,126 @@ +#include "cmsis_os.h" +#include "cmsis_config_utl.h" +#include "task_impl.h" + +TASK(AutosarOsExtTcpTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthIfLinkTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthInputTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBPubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBSubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtSPDPTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtWriterTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtReaderTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtUserDefaultTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtMROS2Task) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} diff --git a/workspace/echoreply_mesh/task_impl.h b/workspace/echoreply_mesh/task_impl.h new file mode 100644 index 0000000..11e7a81 --- /dev/null +++ b/workspace/echoreply_mesh/task_impl.h @@ -0,0 +1,54 @@ +#ifndef _AUTOSAR_OS_EXT_TEST_H_ +#define _AUTOSAR_OS_EXT_TEST_H_ + +#include "cmsis_config_utl.h" + +extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); + +/* + * priorities of mROS 2 tasks for RTPS + * + * TODO: We assigned relatevely lower priorities for EthIfLinkTask and + * EthInputTask than the application. Check whether these are appropriate. + */ +#define MROS2_HIGH_PRIORITY MAIN_PRIORITY +#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 + +/* + * experimental: stack size of mROS 2 tasks for RTPS + * Each comment refers the location of original definition + */ +// application/include/lwipopt.h +// #define TCPIP_THREAD_STACKSIZE 1024 +#define MROS2_STACK_SIZE_TcpTask 1024 +// application/src/lwip.c +// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) +#define MROS2_STACK_SIZE_EthIfLinkTask 1024 +// application/src/ethernet.c +// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) +#define MROS2_STACK_SIZE_EthInputTask 350 +// embeddedRTPS/include/config.h +// const int HEARTBEAT_STACKSIZE = 1200; // byte +#define MROS2_STACK_SIZE_HBPubTask 1200 +#define MROS2_STACK_SIZE_HBSubTask 1200 +// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte +#define MROS2_STACK_SIZE_SPDPTask 550 +// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte +#define MROS2_STACK_SIZE_WriterTask 1100 +// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte +#define MROS2_STACK_SIZE_ReaderTask 1600 +// embeddedRTPS-STM32/stm32/Src/main.cpp +// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); +#define MROS2_STACK_SIZE_UserDefaultTask 250 + + +#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/echoreply_mix/app.cpp b/workspace/echoreply_mix/app.cpp index ec9d692..2600475 100644 --- a/workspace/echoreply_mix/app.cpp +++ b/workspace/echoreply_mix/app.cpp @@ -1,6 +1,6 @@ #include "app.h" #include "mros2.h" -#include "../mros2_msgs/mix_msgs/msg/mix.hpp" +#include "mix_msgs/msg/mix.hpp" #include "stm32f7xx_nucleo_144.h" diff --git a/workspace/echoreply_odometry/app.cpp b/workspace/echoreply_odometry/app.cpp index 419f62f..5aa2e19 100644 --- a/workspace/echoreply_odometry/app.cpp +++ b/workspace/echoreply_odometry/app.cpp @@ -1,6 +1,6 @@ #include "app.h" #include "mros2.h" -#include "../mros2_msgs/nav_msgs/msg/odometry.hpp" +#include "nav_msgs/msg/odometry.hpp" #include "stm32f7xx_nucleo_144.h" diff --git a/workspace/echoreply_twist/app.cpp b/workspace/echoreply_twist/app.cpp index 8519513..23e652f 100644 --- a/workspace/echoreply_twist/app.cpp +++ b/workspace/echoreply_twist/app.cpp @@ -1,6 +1,6 @@ #include "app.h" #include "mros2.h" -#include "../mros2_msgs/geometry_msgs/msg/twist.hpp" +#include "geometry_msgs/msg/twist.hpp" #include "stm32f7xx_nucleo_144.h" From e04d733ab001552ed19195f00bcb6c4b1b73d486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Fri, 7 Jan 2022 20:43:42 +0900 Subject: [PATCH 53/80] clean msg header include path etc. --- makefiles/Makefile.lwip | 83 ++++++++++++++++++++++++++++++++++++++++ makefiles/Makefile.mros2 | 14 +++++++ makefiles/Makefile.rtps | 47 +++++++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 makefiles/Makefile.lwip create mode 100644 makefiles/Makefile.mros2 create mode 100644 makefiles/Makefile.rtps diff --git a/makefiles/Makefile.lwip b/makefiles/Makefile.lwip new file mode 100644 index 0000000..24e47d2 --- /dev/null +++ b/makefiles/Makefile.lwip @@ -0,0 +1,83 @@ +# +# Makefile definition for lwIP stack and startup +# + +CDEFS += -DUSE_LWIP_NO_STDDEF +CDEFS += -DSTM32F767xx +CDEFS += -DosObjectsExternal + +# +# lwIP +# + +LWIPDIR := $(ROOTDIR)/STM32CubeF7/Middlewares/Third_Party/LwIP + +INCLUDES += -I$(LWIPDIR)/src +INCLUDES += -I$(LWIPDIR)/src/include +INCLUDES += -I$(LWIPDIR)/system +INCLUDES += -I$(APLDIR)/include + +APPLDIR += $(LWIPDIR)/system/OS +APPLDIR += $(LWIPDIR)/src/netif +APPLDIR += $(LWIPDIR)/src/api +APPLDIR += $(LWIPDIR)/src/core +APPLDIR += $(LWIPDIR)/src/core/ipv4 +APPLDIR += $(APLDIR)/src + +# +# startup (generated by STM32CubeIDE) +# + +APLDIR := $(ROOTDIR)/src/startup +CFGDIR := $(ROOTDIR)/src/config + +INCLUDES += -I$(APLDIR)/include + +APPLDIR += $(APLDIR) +APPLDIR += $(CFGDIR) + +APPL_COBJS += sys_arch.o +APPL_COBJS += ethernet.o +APPL_COBJS += tcpip.o +APPL_COBJS += netbuf.o +APPL_COBJS += netifapi.o +APPL_COBJS += err.o +APPL_COBJS += netdb.o +APPL_COBJS += api_msg.o +APPL_COBJS += sockets.o +APPL_COBJS += api_lib.o +APPL_COBJS += pbuf.o +APPL_COBJS += sys.o +APPL_COBJS += mem.o +APPL_COBJS += netif.o +APPL_COBJS += tcp_in.o +APPL_COBJS += def.o +APPL_COBJS += stats.o +APPL_COBJS += dns.o +APPL_COBJS += raw.o +APPL_COBJS += udp.o +APPL_COBJS += ip.o +APPL_COBJS += tcp.o +APPL_COBJS += timeouts.o +APPL_COBJS += init.o +APPL_COBJS += tcp_out.o +APPL_COBJS += memp.o +APPL_COBJS += inet_chksum.o +APPL_COBJS += ip4_addr.o +APPL_COBJS += dhcp.o +APPL_COBJS += etharp.o +APPL_COBJS += icmp.o +APPL_COBJS += ip4.o +APPL_COBJS += igmp.o +APPL_COBJS += autoip.o +APPL_COBJS += ip4_frag.o +APPL_COBJS += stm32f7xx_hal_eth.o +APPL_COBJS += stm32f7xx_hal_cortex.o +APPL_COBJS += stm32f7xx_it.o +APPL_COBJS += ethernetif.o +APPL_COBJS += ethernetif_init.o +APPL_COBJS += lwip.o +APPL_COBJS += stm32f7xx_hal_pcd.o +APPL_COBJS += stm32f7xx_hal_pcd_ex.o +APPL_COBJS += stm32f7xx_ll_usb.o +APPL_COBJS += syscalls.o diff --git a/makefiles/Makefile.mros2 b/makefiles/Makefile.mros2 new file mode 100644 index 0000000..c733705 --- /dev/null +++ b/makefiles/Makefile.mros2 @@ -0,0 +1,14 @@ +# +# Makefile definition for mROS2 library +# + +MROS2DIR := $(ROOTDIR)/mros2 + +INCLUDES += -I$(MROS2DIR)/include +INCLUDES += -I$(MROS2DIR)/mros2_msgs + +INCLUDES += -I$(ROOTDIR)/mros2_msgs + +APPLDIR += $(MROS2DIR)/src + +APPL_CXXOBJS += mros2.o diff --git a/makefiles/Makefile.rtps b/makefiles/Makefile.rtps new file mode 100644 index 0000000..3051d0d --- /dev/null +++ b/makefiles/Makefile.rtps @@ -0,0 +1,47 @@ +# +# Makefile definition for embeddedRTPS stack +# + +RTPSDIR := $(ROOTDIR)/mros2/embeddedRTPS +MICROCDR_DIR := $(RTPSDIR)/thirdparty/Micro-CDR + +CDEFS += -DMROS2_USE_CUBE +CDEFS += -DMROS2_USE_EMBEDDEDRTPS + +INCLUDES += -I$(RTPSDIR)/include +INCLUDES += -I$(RTPSDIR)/include/rtps +INCLUDES += -I$(RTPSDIR)/thirdparty/lwip +INCLUDES += -I$(MICROCDR_DIR)/include +INCLUDES += -I$(MICROCDR_DIR)/src/c/types + +APPLDIR += $(RTPSDIR)/src +APPLDIR += $(RTPSDIR)/src/communication +APPLDIR += $(RTPSDIR)/src/discovery +APPLDIR += $(RTPSDIR)/src/entities +APPLDIR += $(RTPSDIR)/src/messages +APPLDIR += $(RTPSDIR)/src/storages +APPLDIR += $(MICROCDR_DIR)/src/c +APPLDIR += $(MICROCDR_DIR)/src/c/types + +APPL_CXXOBJS += UdpDriver.o +APPL_CXXOBJS += ParticipantProxyData.o +APPL_CXXOBJS += SEDPAgent.o +APPL_CXXOBJS += SPDPAgent.o +APPL_CXXOBJS += TopicData.o +APPL_CXXOBJS += Domain.o +APPL_CXXOBJS += Participant.o +APPL_CXXOBJS += StatelessReader.o +APPL_CXXOBJS += MessageReceiver.o +APPL_CXXOBJS += MessageTypes.o +APPL_CXXOBJS += HistoryCache.o +APPL_CXXOBJS += PBufWrapper.o +APPL_CXXOBJS += SimpleHistoryCache.o +APPL_CXXOBJS += rtps.o +APPL_CXXOBJS += ThreadPool.o + +APPL_COBJS += array.o +APPL_COBJS += basic.o +APPL_COBJS += sequence.o +APPL_COBJS += string.o +APPL_COBJS += common.o + From 2360143b004ed2f484833d40b4fd7bf9cb7a8ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sun, 9 Jan 2022 20:35:03 +0900 Subject: [PATCH 54/80] declaration of templates func moved to templates.hpp(this is automatically generated when make app) --- workspace/Makefile | 5 ++++- workspace/echoreply_joint_state/templates.hpp | 11 +++++++++++ workspace/echoreply_string/templates.hpp | 11 +++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 workspace/echoreply_joint_state/templates.hpp create mode 100644 workspace/echoreply_string/templates.hpp diff --git a/workspace/Makefile b/workspace/Makefile index 8840d70..c018c45 100644 --- a/workspace/Makefile +++ b/workspace/Makefile @@ -10,6 +10,7 @@ BOARDPATH := /Volumes/${BOARDNAME} MSGDIR := custom_msgs/${msg} MROS2DIR := ../mros2 HEADERGEN_FILE := $(MROS2DIR)/mros2_header_generator/header_generator.py +TEMPLATESGEN_FILE := $(MROS2DIR)/mros2_header_generator/templates_generator.py ifdef app # nothing to do @@ -20,6 +21,8 @@ usage: endif all: clean + + @python $(TEMPLATESGEN_FILE) $(MROS2DIR) $(APPNAME); @cd $(BUILDSPACE) && make -j4 -f Makefile.common app=${APPNAME} @cp $(BUILDSPACE)/asp.bin . && cp $(BUILDSPACE)/asp.elf . @echo "Build complete successfully" @@ -31,7 +34,7 @@ all: clean clean: @cd $(BUILDSPACE) && make -f Makefile.common clean - rm -f asp.* + rm -f asp.* && rm -f asp* gen-msg: @if [ -a $(MSGDIR)/msg_settings.json ]; then \ diff --git a/workspace/echoreply_joint_state/templates.hpp b/workspace/echoreply_joint_state/templates.hpp new file mode 100644 index 0000000..875b397 --- /dev/null +++ b/workspace/echoreply_joint_state/templates.hpp @@ -0,0 +1,11 @@ + +#include "sensor_msgs/msg/joint_state.hpp" + + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template void mros2::Publisher::publish(sensor_msgs::msg::JointState &msg); + + + +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(sensor_msgs::msg::JointState*)); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/echoreply_string/templates.hpp b/workspace/echoreply_string/templates.hpp new file mode 100644 index 0000000..780d817 --- /dev/null +++ b/workspace/echoreply_string/templates.hpp @@ -0,0 +1,11 @@ + +#include "std_msgs/msg/string.hpp" + + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::String &msg); + + + +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::String*)); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); From d9c4c31a6f9ec1a43d50e38abdca65baacb6cd13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sun, 9 Jan 2022 20:39:19 +0900 Subject: [PATCH 55/80] declaration of templates func moved to templates.hpp(this is automatically generated when make app) --- header_includer/header_includer.hpp | 31 +---------------------------- 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/header_includer/header_includer.hpp b/header_includer/header_includer.hpp index 7aab79e..a5a80e4 100644 --- a/header_includer/header_includer.hpp +++ b/header_includer/header_includer.hpp @@ -1,30 +1 @@ -#include "../../mros2_msgs/nav_msgs/msg/odometry.hpp" -#include "../../mros2_msgs/geometry_msgs/msg/twist.hpp" -#include "../../mros2_msgs/mix_msgs/msg/mix.hpp" -#include "../../mros2_msgs/health_msgs/msg/health.hpp" -#include "../../mros2_msgs/sensor_msgs/msg/joint_state.hpp" - -template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); -template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(nav_msgs::msg::Odometry*)); -template void mros2::Publisher::publish(nav_msgs::msg::Odometry &msg); -template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); - -template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); -template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(geometry_msgs::msg::Twist*)); -template void mros2::Publisher::publish(geometry_msgs::msg::Twist &msg); -template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); - -template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); -template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(mix_msgs::msg::Mix*)); -template void mros2::Publisher::publish(mix_msgs::msg::Mix &msg); -template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); - -template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); -template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(health_msgs::msg::Health*)); -template void mros2::Publisher::publish(health_msgs::msg::Health &msg); -template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); - -template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); -template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(sensor_msgs::msg::JointState*)); -template void mros2::Publisher::publish(sensor_msgs::msg::JointState &msg); -template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); \ No newline at end of file +#include "../workspace/echoreply_string/templates.hpp" \ No newline at end of file From 5e2ad96e1d773fcf5ada318a6346cad9754e2ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 12 Jan 2022 14:53:31 +0900 Subject: [PATCH 56/80] make calc_time branch the same as main --- workspace/Makefile | 2 +- workspace/README.md | 13 +------------ workspace/echoreply_float32/app.cpp | 16 ++++++++++------ workspace/echoreply_mix/templates.hpp | 11 +++++++++++ workspace/echoreply_twist/app.cpp | 2 -- workspace/echoreply_twist/templates.hpp | 11 +++++++++++ workspace/echoreply_twist_string/app.cpp | 6 +++--- workspace/echoreply_twist_string/templates.hpp | 11 +++++++++++ workspace/echoreply_uint16/app.cpp | 7 +++---- workspace/sub_string/app.cpp | 2 +- 10 files changed, 52 insertions(+), 29 deletions(-) create mode 100644 workspace/echoreply_mix/templates.hpp create mode 100644 workspace/echoreply_twist/templates.hpp create mode 100644 workspace/echoreply_twist_string/templates.hpp diff --git a/workspace/Makefile b/workspace/Makefile index c018c45..1c58896 100644 --- a/workspace/Makefile +++ b/workspace/Makefile @@ -34,7 +34,7 @@ all: clean clean: @cd $(BUILDSPACE) && make -f Makefile.common clean - rm -f asp.* && rm -f asp* + rm -f asp.* gen-msg: @if [ -a $(MSGDIR)/msg_settings.json ]; then \ diff --git a/workspace/README.md b/workspace/README.md index df8a5cc..291b33e 100644 --- a/workspace/README.md +++ b/workspace/README.md @@ -32,24 +32,13 @@ Please also check [mROS-base/mros2-host-examples](https://github.com/mROS-base/m - Description: - The mROS 2 node on the embedded board subscribes `float32` (`std_msgs::msg::Float32`) message from `/to_stm` topic. - And then publishes this `float32` message as it is to `/to_linux` as the reply. - - Note that this application just print whether the value of message is between 5.0 and 10.0 or not, since TOPPERS/ASP3 kernel cannot print float value. + - Note that this application just print whether the value of message is less than 0.0, between 0.0 and 1.0, or greater than 1.0, since TOPPERS/ASP3 kernel cannot print float value. - Host operation: - `$ ros2 launch mros2_echoback_float32 launch.py` - or, at two terminals: - `$ ros2 run mros2_echoback_float32 pub_node` - `$ ros2 run mros2_echoback_float32 sub_node` -## echoreply_header - -- Description: - - The mROS 2 node on the embedded board subscribes `header` (`std_msgs::msg::Header`) message from `/to_stm` topic. - - And then publishes this `header` message as it is to `/to_linux` as the reply. -- Host operation: - - `$ ros2 launch mros2_echoback_header launch.py` - - or, at two terminals: - - `$ ros2 run mros2_echoback_header pub_node` - - `$ ros2 run mros2_echoback_header sub_node` - ## pub_string - Description: diff --git a/workspace/echoreply_float32/app.cpp b/workspace/echoreply_float32/app.cpp index 8347a73..d9daec0 100644 --- a/workspace/echoreply_float32/app.cpp +++ b/workspace/echoreply_float32/app.cpp @@ -9,14 +9,18 @@ mros2::Publisher pub; void userCallback(std_msgs::msg::Float32 *msg) { - if (5.0 < msg->data && msg->data < 10.0) { - MROS2_INFO("5.0 < msg < 10.0"); + if (0.0 >= msg->data) { + MROS2_INFO("msg <= 0.0"); + } else if (0.0 < msg->data && msg->data < 0.5) { + MROS2_INFO("0.0 < msg < 0.5"); + } else if (0.5 < msg->data && msg->data < 1.0) { + MROS2_INFO("0.5 < msg < 1.0"); } else { - MROS2_INFO("msg <= 5.0 or 10.0 <= msg"); + MROS2_INFO("msg >= 1.0"); } /* TODO: make MROS2_INFO support float type - MROS2_INFO("subscribed msg: %f", msg->data); - MROS2_INFO("publishing msg: %f", msg->data); + MROS2_INFO("subscribed msg: '%f'", msg->data); + MROS2_INFO("publishing msg: '%f'", msg->data); */ pub.publish(*msg); } @@ -47,4 +51,4 @@ void main_task(void) void led_cyclic_handler(intptr_t exinf) { BSP_LED_Toggle(LED2); -} +} \ No newline at end of file diff --git a/workspace/echoreply_mix/templates.hpp b/workspace/echoreply_mix/templates.hpp new file mode 100644 index 0000000..d803f3f --- /dev/null +++ b/workspace/echoreply_mix/templates.hpp @@ -0,0 +1,11 @@ + +#include "mix_msgs/msg/mix.hpp" + + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template void mros2::Publisher::publish(mix_msgs::msg::Mix &msg); + + + +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(mix_msgs::msg::Mix*)); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/echoreply_twist/app.cpp b/workspace/echoreply_twist/app.cpp index 23e652f..fc1be76 100644 --- a/workspace/echoreply_twist/app.cpp +++ b/workspace/echoreply_twist/app.cpp @@ -9,8 +9,6 @@ mros2::Publisher pub; void userCallback(geometry_msgs::msg::Twist *msg) { - MROS2_INFO("subscribed msg!"); - MROS2_INFO("publishing msg!"); pub.publish(*msg); } diff --git a/workspace/echoreply_twist/templates.hpp b/workspace/echoreply_twist/templates.hpp new file mode 100644 index 0000000..11c4a00 --- /dev/null +++ b/workspace/echoreply_twist/templates.hpp @@ -0,0 +1,11 @@ + +#include "geometry_msgs/msg/twist.hpp" + + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template void mros2::Publisher::publish(geometry_msgs::msg::Twist &msg); + + + +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(geometry_msgs::msg::Twist*)); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/echoreply_twist_string/app.cpp b/workspace/echoreply_twist_string/app.cpp index d2f6b4f..42fb81d 100644 --- a/workspace/echoreply_twist_string/app.cpp +++ b/workspace/echoreply_twist_string/app.cpp @@ -10,8 +10,8 @@ mros2::Publisher pub; void userCallback(std_msgs::msg::String *msg) { - MROS2_INFO("subscribed msg!"); + /* std::string sub_str1 = msg->data.substr(0,8); std::string sub_str2 = msg->data.substr(8,8); std::string sub_str3 = msg->data.substr(16,8); @@ -37,8 +37,8 @@ void userCallback(std_msgs::msg::String *msg) std::string pub_str = "0.0000000.0000020.0000040.0000060.0000080.000010"; // pub_str1 + pub_str2 + pub_str3 + pub_str4 + pub_str5 + pub_str6; reconverted_message.data = pub_str; - MROS2_INFO("publishing msg!"); - pub.publish(reconverted_message); + */ + pub.publish(*msg); //reconverted_message); } int main(int argc, char * argv[]) diff --git a/workspace/echoreply_twist_string/templates.hpp b/workspace/echoreply_twist_string/templates.hpp new file mode 100644 index 0000000..780d817 --- /dev/null +++ b/workspace/echoreply_twist_string/templates.hpp @@ -0,0 +1,11 @@ + +#include "std_msgs/msg/string.hpp" + + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::String &msg); + + + +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::String*)); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/echoreply_uint16/app.cpp b/workspace/echoreply_uint16/app.cpp index 35c9728..1d98c8f 100644 --- a/workspace/echoreply_uint16/app.cpp +++ b/workspace/echoreply_uint16/app.cpp @@ -9,8 +9,8 @@ mros2::Publisher pub; void userCallback(std_msgs::msg::UInt16 *msg) { - MROS2_INFO("subscribed msg: %u", msg->data); - MROS2_INFO("publishing msg: %u", msg->data); + MROS2_INFO("subscribed msg: '%d'", msg->data); + MROS2_INFO("publishing msg: '%d'", msg->data); pub.publish(*msg); } @@ -25,7 +25,6 @@ int main(int argc, char * argv[]) mros2::Node node = mros2::Node::create_node("mros2_node"); pub = node.create_publisher("to_linux", 10); sub = node.create_subscription("to_stm", 10, userCallback); - std_msgs::msg::UInt16 msg; MROS2_INFO("ready to pub/sub message"); mros2::spin(); @@ -41,4 +40,4 @@ void led_cyclic_handler(intptr_t exinf) { BSP_LED_Toggle(LED2); -} +} \ No newline at end of file diff --git a/workspace/sub_string/app.cpp b/workspace/sub_string/app.cpp index 0317e40..f8950e9 100644 --- a/workspace/sub_string/app.cpp +++ b/workspace/sub_string/app.cpp @@ -18,7 +18,7 @@ int main(int argc, char * argv[]) BSP_LED_Toggle(LED1); mros2::Node node = mros2::Node::create_node("mros2_node"); - mros2::Subscriber sub = node.create_subscription("to_stm", 10, userCallback); + mros2::Subscriber sub = node.create_subscription("to_stm", 10, userCallback); MROS2_INFO("ready to subscribe message"); mros2::spin(); From 8a3d052522a68cfc226898ee83d32d63940ae2a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 12 Jan 2022 15:00:09 +0900 Subject: [PATCH 57/80] make calc_time branch cover the progress in main branch --- makefiles/Makefile.lwip | 1 + src/startup/dso_handle.c | 2 ++ test/build/Makefile.common | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 src/startup/dso_handle.c diff --git a/makefiles/Makefile.lwip b/makefiles/Makefile.lwip index 24e47d2..de1b544 100644 --- a/makefiles/Makefile.lwip +++ b/makefiles/Makefile.lwip @@ -81,3 +81,4 @@ APPL_COBJS += stm32f7xx_hal_pcd.o APPL_COBJS += stm32f7xx_hal_pcd_ex.o APPL_COBJS += stm32f7xx_ll_usb.o APPL_COBJS += syscalls.o +APPL_COBJS += dso_handle.o \ No newline at end of file diff --git a/src/startup/dso_handle.c b/src/startup/dso_handle.c new file mode 100644 index 0000000..c24d2e9 --- /dev/null +++ b/src/startup/dso_handle.c @@ -0,0 +1,2 @@ +/* Statement to avoid link error */ +void* __dso_handle=0; \ No newline at end of file diff --git a/test/build/Makefile.common b/test/build/Makefile.common index e26e6ce..42d8456 100644 --- a/test/build/Makefile.common +++ b/test/build/Makefile.common @@ -15,7 +15,7 @@ APPDIR := ${ROOTDIR}/test/${APPNAME} DRIVERSDIR := $(ROOTDIR)/STM32CubeF7/Drivers MIDDLESDIR := $(ROOTDIR)/STM32CubeF7/Middlewares CMSIS_MAKEFILEDIR := ${ROOTDIR}/cmsis-asp3 -MROS2_MAKEFILEDIR := ${ROOTDIR}/mros2/makefiles +MROS2_MAKEFILEDIR := ${ROOTDIR}/makefiles ASP3_MAKEFILEDIR := ${ROOTDIR}/asp3-f767zi # test app makefile include @@ -32,4 +32,4 @@ include ${MROS2_MAKEFILEDIR}/Makefile.rtps include ${MROS2_MAKEFILEDIR}/Makefile.mros2 # asp3-f767zi makefiles include -include ${ASP3_MAKEFILEDIR}/Makefile.mros2 +include ${ASP3_MAKEFILEDIR}/Makefile.mros2 \ No newline at end of file From 06b58656a7c9b169ffe8558bf4b4f5045cc783da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 12 Jan 2022 15:09:31 +0900 Subject: [PATCH 58/80] update mros2 commit ID --- mros2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2 b/mros2 index f3e3a60..83515de 160000 --- a/mros2 +++ b/mros2 @@ -1 +1 @@ -Subproject commit f3e3a600dee6a8b14c55f2f4517fe82fceb13f5c +Subproject commit 83515de5bb9ec42348727873a3d3ace81636983d From efcf834b32ca4485cf70d464b6e0db8b1e27d68d Mon Sep 17 00:00:00 2001 From: takasehideki Date: Wed, 12 Jan 2022 18:11:17 +0900 Subject: [PATCH 59/80] able to make --- workspace/echoreply_twist_string/app.cpp | 32 +++++++++++------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/workspace/echoreply_twist_string/app.cpp b/workspace/echoreply_twist_string/app.cpp index 42fb81d..a4da82f 100644 --- a/workspace/echoreply_twist_string/app.cpp +++ b/workspace/echoreply_twist_string/app.cpp @@ -10,8 +10,6 @@ mros2::Publisher pub; void userCallback(std_msgs::msg::String *msg) { - - /* std::string sub_str1 = msg->data.substr(0,8); std::string sub_str2 = msg->data.substr(8,8); std::string sub_str3 = msg->data.substr(16,8); @@ -19,26 +17,26 @@ void userCallback(std_msgs::msg::String *msg) std::string sub_str5 = msg->data.substr(32,8); std::string sub_str6 = msg->data.substr(40,8); - double linear_x = 0.000000; // std::stod(sub_str1); - double linear_y = 0.000002; // std::stod(sub_str2); - double linear_z = 0.000004; // std::stod(sub_str3); - double angluar_x = 0.000006; // std::stod(sub_str4); - double angluar_y = 0.000008; // std::stod(sub_str5); - double angluar_z = 0.000010; // std::stod(sub_str6); + double linear_x = std::stod(sub_str1); + double linear_y = std::stod(sub_str2); + double linear_z = std::stod(sub_str3); + double angular_x = std::stod(sub_str4); + double angular_y = std::stod(sub_str5); + double angular_z = std::stod(sub_str6); auto reconverted_message = std_msgs::msg::String(); - std::string pub_str1 = "0.000000"; // std::to_string(linear_x); - std::string pub_str2 = "0.000002"; // std::to_string(linear_y); - std::string pub_str3 = "0.000004"; // std::to_string(linear_z); - std::string pub_str4 = "0.000006"; // std::to_string(angular_x); - std::string pub_str5 = "0.000008"; // std::to_string(angular_y); - std::string pub_str6 = "0.000010"; // std::to_string(angular_z); + std::string pub_str1 = std::to_string(linear_x); + std::string pub_str2 = std::to_string(linear_y); + std::string pub_str3 = std::to_string(linear_z); + std::string pub_str4 = std::to_string(angular_x); + std::string pub_str5 = std::to_string(angular_y); + std::string pub_str6 = std::to_string(angular_z); - std::string pub_str = "0.0000000.0000020.0000040.0000060.0000080.000010"; // pub_str1 + pub_str2 + pub_str3 + pub_str4 + pub_str5 + pub_str6; + std::string pub_str = pub_str1 + pub_str2 + pub_str3 + pub_str4 + pub_str5 + pub_str6; reconverted_message.data = pub_str; - */ - pub.publish(*msg); //reconverted_message); + + pub.publish(reconverted_message); } int main(int argc, char * argv[]) From 18e63d943ae0feddc69540fd1fa5e81463bda910 Mon Sep 17 00:00:00 2001 From: takasehideki Date: Wed, 12 Jan 2022 19:44:51 +0900 Subject: [PATCH 60/80] prepare double_to_string() manually --- workspace/echoreply_twist_string/app.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/workspace/echoreply_twist_string/app.cpp b/workspace/echoreply_twist_string/app.cpp index a4da82f..3940c46 100644 --- a/workspace/echoreply_twist_string/app.cpp +++ b/workspace/echoreply_twist_string/app.cpp @@ -5,6 +5,16 @@ #include "stm32f7xx_nucleo_144.h" +std::string double_to_string(double value) +{ + int intpart, fracpart; + char str[12]; + intpart = (int)value; + fracpart = (int)((value - intpart) * 1000000); + sprintf(str, "%d.%06d", intpart, fracpart); + return str; +} + mros2::Subscriber sub; mros2::Publisher pub; @@ -26,12 +36,12 @@ void userCallback(std_msgs::msg::String *msg) auto reconverted_message = std_msgs::msg::String(); - std::string pub_str1 = std::to_string(linear_x); - std::string pub_str2 = std::to_string(linear_y); - std::string pub_str3 = std::to_string(linear_z); - std::string pub_str4 = std::to_string(angular_x); - std::string pub_str5 = std::to_string(angular_y); - std::string pub_str6 = std::to_string(angular_z); + std::string pub_str1 = double_to_string(linear_x); + std::string pub_str2 = double_to_string(linear_y); + std::string pub_str3 = double_to_string(linear_z); + std::string pub_str4 = double_to_string(angular_x); + std::string pub_str5 = double_to_string(angular_y); + std::string pub_str6 = double_to_string(angular_z); std::string pub_str = pub_str1 + pub_str2 + pub_str3 + pub_str4 + pub_str5 + pub_str6; reconverted_message.data = pub_str; From fe73d20d3002177ad7a9535a8cdeb1ca5e2d4515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 19 Jan 2022 23:11:52 +0900 Subject: [PATCH 61/80] echoreply_string_eval app added --- .expo/.README.md.icloud | Bin 0 -> 157 bytes .expo/.settings.json.icloud | Bin 0 -> 160 bytes .gitignore | 1 + header_includer/header_includer.hpp | 2 +- workspace/Makefile | 2 +- .../custom_msgs/mix_msgs/msg/IntVector3.msg | 4 +- .../custom_msgs/mix_msgs/msg_settings.json | 2 +- workspace/echoreply_mesh/app.cpp | 2 +- workspace/echoreply_mesh/templates.hpp | 11 ++ workspace/echoreply_odometry/templates.hpp | 11 ++ workspace/echoreply_string_eval/Makefile.inc | 27 ++++ workspace/echoreply_string_eval/README.md | 24 ++++ workspace/echoreply_string_eval/app.cdl | 122 +++++++++++++++++ workspace/echoreply_string_eval/app.cfg | 14 ++ workspace/echoreply_string_eval/app.cpp | 42 ++++++ workspace/echoreply_string_eval/app.h | 84 ++++++++++++ .../config/autosar_os_ext_asp3_user_config.c | 24 ++++ .../config/autosar_os_ext_asp3_user_config.h | 10 ++ .../config/autosar_os_ext_user_config.c | 75 +++++++++++ .../config/autosar_os_ext_user_config.h | 22 +++ .../config/mros2_user_config.c | 10 ++ .../echoreply_string_eval/config/task.cfg | 24 ++++ workspace/echoreply_string_eval/task_impl.c | 126 ++++++++++++++++++ workspace/echoreply_string_eval/task_impl.h | 54 ++++++++ workspace/echoreply_string_eval/templates.hpp | 11 ++ 25 files changed, 697 insertions(+), 7 deletions(-) create mode 100644 .expo/.README.md.icloud create mode 100644 .expo/.settings.json.icloud create mode 100644 workspace/echoreply_mesh/templates.hpp create mode 100644 workspace/echoreply_odometry/templates.hpp create mode 100644 workspace/echoreply_string_eval/Makefile.inc create mode 100644 workspace/echoreply_string_eval/README.md create mode 100644 workspace/echoreply_string_eval/app.cdl create mode 100644 workspace/echoreply_string_eval/app.cfg create mode 100644 workspace/echoreply_string_eval/app.cpp create mode 100644 workspace/echoreply_string_eval/app.h create mode 100644 workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.c create mode 100644 workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.h create mode 100644 workspace/echoreply_string_eval/config/autosar_os_ext_user_config.c create mode 100644 workspace/echoreply_string_eval/config/autosar_os_ext_user_config.h create mode 100644 workspace/echoreply_string_eval/config/mros2_user_config.c create mode 100644 workspace/echoreply_string_eval/config/task.cfg create mode 100644 workspace/echoreply_string_eval/task_impl.c create mode 100644 workspace/echoreply_string_eval/task_impl.h create mode 100644 workspace/echoreply_string_eval/templates.hpp diff --git a/.expo/.README.md.icloud b/.expo/.README.md.icloud new file mode 100644 index 0000000000000000000000000000000000000000..0fd5d5ae176b80c52ad7eaf54e310e031e0f6752 GIT binary patch literal 157 zcmYc)$jK}&F)+By$i&RT$`<1n92(@~mzbOComv?$AOPmNW#*&?XI4RkB;Z0psm1xF zMaiill?5QF$RJlo7hhMs+!R4(>39Jdtm=YN(@S#_i#YgY^u0pD8Nh&%5kfPtLunXQ F1_0L=DBJ)5 literal 0 HcmV?d00001 diff --git a/.expo/.settings.json.icloud b/.expo/.settings.json.icloud new file mode 100644 index 0000000000000000000000000000000000000000..e9807bbec133178366521bc2e3bc1f539acebfc7 GIT binary patch literal 160 zcmYc)$jK}&F)+By$i&RT$`<1n92(@~mzbOComv?$AOPmNW#*&?XI4RkB;Z0psm1xF zMaiill?5QF*y7ZZlFYpHV!f>5{5*k*cmWx#N`q3triangles[0].vertex_indices[0]); MROS2_INFO("publishing!"); pub.publish(*msg); } diff --git a/workspace/echoreply_mesh/templates.hpp b/workspace/echoreply_mesh/templates.hpp new file mode 100644 index 0000000..8f293c1 --- /dev/null +++ b/workspace/echoreply_mesh/templates.hpp @@ -0,0 +1,11 @@ + +#include "shape_msgs/msg/mesh.hpp" + + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template void mros2::Publisher::publish(shape_msgs::msg::Mesh &msg); + + + +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(shape_msgs::msg::Mesh*)); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/echoreply_odometry/templates.hpp b/workspace/echoreply_odometry/templates.hpp new file mode 100644 index 0000000..1c677f6 --- /dev/null +++ b/workspace/echoreply_odometry/templates.hpp @@ -0,0 +1,11 @@ + +#include "nav_msgs/msg/odometry.hpp" + + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template void mros2::Publisher::publish(nav_msgs::msg::Odometry &msg); + + + +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(nav_msgs::msg::Odometry*)); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/echoreply_string_eval/Makefile.inc b/workspace/echoreply_string_eval/Makefile.inc new file mode 100644 index 0000000..f807ac1 --- /dev/null +++ b/workspace/echoreply_string_eval/Makefile.inc @@ -0,0 +1,27 @@ +# +# Makefile definition for mros2 application +# + +# name of main application +APPLNAME = app + +# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) +# NOTE: also check `initLogMask` in app.cdl for syslog setting +CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 + +# information for directory tree +APPLDIR := $(APPDIR) +APPLDIR += $(APPDIR)/config + +# link option for C++ code +SRCLANG = c++ +APPL_CXXLIBS += -specs=nano.specs + +# compile switch +CDEFS += -DUSE_ASP3_FOR_STM + +# additional files for configuration +APPL_COBJS := task_impl.o +APPL_COBJS += autosar_os_ext_user_config.o +APPL_COBJS += autosar_os_ext_asp3_user_config.o +APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_string_eval/README.md b/workspace/echoreply_string_eval/README.md new file mode 100644 index 0000000..6ae2132 --- /dev/null +++ b/workspace/echoreply_string_eval/README.md @@ -0,0 +1,24 @@ +### string型通信動作確認用アプリ + +string型の通信の動作確認をするためのサンプルアプリです。 +以下の手順で確認できます。 + +1.workspaceディレクトリにて、`make app=echoreply_string` によりアプリをビルド + +2.Serial Console (picocomなど) を立ち上げて、初期化 + +3.hostのros2アプリからstring型のmessageを送信 + +4.messageを受信、これを再びhostのros2アプリに向かって送信 (以下) + +``` +Subscribed msg : Hello, world! 1 +Publishing msg : Hello, world! 1 +Subscribed msg : Hello, world! 2 +Publishing msg : Hello, world! 2 +Subscribed msg : Hello, world! 3 +Publishing msg : Hello, world! 3 +Subscribed msg : Hello, world! 4 +Publishing msg : Hello, world! 4 +... +``` diff --git a/workspace/echoreply_string_eval/app.cdl b/workspace/echoreply_string_eval/app.cdl new file mode 100644 index 0000000..176c5a6 --- /dev/null +++ b/workspace/echoreply_string_eval/app.cdl @@ -0,0 +1,122 @@ +/* + * サンプルプログラム(1)のコンポーネント記述ファイル + * + * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ + */ +/* + * カーネルオブジェクトの定義 + */ +import(); + +/* + * ターゲット非依存のセルタイプの定義 + */ +import("syssvc/tSerialPort.cdl"); +import("syssvc/tSerialAdapter.cdl"); +import("syssvc/tSysLog.cdl"); +import("syssvc/tSysLogAdapter.cdl"); +import("syssvc/tLogTask.cdl"); +import("syssvc/tBanner.cdl"); + +/* + * ターゲット依存部の取り込み + */ +import("target.cdl"); + +/* + * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" + * の行までのことを言う. + */ + +/* + * システムログ機能のアダプタの組上げ記述 + * + * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー + * スのシステムログ機能を呼び出すためのセルである.システムログ機能の + * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び + * 出さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSysLogAdapter SysLogAdapter { + cSysLog = SysLog.eSysLog; +}; + +/* + * シリアルインタフェースドライバのアダプタの組上げ記述 + * + * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー + * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための + * セルである.シリアルインタフェースドライバのサービスコールを呼び出 + * さない場合には,以下のセルの組上げ記述を削除してよい. + */ +cell tSerialAdapter SerialAdapter { + cSerialPort[0] = SerialPort1.eSerialPort; +}; + +/* + * システムログ機能の組上げ記述 + * + * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ + * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, + * システムログタスクはシステムログ機能を使用するため,それも外すこと + * が必要である.また,システムログ機能のアダプタも外さなければならな + * い.tecsgenが警告メッセージを出すが,無視してよい. + */ +cell tSysLog SysLog { + logBufferSize = 32; /* ログバッファのサイズ */ + initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); + /* ログバッファに記録すべき重要度 */ + initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); + /* 低レベル出力すべき重要度 */ + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * シリアルインタフェースドライバの組上げ記述 + * + * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 + * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー + * スドライバを使用するため,それも外すことが必要である.また,シリア + * ルインタフェースドライバのアダプタも外さなければならない. + */ +cell tSerialPort SerialPort1 { + receiveBufferSize = 256; /* 受信バッファのサイズ */ + sendBufferSize = 256; /* 送信バッファのサイズ */ + + /* ターゲット依存部との結合 */ + cSIOPort = SIOPortTarget1.eSIOPort; + eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ +}; + +/* + * システムログタスクの組上げ記述 + * + * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ + * ばよい. + */ +cell tLogTask LogTask { + priority = 3; /* システムログタスクの優先度 */ + stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ + + /* シリアルインタフェースドライバとの結合 */ + cSerialPort = SerialPort1.eSerialPort; + cnSerialPortManage = SerialPort1.enSerialPortManage; + + /* システムログ機能との結合 */ + cSysLog = SysLog.eSysLog; + + /* 低レベル出力との結合 */ + cPutLog = PutLogTarget.ePutLog; +}; + +/* + * カーネル起動メッセージ出力の組上げ記述 + * + * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 + * を削除すればよい. + */ +cell tBanner Banner { + /* 属性の設定 */ + targetName = BannerTargetName; + copyrightNotice = BannerCopyrightNotice; +}; diff --git a/workspace/echoreply_string_eval/app.cfg b/workspace/echoreply_string_eval/app.cfg new file mode 100644 index 0000000..eb0495d --- /dev/null +++ b/workspace/echoreply_string_eval/app.cfg @@ -0,0 +1,14 @@ +/* + * サンプルプログラム(1)のシステムコンフィギュレーションファイル + */ +INCLUDE("tecsgen.cfg"); +INCLUDE("asp3ext.cfg"); +INCLUDE("task.cfg"); + +#include "app.h" +#include "stm32f7xx_it.h" +CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); +CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); +CFG_INT(77, {TA_EDGE, -4}); + +CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_string_eval/app.cpp b/workspace/echoreply_string_eval/app.cpp new file mode 100644 index 0000000..ddb39a8 --- /dev/null +++ b/workspace/echoreply_string_eval/app.cpp @@ -0,0 +1,42 @@ +#include "app.h" +#include "mros2.h" +#include "std_msgs/msg/string.hpp" + +#include "stm32f7xx_nucleo_144.h" + +mros2::Subscriber sub; +mros2::Publisher pub; + +void userCallback(std_msgs::msg::String *msg) +{ + pub.publish(*msg); +} + +int main(int argc, char * argv[]) +{ + MROS2_INFO("mROS 2 application is started"); + + mros2::init(argc, argv); + MROS2_DEBUG("mROS 2 initialization is completed"); + BSP_LED_Toggle(LED1); + + mros2::Node node = mros2::Node::create_node("mros2_node"); + pub = node.create_publisher("to_linux", 10); + sub = node.create_subscription("to_stm", 10, userCallback); + std_msgs::msg::String msg; + + MROS2_INFO("ready to pub/sub message"); + mros2::spin(); + BSP_LED_Toggle(LED3); +} + +void main_task(void) +{ + main(0, NULL); +} + +void +led_cyclic_handler(intptr_t exinf) +{ + BSP_LED_Toggle(LED2); +} diff --git a/workspace/echoreply_string_eval/app.h b/workspace/echoreply_string_eval/app.h new file mode 100644 index 0000000..36eb6cf --- /dev/null +++ b/workspace/echoreply_string_eval/app.h @@ -0,0 +1,84 @@ +/* + * TOPPERS/ASP Kernel + * Toyohashi Open Platform for Embedded Real-Time Systems/ + * Advanced Standard Profile Kernel + * + * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory + * Toyohashi Univ. of Technology, JAPAN + * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory + * Graduate School of Information Science, Nagoya Univ., JAPAN + * + * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ + * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 + * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. + * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 + * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー + * スコード中に含まれていること. + * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 + * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 + * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 + * の無保証規定を掲載すること. + * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 + * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ + * と. + * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 + * 作権表示,この利用条件および下記の無保証規定を掲載すること. + * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに + * 報告すること. + * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 + * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. + * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 + * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを + * 免責すること. + * + * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お + * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 + * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ + * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ + * の責任を負わない. + * + * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ + */ + +/* + * header file for the mros2 application + */ + +#include + +/* + * Priorities for TOPPERS tasks + */ + +#define MAIN_PRIORITY 5 + +#define HIGH_PRIORITY 9 +#define MID_PRIORITY 10 +#define LOW_PRIORITY 11 + +/* + * Constants that may depend on the target + */ + +#ifndef TASK_PORTID +#define TASK_PORTID 1 +#endif /* TASK_PORTID */ + +#ifndef STACK_SIZE +#define STACK_SIZE 4096 +#endif /* STACK_SIZE */ + +/* + * Declaration of prototyle functions + */ +#ifndef TOPPERS_MACRO_ONLY +#ifdef __cplusplus +extern "C" { +#endif +void main_task(void); +extern void led_cyclic_handler(intptr_t exinf); +#ifdef __cplusplus +} +#endif +void Error_Handler(); +#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.c new file mode 100644 index 0000000..41ef1da --- /dev/null +++ b/workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.c @@ -0,0 +1,24 @@ +#include "autosar_os_ext_asp3_user_config.h" + +const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), + AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), +}; + +const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) +{ + return autosar_os_ext_flag_user_map; +} + +int cmsis_get_flag_user_num(void) +{ + return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; +} diff --git a/workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.h new file mode 100644 index 0000000..7ad08bf --- /dev/null +++ b/workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.h @@ -0,0 +1,10 @@ +#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ + +#include "cmsis_config_utl.h" + +#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) + +extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; + +#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_string_eval/config/autosar_os_ext_user_config.c b/workspace/echoreply_string_eval/config/autosar_os_ext_user_config.c new file mode 100644 index 0000000..940941b --- /dev/null +++ b/workspace/echoreply_string_eval/config/autosar_os_ext_user_config.c @@ -0,0 +1,75 @@ +#include "cmsis_os.h" +#include "autosar_os_ext_user_config.h" + +extern void tcpip_thread(void *arg); +extern void ethernetif_set_link(void* argument); +extern void ethernetif_input(void* argument); +extern void callHbPubFunc(void *arg); +extern void callHbSubFunc(void *arg); +extern void StartDefaultTask(void * argument); +extern void callWriterThreadFunction(void *arg); +extern void callReaderThreadFunction(void *arg); +extern void callRunBroadcast(void *args); +extern void mros2_init(void *args); + + +UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { + { + .taskID = AutosarOsExtTcpTask, + .func = tcpip_thread, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthIfLinkTask, + .func = ethernetif_set_link, + .argument = NULL, + }, + { + .taskID = AutosarOsExtEthInputTask, + .func = ethernetif_input, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBPubTask, + .func = callHbPubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtHBSubTask, + .func = callHbSubFunc, + .argument = NULL, + }, + { + .taskID = AutosarOsExtSPDPTask, + .func = callRunBroadcast, + .argument = NULL, + }, + { + .taskID = AutosarOsExtWriterTask, + .func = callWriterThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtReaderTask, + .func = callReaderThreadFunction, + .argument = NULL, + }, + { + .taskID = AutosarOsExtMROS2Task, + .func = mros2_init, + .argument = NULL, + }, +}; + +UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) +{ + return user_thread_autosar_ostask_map; +} +int cmsis_get_app_heap_size(void) +{ + return APP_HEAP_SIZE; +} +int cmsis_get_user_thread_num(void) +{ + return USER_THREAD_NUM; +} diff --git a/workspace/echoreply_string_eval/config/autosar_os_ext_user_config.h b/workspace/echoreply_string_eval/config/autosar_os_ext_user_config.h new file mode 100644 index 0000000..bab78d3 --- /dev/null +++ b/workspace/echoreply_string_eval/config/autosar_os_ext_user_config.h @@ -0,0 +1,22 @@ +#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ +#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ + +#include "cmsis_os.h" +#include "cmsis_config_utl.h" + +/*********************************************** + * + * MEMORY + * + ***********************************************/ +#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ + + +/*********************************************** + * + * THREAD + * + ***********************************************/ +#define USER_THREAD_NUM 9U + +#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_string_eval/config/mros2_user_config.c b/workspace/echoreply_string_eval/config/mros2_user_config.c new file mode 100644 index 0000000..7d2c110 --- /dev/null +++ b/workspace/echoreply_string_eval/config/mros2_user_config.c @@ -0,0 +1,10 @@ + + +#define SUB_MSG_COUNT 10 + +int mros2_get_submsg_count(void) +{ + return SUB_MSG_COUNT; +} + + diff --git a/workspace/echoreply_string_eval/config/task.cfg b/workspace/echoreply_string_eval/config/task.cfg new file mode 100644 index 0000000..f577110 --- /dev/null +++ b/workspace/echoreply_string_eval/config/task.cfg @@ -0,0 +1,24 @@ +#include "task_impl.h" + +CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); +CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); +CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); +CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); +CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); +CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); +CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); +CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); +CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); +CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); + +CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); +CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_string_eval/task_impl.c b/workspace/echoreply_string_eval/task_impl.c new file mode 100644 index 0000000..afb9fca --- /dev/null +++ b/workspace/echoreply_string_eval/task_impl.c @@ -0,0 +1,126 @@ +#include "cmsis_os.h" +#include "cmsis_config_utl.h" +#include "task_impl.h" + +TASK(AutosarOsExtTcpTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthIfLinkTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} + +TASK(AutosarOsExtEthInputTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBPubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtHBSubTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtSPDPTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtWriterTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtReaderTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtUserDefaultTask) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} +TASK(AutosarOsExtMROS2Task) +{ + UserThreadAutosarOsTaskMapEntryType config; + StatusType ercd = AutosarOsTaskConfigGet(&config); + + if (ercd == E_OK) { + config.func(config.argument); + } + + (void)osThreadTerminate(NULL); + return; +} diff --git a/workspace/echoreply_string_eval/task_impl.h b/workspace/echoreply_string_eval/task_impl.h new file mode 100644 index 0000000..11e7a81 --- /dev/null +++ b/workspace/echoreply_string_eval/task_impl.h @@ -0,0 +1,54 @@ +#ifndef _AUTOSAR_OS_EXT_TEST_H_ +#define _AUTOSAR_OS_EXT_TEST_H_ + +#include "cmsis_config_utl.h" + +extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); +extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); + +/* + * priorities of mROS 2 tasks for RTPS + * + * TODO: We assigned relatevely lower priorities for EthIfLinkTask and + * EthInputTask than the application. Check whether these are appropriate. + */ +#define MROS2_HIGH_PRIORITY MAIN_PRIORITY +#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 + +/* + * experimental: stack size of mROS 2 tasks for RTPS + * Each comment refers the location of original definition + */ +// application/include/lwipopt.h +// #define TCPIP_THREAD_STACKSIZE 1024 +#define MROS2_STACK_SIZE_TcpTask 1024 +// application/src/lwip.c +// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) +#define MROS2_STACK_SIZE_EthIfLinkTask 1024 +// application/src/ethernet.c +// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) +#define MROS2_STACK_SIZE_EthInputTask 350 +// embeddedRTPS/include/config.h +// const int HEARTBEAT_STACKSIZE = 1200; // byte +#define MROS2_STACK_SIZE_HBPubTask 1200 +#define MROS2_STACK_SIZE_HBSubTask 1200 +// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte +#define MROS2_STACK_SIZE_SPDPTask 550 +// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte +#define MROS2_STACK_SIZE_WriterTask 1100 +// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte +#define MROS2_STACK_SIZE_ReaderTask 1600 +// embeddedRTPS-STM32/stm32/Src/main.cpp +// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); +#define MROS2_STACK_SIZE_UserDefaultTask 250 + + +#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/echoreply_string_eval/templates.hpp b/workspace/echoreply_string_eval/templates.hpp new file mode 100644 index 0000000..780d817 --- /dev/null +++ b/workspace/echoreply_string_eval/templates.hpp @@ -0,0 +1,11 @@ + +#include "std_msgs/msg/string.hpp" + + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::String &msg); + + + +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::String*)); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); From 314170eb3a20cc7b71011ae46053a5ddbd573ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 22 Jan 2022 13:45:28 +0900 Subject: [PATCH 62/80] dummy --- workspace/echoreply_twist/app.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/workspace/echoreply_twist/app.cpp b/workspace/echoreply_twist/app.cpp index fc1be76..7df6707 100644 --- a/workspace/echoreply_twist/app.cpp +++ b/workspace/echoreply_twist/app.cpp @@ -1,5 +1,6 @@ #include "app.h" #include "mros2.h" +#include #include "geometry_msgs/msg/twist.hpp" #include "stm32f7xx_nucleo_144.h" @@ -7,9 +8,24 @@ mros2::Subscriber sub; mros2::Publisher pub; +std::array timeArr; +uint32_t count = 0; + void userCallback(geometry_msgs::msg::Twist *msg) { - pub.publish(*msg); + if (count == 200){ + for (int i=0;i<200;i++){ + MROS2_INFO("%lu", timeArr[i]); + dly_tsk(1000); + } + MROS2_INFO("----------------"); + } else if (count > 200){ + + } else { + timeArr[count] = fch_hrt(); + pub.publish(*msg); + count++; + } } int main(int argc, char * argv[]) From 4390012808e1fc5f405a40b5045ae730760a35c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sun, 13 Feb 2022 15:42:23 +0900 Subject: [PATCH 63/80] Commit for v0.2.4 release --- workspace/Makefile | 1 + workspace/README.md | 13 +- .../geometry_msgs/msg_settings.json | 2 +- .../custom_msgs/health_msgs/msg/Health.msg | 3 - .../custom_msgs/health_msgs/msg_settings.json | 5 - .../custom_msgs/mix_msgs/msg/IntVector3.msg | 1 - workspace/custom_msgs/mix_msgs/msg/Mix.msg | 5 - .../custom_msgs/mix_msgs/msg_settings.json | 5 - .../custom_msgs/nav_msgs/msg_settings.json | 2 +- .../custom_msgs/sensor_msgs/msg_settings.json | 2 +- workspace/custom_msgs/shape_msgs/msg/Mesh.msg | 2 - .../shape_msgs/msg/MeshTriangle.msg | 1 - .../custom_msgs/shape_msgs/msg_settings.json | 5 - workspace/echoreply_header/README.md | 21 ++- workspace/echoreply_header/app.cpp | 4 +- workspace/echoreply_health/Makefile.inc | 27 ---- workspace/echoreply_health/README.md | 39 ------ workspace/echoreply_health/app.cdl | 122 ----------------- workspace/echoreply_health/app.cfg | 14 -- workspace/echoreply_health/app.cpp | 44 ------ workspace/echoreply_health/app.h | 84 ------------ .../config/autosar_os_ext_asp3_user_config.c | 24 ---- .../config/autosar_os_ext_asp3_user_config.h | 10 -- .../config/autosar_os_ext_user_config.c | 75 ----------- .../config/autosar_os_ext_user_config.h | 22 --- .../config/mros2_user_config.c | 10 -- workspace/echoreply_health/config/task.cfg | 24 ---- workspace/echoreply_health/task_impl.c | 126 ------------------ workspace/echoreply_health/task_impl.h | 54 -------- workspace/echoreply_joint_state/README.md | 94 +++++-------- workspace/echoreply_mesh/Makefile.inc | 27 ---- workspace/echoreply_mesh/README.md | 68 ---------- workspace/echoreply_mesh/app.cdl | 122 ----------------- workspace/echoreply_mesh/app.cfg | 14 -- workspace/echoreply_mesh/app.cpp | 44 ------ workspace/echoreply_mesh/app.h | 84 ------------ .../config/autosar_os_ext_asp3_user_config.c | 24 ---- .../config/autosar_os_ext_asp3_user_config.h | 10 -- .../config/autosar_os_ext_user_config.c | 75 ----------- .../config/autosar_os_ext_user_config.h | 22 --- .../echoreply_mesh/config/mros2_user_config.c | 10 -- workspace/echoreply_mesh/config/task.cfg | 24 ---- workspace/echoreply_mesh/task_impl.c | 126 ------------------ workspace/echoreply_mesh/task_impl.h | 54 -------- workspace/echoreply_mesh/templates.hpp | 11 -- workspace/echoreply_mix/Makefile.inc | 27 ---- workspace/echoreply_mix/README.md | 68 ---------- workspace/echoreply_mix/app.cdl | 122 ----------------- workspace/echoreply_mix/app.cfg | 14 -- workspace/echoreply_mix/app.cpp | 44 ------ workspace/echoreply_mix/app.h | 84 ------------ .../config/autosar_os_ext_asp3_user_config.c | 24 ---- .../config/autosar_os_ext_asp3_user_config.h | 10 -- .../config/autosar_os_ext_user_config.c | 75 ----------- .../config/autosar_os_ext_user_config.h | 22 --- .../echoreply_mix/config/mros2_user_config.c | 10 -- workspace/echoreply_mix/config/task.cfg | 24 ---- workspace/echoreply_mix/task_impl.c | 126 ------------------ workspace/echoreply_mix/task_impl.h | 54 -------- workspace/echoreply_mix/templates.hpp | 11 -- workspace/echoreply_odometry/README.md | 93 +++++-------- workspace/echoreply_odometry/app.cpp | 4 +- workspace/echoreply_string_eval/Makefile.inc | 27 ---- workspace/echoreply_string_eval/README.md | 24 ---- workspace/echoreply_string_eval/app.cdl | 122 ----------------- workspace/echoreply_string_eval/app.cfg | 14 -- workspace/echoreply_string_eval/app.cpp | 42 ------ workspace/echoreply_string_eval/app.h | 84 ------------ .../config/autosar_os_ext_asp3_user_config.c | 24 ---- .../config/autosar_os_ext_asp3_user_config.h | 10 -- .../config/autosar_os_ext_user_config.c | 75 ----------- .../config/autosar_os_ext_user_config.h | 22 --- .../config/mros2_user_config.c | 10 -- .../echoreply_string_eval/config/task.cfg | 24 ---- workspace/echoreply_string_eval/task_impl.c | 126 ------------------ workspace/echoreply_string_eval/task_impl.h | 54 -------- workspace/echoreply_string_eval/templates.hpp | 11 -- workspace/echoreply_twist/README.md | 99 ++++++-------- workspace/echoreply_twist/app.cpp | 20 +-- workspace/echoreply_twist_string/Makefile.inc | 27 ---- workspace/echoreply_twist_string/README.md | 68 ---------- workspace/echoreply_twist_string/app.cdl | 122 ----------------- workspace/echoreply_twist_string/app.cfg | 14 -- workspace/echoreply_twist_string/app.cpp | 79 ----------- workspace/echoreply_twist_string/app.h | 84 ------------ .../config/autosar_os_ext_asp3_user_config.c | 24 ---- .../config/autosar_os_ext_asp3_user_config.h | 10 -- .../config/autosar_os_ext_user_config.c | 75 ----------- .../config/autosar_os_ext_user_config.h | 22 --- .../config/mros2_user_config.c | 10 -- .../echoreply_twist_string/config/task.cfg | 24 ---- workspace/echoreply_twist_string/task_impl.c | 126 ------------------ workspace/echoreply_twist_string/task_impl.h | 54 -------- .../echoreply_twist_string/templates.hpp | 11 -- workspace/echoreply_uint16/app.cpp | 7 +- 95 files changed, 144 insertions(+), 3769 deletions(-) delete mode 100644 workspace/custom_msgs/health_msgs/msg/Health.msg delete mode 100644 workspace/custom_msgs/health_msgs/msg_settings.json delete mode 100644 workspace/custom_msgs/mix_msgs/msg/IntVector3.msg delete mode 100644 workspace/custom_msgs/mix_msgs/msg/Mix.msg delete mode 100644 workspace/custom_msgs/mix_msgs/msg_settings.json delete mode 100644 workspace/custom_msgs/shape_msgs/msg/Mesh.msg delete mode 100644 workspace/custom_msgs/shape_msgs/msg/MeshTriangle.msg delete mode 100644 workspace/custom_msgs/shape_msgs/msg_settings.json delete mode 100644 workspace/echoreply_health/Makefile.inc delete mode 100644 workspace/echoreply_health/README.md delete mode 100644 workspace/echoreply_health/app.cdl delete mode 100644 workspace/echoreply_health/app.cfg delete mode 100644 workspace/echoreply_health/app.cpp delete mode 100644 workspace/echoreply_health/app.h delete mode 100644 workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.c delete mode 100644 workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.h delete mode 100644 workspace/echoreply_health/config/autosar_os_ext_user_config.c delete mode 100644 workspace/echoreply_health/config/autosar_os_ext_user_config.h delete mode 100644 workspace/echoreply_health/config/mros2_user_config.c delete mode 100644 workspace/echoreply_health/config/task.cfg delete mode 100644 workspace/echoreply_health/task_impl.c delete mode 100644 workspace/echoreply_health/task_impl.h delete mode 100644 workspace/echoreply_mesh/Makefile.inc delete mode 100644 workspace/echoreply_mesh/README.md delete mode 100644 workspace/echoreply_mesh/app.cdl delete mode 100644 workspace/echoreply_mesh/app.cfg delete mode 100644 workspace/echoreply_mesh/app.cpp delete mode 100644 workspace/echoreply_mesh/app.h delete mode 100644 workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.c delete mode 100644 workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.h delete mode 100644 workspace/echoreply_mesh/config/autosar_os_ext_user_config.c delete mode 100644 workspace/echoreply_mesh/config/autosar_os_ext_user_config.h delete mode 100644 workspace/echoreply_mesh/config/mros2_user_config.c delete mode 100644 workspace/echoreply_mesh/config/task.cfg delete mode 100644 workspace/echoreply_mesh/task_impl.c delete mode 100644 workspace/echoreply_mesh/task_impl.h delete mode 100644 workspace/echoreply_mesh/templates.hpp delete mode 100644 workspace/echoreply_mix/Makefile.inc delete mode 100644 workspace/echoreply_mix/README.md delete mode 100644 workspace/echoreply_mix/app.cdl delete mode 100644 workspace/echoreply_mix/app.cfg delete mode 100644 workspace/echoreply_mix/app.cpp delete mode 100644 workspace/echoreply_mix/app.h delete mode 100644 workspace/echoreply_mix/config/autosar_os_ext_asp3_user_config.c delete mode 100644 workspace/echoreply_mix/config/autosar_os_ext_asp3_user_config.h delete mode 100644 workspace/echoreply_mix/config/autosar_os_ext_user_config.c delete mode 100644 workspace/echoreply_mix/config/autosar_os_ext_user_config.h delete mode 100644 workspace/echoreply_mix/config/mros2_user_config.c delete mode 100644 workspace/echoreply_mix/config/task.cfg delete mode 100644 workspace/echoreply_mix/task_impl.c delete mode 100644 workspace/echoreply_mix/task_impl.h delete mode 100644 workspace/echoreply_mix/templates.hpp delete mode 100644 workspace/echoreply_string_eval/Makefile.inc delete mode 100644 workspace/echoreply_string_eval/README.md delete mode 100644 workspace/echoreply_string_eval/app.cdl delete mode 100644 workspace/echoreply_string_eval/app.cfg delete mode 100644 workspace/echoreply_string_eval/app.cpp delete mode 100644 workspace/echoreply_string_eval/app.h delete mode 100644 workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.c delete mode 100644 workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.h delete mode 100644 workspace/echoreply_string_eval/config/autosar_os_ext_user_config.c delete mode 100644 workspace/echoreply_string_eval/config/autosar_os_ext_user_config.h delete mode 100644 workspace/echoreply_string_eval/config/mros2_user_config.c delete mode 100644 workspace/echoreply_string_eval/config/task.cfg delete mode 100644 workspace/echoreply_string_eval/task_impl.c delete mode 100644 workspace/echoreply_string_eval/task_impl.h delete mode 100644 workspace/echoreply_string_eval/templates.hpp delete mode 100644 workspace/echoreply_twist_string/Makefile.inc delete mode 100644 workspace/echoreply_twist_string/README.md delete mode 100644 workspace/echoreply_twist_string/app.cdl delete mode 100644 workspace/echoreply_twist_string/app.cfg delete mode 100644 workspace/echoreply_twist_string/app.cpp delete mode 100644 workspace/echoreply_twist_string/app.h delete mode 100644 workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.c delete mode 100644 workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.h delete mode 100644 workspace/echoreply_twist_string/config/autosar_os_ext_user_config.c delete mode 100644 workspace/echoreply_twist_string/config/autosar_os_ext_user_config.h delete mode 100644 workspace/echoreply_twist_string/config/mros2_user_config.c delete mode 100644 workspace/echoreply_twist_string/config/task.cfg delete mode 100644 workspace/echoreply_twist_string/task_impl.c delete mode 100644 workspace/echoreply_twist_string/task_impl.h delete mode 100644 workspace/echoreply_twist_string/templates.hpp diff --git a/workspace/Makefile b/workspace/Makefile index 1ff731b..9a3fbcd 100644 --- a/workspace/Makefile +++ b/workspace/Makefile @@ -6,6 +6,7 @@ BUILDSPACE := build BOARDNAME := NODE_F767ZI # this BOARDPATH is for MAC OS (not for Linux) BOARDPATH := /Volumes/${BOARDNAME} +# BOARDPATH for for Linux is -> BOARDPATH := /media/${USER}/${BOARDNAME} MSGDIR := custom_msgs/${msg} MROS2DIR := ../mros2 diff --git a/workspace/README.md b/workspace/README.md index 291b33e..df8a5cc 100644 --- a/workspace/README.md +++ b/workspace/README.md @@ -32,13 +32,24 @@ Please also check [mROS-base/mros2-host-examples](https://github.com/mROS-base/m - Description: - The mROS 2 node on the embedded board subscribes `float32` (`std_msgs::msg::Float32`) message from `/to_stm` topic. - And then publishes this `float32` message as it is to `/to_linux` as the reply. - - Note that this application just print whether the value of message is less than 0.0, between 0.0 and 1.0, or greater than 1.0, since TOPPERS/ASP3 kernel cannot print float value. + - Note that this application just print whether the value of message is between 5.0 and 10.0 or not, since TOPPERS/ASP3 kernel cannot print float value. - Host operation: - `$ ros2 launch mros2_echoback_float32 launch.py` - or, at two terminals: - `$ ros2 run mros2_echoback_float32 pub_node` - `$ ros2 run mros2_echoback_float32 sub_node` +## echoreply_header + +- Description: + - The mROS 2 node on the embedded board subscribes `header` (`std_msgs::msg::Header`) message from `/to_stm` topic. + - And then publishes this `header` message as it is to `/to_linux` as the reply. +- Host operation: + - `$ ros2 launch mros2_echoback_header launch.py` + - or, at two terminals: + - `$ ros2 run mros2_echoback_header pub_node` + - `$ ros2 run mros2_echoback_header sub_node` + ## pub_string - Description: diff --git a/workspace/custom_msgs/geometry_msgs/msg_settings.json b/workspace/custom_msgs/geometry_msgs/msg_settings.json index c1c9767..9ca81af 100644 --- a/workspace/custom_msgs/geometry_msgs/msg_settings.json +++ b/workspace/custom_msgs/geometry_msgs/msg_settings.json @@ -1,5 +1,5 @@ { - "includingMsgs": [ + "pubsubMsgs": [ "geometry_msgs/msg/Twist.msg" ] } \ No newline at end of file diff --git a/workspace/custom_msgs/health_msgs/msg/Health.msg b/workspace/custom_msgs/health_msgs/msg/Health.msg deleted file mode 100644 index b22ff81..0000000 --- a/workspace/custom_msgs/health_msgs/msg/Health.msg +++ /dev/null @@ -1,3 +0,0 @@ -string name -uint16 height -float32 weight \ No newline at end of file diff --git a/workspace/custom_msgs/health_msgs/msg_settings.json b/workspace/custom_msgs/health_msgs/msg_settings.json deleted file mode 100644 index a90982f..0000000 --- a/workspace/custom_msgs/health_msgs/msg_settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "includingMsgs": [ - "health_msgs/msg/Health.msg" - ] -} \ No newline at end of file diff --git a/workspace/custom_msgs/mix_msgs/msg/IntVector3.msg b/workspace/custom_msgs/mix_msgs/msg/IntVector3.msg deleted file mode 100644 index a41d4da..0000000 --- a/workspace/custom_msgs/mix_msgs/msg/IntVector3.msg +++ /dev/null @@ -1 +0,0 @@ -geometry_msgs/msg/Vector3 vec3 \ No newline at end of file diff --git a/workspace/custom_msgs/mix_msgs/msg/Mix.msg b/workspace/custom_msgs/mix_msgs/msg/Mix.msg deleted file mode 100644 index fc1507e..0000000 --- a/workspace/custom_msgs/mix_msgs/msg/Mix.msg +++ /dev/null @@ -1,5 +0,0 @@ -string name -mix_msgs/msg/IntVector3 vec3 -uint16 height -float32 weight -float64[8] array \ No newline at end of file diff --git a/workspace/custom_msgs/mix_msgs/msg_settings.json b/workspace/custom_msgs/mix_msgs/msg_settings.json deleted file mode 100644 index 6a6faf5..0000000 --- a/workspace/custom_msgs/mix_msgs/msg_settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "includingMsgs": [ - "mix_msgs/msg/Mix.msg" - ] -} \ No newline at end of file diff --git a/workspace/custom_msgs/nav_msgs/msg_settings.json b/workspace/custom_msgs/nav_msgs/msg_settings.json index dff18d6..150c6eb 100644 --- a/workspace/custom_msgs/nav_msgs/msg_settings.json +++ b/workspace/custom_msgs/nav_msgs/msg_settings.json @@ -1,5 +1,5 @@ { - "includingMsgs": [ + "pubsubMsgs": [ "nav_msgs/msg/Odometry.msg" ] } \ No newline at end of file diff --git a/workspace/custom_msgs/sensor_msgs/msg_settings.json b/workspace/custom_msgs/sensor_msgs/msg_settings.json index b13ce1a..58b7a6d 100644 --- a/workspace/custom_msgs/sensor_msgs/msg_settings.json +++ b/workspace/custom_msgs/sensor_msgs/msg_settings.json @@ -1,5 +1,5 @@ { - "includingMsgs": [ + "pubsubMsgs": [ "sensor_msgs/msg/JointState.msg" ] } \ No newline at end of file diff --git a/workspace/custom_msgs/shape_msgs/msg/Mesh.msg b/workspace/custom_msgs/shape_msgs/msg/Mesh.msg deleted file mode 100644 index 1f36e2f..0000000 --- a/workspace/custom_msgs/shape_msgs/msg/Mesh.msg +++ /dev/null @@ -1,2 +0,0 @@ -shape_msgs/msg/MeshTriangle[] triangles -geometry_msgs/msg/Point[] vertices \ No newline at end of file diff --git a/workspace/custom_msgs/shape_msgs/msg/MeshTriangle.msg b/workspace/custom_msgs/shape_msgs/msg/MeshTriangle.msg deleted file mode 100644 index 35b1b4d..0000000 --- a/workspace/custom_msgs/shape_msgs/msg/MeshTriangle.msg +++ /dev/null @@ -1 +0,0 @@ -uint32[3] vertex_indices \ No newline at end of file diff --git a/workspace/custom_msgs/shape_msgs/msg_settings.json b/workspace/custom_msgs/shape_msgs/msg_settings.json deleted file mode 100644 index d82adce..0000000 --- a/workspace/custom_msgs/shape_msgs/msg_settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "includingMsgs": [ - "shape_msgs/msg/MeshTriangle.msg" - ] -} \ No newline at end of file diff --git a/workspace/echoreply_header/README.md b/workspace/echoreply_header/README.md index 6ae2132..b3b268b 100644 --- a/workspace/echoreply_header/README.md +++ b/workspace/echoreply_header/README.md @@ -1,24 +1,19 @@ -### string型通信動作確認用アプリ +### header型通信動作確認用アプリ -string型の通信の動作確認をするためのサンプルアプリです。 +header型の通信の動作確認をするためのサンプルアプリです。 以下の手順で確認できます。 -1.workspaceディレクトリにて、`make app=echoreply_string` によりアプリをビルド +1.workspaceディレクトリにて、`make app=echoreply_header` によりアプリをビルド 2.Serial Console (picocomなど) を立ち上げて、初期化 -3.hostのros2アプリからstring型のmessageを送信 +3.hostのros2アプリからheader型のmessageを送信 4.messageを受信、これを再びhostのros2アプリに向かって送信 (以下) ``` -Subscribed msg : Hello, world! 1 -Publishing msg : Hello, world! 1 -Subscribed msg : Hello, world! 2 -Publishing msg : Hello, world! 2 -Subscribed msg : Hello, world! 3 -Publishing msg : Hello, world! 3 -Subscribed msg : Hello, world! 4 -Publishing msg : Hello, world! 4 -... +subscribed msg!! +publishing msg!! +subscribed msg!! +publishing msg!! ``` diff --git a/workspace/echoreply_header/app.cpp b/workspace/echoreply_header/app.cpp index e43cdc2..18a8863 100644 --- a/workspace/echoreply_header/app.cpp +++ b/workspace/echoreply_header/app.cpp @@ -9,8 +9,8 @@ mros2::Publisher pub; void userCallback(std_msgs::msg::Header *msg) { - MROS2_INFO("subscribed msg!"); - MROS2_INFO("publishing msg!"); + MROS2_INFO("subscribed msg!!"); + MROS2_INFO("publishing msg!!"); pub.publish(*msg); } diff --git a/workspace/echoreply_health/Makefile.inc b/workspace/echoreply_health/Makefile.inc deleted file mode 100644 index f807ac1..0000000 --- a/workspace/echoreply_health/Makefile.inc +++ /dev/null @@ -1,27 +0,0 @@ -# -# Makefile definition for mros2 application -# - -# name of main application -APPLNAME = app - -# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) -# NOTE: also check `initLogMask` in app.cdl for syslog setting -CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 - -# information for directory tree -APPLDIR := $(APPDIR) -APPLDIR += $(APPDIR)/config - -# link option for C++ code -SRCLANG = c++ -APPL_CXXLIBS += -specs=nano.specs - -# compile switch -CDEFS += -DUSE_ASP3_FOR_STM - -# additional files for configuration -APPL_COBJS := task_impl.o -APPL_COBJS += autosar_os_ext_user_config.o -APPL_COBJS += autosar_os_ext_asp3_user_config.o -APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_health/README.md b/workspace/echoreply_health/README.md deleted file mode 100644 index 4431607..0000000 --- a/workspace/echoreply_health/README.md +++ /dev/null @@ -1,39 +0,0 @@ -### health型通信動作確認用アプリ - -health型の通信の動作確認をするためのサンプルアプリです。 -health型とは、string, uint16, float32型の組み合わせからなるメッセージ型です。 -以下の手順で確認できます。 - -1.workspace/custom_msgsで、health_msgs/msg/Health.msgを作成し、そこに以下のようにROS2の.msgファイルと同様の形式でhealth型を定義する - ``` - string name - uint16 height - float32 weight - ``` - -2.health_msgs内にmsg_settings.jsonを作成し、以下のように書き込む -``` - { - "includingMsgs": [ - [ - "health_msgs/msg/Health.msg" - ] - ] - } -``` - -3.workspaceディレクトリにて、`make gen-msg msg=health_msgs` によりhealth.hppを生成する - -4.mros2-asp3-f767ziディレクトリにmros2_msgs/health_msgs/msg/health.hppが生成されていることを確認 - -5.echoreply_healthアプリ内で、生成したhealth.hppをincludeして使用する。 - -6.workspaceディレクトリにて、`make app=echoreply_health` によりアプリをビルド - -7.Serial Console (picocomなど) を立ち上げて、初期化 - -8.hostのros2アプリからhealth型のmessageを送信 - -9.messageを受信、これを再びhostのros2アプリに向かって送信 - -10.host側で、publishしたメッセージとsubscribeしたメッセージが一致していることを確認 \ No newline at end of file diff --git a/workspace/echoreply_health/app.cdl b/workspace/echoreply_health/app.cdl deleted file mode 100644 index 176c5a6..0000000 --- a/workspace/echoreply_health/app.cdl +++ /dev/null @@ -1,122 +0,0 @@ -/* - * サンプルプログラム(1)のコンポーネント記述ファイル - * - * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ - */ -/* - * カーネルオブジェクトの定義 - */ -import(); - -/* - * ターゲット非依存のセルタイプの定義 - */ -import("syssvc/tSerialPort.cdl"); -import("syssvc/tSerialAdapter.cdl"); -import("syssvc/tSysLog.cdl"); -import("syssvc/tSysLogAdapter.cdl"); -import("syssvc/tLogTask.cdl"); -import("syssvc/tBanner.cdl"); - -/* - * ターゲット依存部の取り込み - */ -import("target.cdl"); - -/* - * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" - * の行までのことを言う. - */ - -/* - * システムログ機能のアダプタの組上げ記述 - * - * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー - * スのシステムログ機能を呼び出すためのセルである.システムログ機能の - * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び - * 出さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSysLogAdapter SysLogAdapter { - cSysLog = SysLog.eSysLog; -}; - -/* - * シリアルインタフェースドライバのアダプタの組上げ記述 - * - * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー - * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための - * セルである.シリアルインタフェースドライバのサービスコールを呼び出 - * さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSerialAdapter SerialAdapter { - cSerialPort[0] = SerialPort1.eSerialPort; -}; - -/* - * システムログ機能の組上げ記述 - * - * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ - * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, - * システムログタスクはシステムログ機能を使用するため,それも外すこと - * が必要である.また,システムログ機能のアダプタも外さなければならな - * い.tecsgenが警告メッセージを出すが,無視してよい. - */ -cell tSysLog SysLog { - logBufferSize = 32; /* ログバッファのサイズ */ - initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); - /* ログバッファに記録すべき重要度 */ - initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); - /* 低レベル出力すべき重要度 */ - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * シリアルインタフェースドライバの組上げ記述 - * - * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 - * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー - * スドライバを使用するため,それも外すことが必要である.また,シリア - * ルインタフェースドライバのアダプタも外さなければならない. - */ -cell tSerialPort SerialPort1 { - receiveBufferSize = 256; /* 受信バッファのサイズ */ - sendBufferSize = 256; /* 送信バッファのサイズ */ - - /* ターゲット依存部との結合 */ - cSIOPort = SIOPortTarget1.eSIOPort; - eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ -}; - -/* - * システムログタスクの組上げ記述 - * - * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ - * ばよい. - */ -cell tLogTask LogTask { - priority = 3; /* システムログタスクの優先度 */ - stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ - - /* シリアルインタフェースドライバとの結合 */ - cSerialPort = SerialPort1.eSerialPort; - cnSerialPortManage = SerialPort1.enSerialPortManage; - - /* システムログ機能との結合 */ - cSysLog = SysLog.eSysLog; - - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * カーネル起動メッセージ出力の組上げ記述 - * - * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 - * を削除すればよい. - */ -cell tBanner Banner { - /* 属性の設定 */ - targetName = BannerTargetName; - copyrightNotice = BannerCopyrightNotice; -}; diff --git a/workspace/echoreply_health/app.cfg b/workspace/echoreply_health/app.cfg deleted file mode 100644 index eb0495d..0000000 --- a/workspace/echoreply_health/app.cfg +++ /dev/null @@ -1,14 +0,0 @@ -/* - * サンプルプログラム(1)のシステムコンフィギュレーションファイル - */ -INCLUDE("tecsgen.cfg"); -INCLUDE("asp3ext.cfg"); -INCLUDE("task.cfg"); - -#include "app.h" -#include "stm32f7xx_it.h" -CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); -CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); -CFG_INT(77, {TA_EDGE, -4}); - -CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_health/app.cpp b/workspace/echoreply_health/app.cpp deleted file mode 100644 index 18d2e5b..0000000 --- a/workspace/echoreply_health/app.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "app.h" -#include "mros2.h" -#include "health_msgs/msg/health.hpp" - -#include "stm32f7xx_nucleo_144.h" - -mros2::Subscriber sub; -mros2::Publisher pub; - -void userCallback(health_msgs::msg::Health *msg) -{ - MROS2_INFO("subscribed msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); - MROS2_INFO("publishing msg: { name: '%s', height: %u cm, weight: %f kg }", msg->name.c_str(), msg->height, msg->weight); - pub.publish(*msg); -} - -int main(int argc, char * argv[]) -{ - MROS2_INFO("mROS 2 application is started"); - - mros2::init(argc, argv); - MROS2_DEBUG("mROS 2 initialization is completed"); - BSP_LED_Toggle(LED1); - - mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - health_msgs::msg::Health msg; - - MROS2_INFO("ready to pub/sub message"); - mros2::spin(); - BSP_LED_Toggle(LED3); -} - -void main_task(void) -{ - main(0, NULL); -} - -void -led_cyclic_handler(intptr_t exinf) -{ - BSP_LED_Toggle(LED2); -} \ No newline at end of file diff --git a/workspace/echoreply_health/app.h b/workspace/echoreply_health/app.h deleted file mode 100644 index 36eb6cf..0000000 --- a/workspace/echoreply_health/app.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * TOPPERS/ASP Kernel - * Toyohashi Open Platform for Embedded Real-Time Systems/ - * Advanced Standard Profile Kernel - * - * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory - * Toyohashi Univ. of Technology, JAPAN - * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory - * Graduate School of Information Science, Nagoya Univ., JAPAN - * - * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ - * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 - * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. - * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 - * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー - * スコード中に含まれていること. - * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 - * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 - * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 - * の無保証規定を掲載すること. - * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 - * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ - * と. - * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 - * 作権表示,この利用条件および下記の無保証規定を掲載すること. - * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに - * 報告すること. - * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 - * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. - * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 - * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを - * 免責すること. - * - * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お - * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 - * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ - * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ - * の責任を負わない. - * - * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ - */ - -/* - * header file for the mros2 application - */ - -#include - -/* - * Priorities for TOPPERS tasks - */ - -#define MAIN_PRIORITY 5 - -#define HIGH_PRIORITY 9 -#define MID_PRIORITY 10 -#define LOW_PRIORITY 11 - -/* - * Constants that may depend on the target - */ - -#ifndef TASK_PORTID -#define TASK_PORTID 1 -#endif /* TASK_PORTID */ - -#ifndef STACK_SIZE -#define STACK_SIZE 4096 -#endif /* STACK_SIZE */ - -/* - * Declaration of prototyle functions - */ -#ifndef TOPPERS_MACRO_ONLY -#ifdef __cplusplus -extern "C" { -#endif -void main_task(void); -extern void led_cyclic_handler(intptr_t exinf); -#ifdef __cplusplus -} -#endif -void Error_Handler(); -#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.c deleted file mode 100644 index 41ef1da..0000000 --- a/workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "autosar_os_ext_asp3_user_config.h" - -const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), -}; - -const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) -{ - return autosar_os_ext_flag_user_map; -} - -int cmsis_get_flag_user_num(void) -{ - return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; -} diff --git a/workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.h deleted file mode 100644 index 7ad08bf..0000000 --- a/workspace/echoreply_health/config/autosar_os_ext_asp3_user_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ - -#include "cmsis_config_utl.h" - -#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) - -extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; - -#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_health/config/autosar_os_ext_user_config.c b/workspace/echoreply_health/config/autosar_os_ext_user_config.c deleted file mode 100644 index 940941b..0000000 --- a/workspace/echoreply_health/config/autosar_os_ext_user_config.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "cmsis_os.h" -#include "autosar_os_ext_user_config.h" - -extern void tcpip_thread(void *arg); -extern void ethernetif_set_link(void* argument); -extern void ethernetif_input(void* argument); -extern void callHbPubFunc(void *arg); -extern void callHbSubFunc(void *arg); -extern void StartDefaultTask(void * argument); -extern void callWriterThreadFunction(void *arg); -extern void callReaderThreadFunction(void *arg); -extern void callRunBroadcast(void *args); -extern void mros2_init(void *args); - - -UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { - { - .taskID = AutosarOsExtTcpTask, - .func = tcpip_thread, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthIfLinkTask, - .func = ethernetif_set_link, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthInputTask, - .func = ethernetif_input, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBPubTask, - .func = callHbPubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBSubTask, - .func = callHbSubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtSPDPTask, - .func = callRunBroadcast, - .argument = NULL, - }, - { - .taskID = AutosarOsExtWriterTask, - .func = callWriterThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtReaderTask, - .func = callReaderThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtMROS2Task, - .func = mros2_init, - .argument = NULL, - }, -}; - -UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) -{ - return user_thread_autosar_ostask_map; -} -int cmsis_get_app_heap_size(void) -{ - return APP_HEAP_SIZE; -} -int cmsis_get_user_thread_num(void) -{ - return USER_THREAD_NUM; -} diff --git a/workspace/echoreply_health/config/autosar_os_ext_user_config.h b/workspace/echoreply_health/config/autosar_os_ext_user_config.h deleted file mode 100644 index bab78d3..0000000 --- a/workspace/echoreply_health/config/autosar_os_ext_user_config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ - -#include "cmsis_os.h" -#include "cmsis_config_utl.h" - -/*********************************************** - * - * MEMORY - * - ***********************************************/ -#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ - - -/*********************************************** - * - * THREAD - * - ***********************************************/ -#define USER_THREAD_NUM 9U - -#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_health/config/mros2_user_config.c b/workspace/echoreply_health/config/mros2_user_config.c deleted file mode 100644 index 7d2c110..0000000 --- a/workspace/echoreply_health/config/mros2_user_config.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#define SUB_MSG_COUNT 10 - -int mros2_get_submsg_count(void) -{ - return SUB_MSG_COUNT; -} - - diff --git a/workspace/echoreply_health/config/task.cfg b/workspace/echoreply_health/config/task.cfg deleted file mode 100644 index f577110..0000000 --- a/workspace/echoreply_health/config/task.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#include "task_impl.h" - -CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); -CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); -CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); -CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); -CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); -CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); -CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); -CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); -CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); -CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); - -CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_health/task_impl.c b/workspace/echoreply_health/task_impl.c deleted file mode 100644 index afb9fca..0000000 --- a/workspace/echoreply_health/task_impl.c +++ /dev/null @@ -1,126 +0,0 @@ -#include "cmsis_os.h" -#include "cmsis_config_utl.h" -#include "task_impl.h" - -TASK(AutosarOsExtTcpTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthIfLinkTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthInputTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBPubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBSubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtSPDPTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtWriterTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtReaderTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtUserDefaultTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtMROS2Task) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} diff --git a/workspace/echoreply_health/task_impl.h b/workspace/echoreply_health/task_impl.h deleted file mode 100644 index 11e7a81..0000000 --- a/workspace/echoreply_health/task_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_TEST_H_ -#define _AUTOSAR_OS_EXT_TEST_H_ - -#include "cmsis_config_utl.h" - -extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); - -/* - * priorities of mROS 2 tasks for RTPS - * - * TODO: We assigned relatevely lower priorities for EthIfLinkTask and - * EthInputTask than the application. Check whether these are appropriate. - */ -#define MROS2_HIGH_PRIORITY MAIN_PRIORITY -#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 - -/* - * experimental: stack size of mROS 2 tasks for RTPS - * Each comment refers the location of original definition - */ -// application/include/lwipopt.h -// #define TCPIP_THREAD_STACKSIZE 1024 -#define MROS2_STACK_SIZE_TcpTask 1024 -// application/src/lwip.c -// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) -#define MROS2_STACK_SIZE_EthIfLinkTask 1024 -// application/src/ethernet.c -// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) -#define MROS2_STACK_SIZE_EthInputTask 350 -// embeddedRTPS/include/config.h -// const int HEARTBEAT_STACKSIZE = 1200; // byte -#define MROS2_STACK_SIZE_HBPubTask 1200 -#define MROS2_STACK_SIZE_HBSubTask 1200 -// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte -#define MROS2_STACK_SIZE_SPDPTask 550 -// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte -#define MROS2_STACK_SIZE_WriterTask 1100 -// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte -#define MROS2_STACK_SIZE_ReaderTask 1600 -// embeddedRTPS-STM32/stm32/Src/main.cpp -// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); -#define MROS2_STACK_SIZE_UserDefaultTask 250 - - -#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/echoreply_joint_state/README.md b/workspace/echoreply_joint_state/README.md index a6ee6cb..d745839 100644 --- a/workspace/echoreply_joint_state/README.md +++ b/workspace/echoreply_joint_state/README.md @@ -1,68 +1,44 @@ -### EmbeddedRTPS動作確認用アプリ +### JointState型通信動作確認用アプリ -EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 -利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 +JointState型の通信の動作確認をするためのサンプルアプリです。 +以下の手順で確認できます。 -#### LINUX側の準備 -1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします -``` -git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 -``` -2. 通信用アプリをビルドします -``` -cd embeddedRTPS-STM32 -cd linux -mkdir build -cd build -cmake -DTHIRDPARTY=ON .. -make -``` -3. PC上のファイヤウォールの設定を切ります +1.workspace/custom_msgsで、sensor_msgs/msg/JointState.msgを作成し、JointState型を定義する。 -#### STM側の設定 -1. IPアドレスを設定します。 -`application/src/lwip.c L69-L80` -``` - IP_ADDRESS[0] = 192; - IP_ADDRESS[1] = 168; - IP_ADDRESS[2] = 11; - IP_ADDRESS[3] = 2; - NETMASK_ADDRESS[0] = 255; - NETMASK_ADDRESS[1] = 255; - NETMASK_ADDRESS[2] = 255; - NETMASK_ADDRESS[3] = 0; - GATEWAY_ADDRESS[0] = 192; - GATEWAY_ADDRESS[1] = 168; - GATEWAY_ADDRESS[2] = 11; - GATEWAY_ADDRESS[3] = 1; - ``` -`embeddedRTPS/include/rtps/config.h L36-L37` + ``` + header header + string[] name + float64[] position + float64[] velocity + float64[] effort + ``` + +2.sensor_msgs内にmsg_settings.jsonを作成し、以下のように書き込む。今回通信に用いるのはJointState型なので、JointState型定義ファイルの場所を書き込む。 ``` -const std::array IP_ADDRESS = { - 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. + { + "pubsubMsgs": [ + "sensor_msgs/msg/JointState.msg" + ] + } ``` -2. 本アプリをビルドします -#### 実行 -1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します -2. ビルドしたlinuxのアプリを実行します -3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です -``` -Conducting new Test... -Send message to the STM32. -Received message from STM32 with len:10 -0 : 10 -1 : 10 -2 : 10 -3 : 10 -4 : 10 -5 : 10 -6 : 10 -7 : 10 -8 : 10 -9 : 10 +3.workspaceディレクトリにて、`make gen-msg msg=sensor_msgs` によjoint_state.hppを生成する。 + +4.mros2-asp3-f767ziディレクトリにmros2_msgs/sensor_msgs/msg/joint_state.hppが生成されていることを確認する。 + +5.echoreply_joint_stateアプリ内で、生成したjoint_state.hppをincludeして使用する。 + +6.workspaceディレクトリにて、`make app=echoreply_joint_state` によりアプリをビルドする。 + +7.Serial Console (picocomなど) を立ち上げて、初期化する。 + +8.hostのros2アプリからJointState型のmessageを送信する。 -Conducting new Test... -Send message to the STM32. +9.messageを受信、これを再びhostのros2アプリに向かって送信する。(以下) ``` +subscribed msg!! +publishing msg!! +subscribed msg!! +publishing msg!! +``` \ No newline at end of file diff --git a/workspace/echoreply_mesh/Makefile.inc b/workspace/echoreply_mesh/Makefile.inc deleted file mode 100644 index f807ac1..0000000 --- a/workspace/echoreply_mesh/Makefile.inc +++ /dev/null @@ -1,27 +0,0 @@ -# -# Makefile definition for mros2 application -# - -# name of main application -APPLNAME = app - -# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) -# NOTE: also check `initLogMask` in app.cdl for syslog setting -CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 - -# information for directory tree -APPLDIR := $(APPDIR) -APPLDIR += $(APPDIR)/config - -# link option for C++ code -SRCLANG = c++ -APPL_CXXLIBS += -specs=nano.specs - -# compile switch -CDEFS += -DUSE_ASP3_FOR_STM - -# additional files for configuration -APPL_COBJS := task_impl.o -APPL_COBJS += autosar_os_ext_user_config.o -APPL_COBJS += autosar_os_ext_asp3_user_config.o -APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_mesh/README.md b/workspace/echoreply_mesh/README.md deleted file mode 100644 index a6ee6cb..0000000 --- a/workspace/echoreply_mesh/README.md +++ /dev/null @@ -1,68 +0,0 @@ -### EmbeddedRTPS動作確認用アプリ - -EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 -利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 - -#### LINUX側の準備 -1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします -``` -git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 -``` -2. 通信用アプリをビルドします -``` -cd embeddedRTPS-STM32 -cd linux -mkdir build -cd build -cmake -DTHIRDPARTY=ON .. -make -``` -3. PC上のファイヤウォールの設定を切ります - -#### STM側の設定 -1. IPアドレスを設定します。 -`application/src/lwip.c L69-L80` -``` - IP_ADDRESS[0] = 192; - IP_ADDRESS[1] = 168; - IP_ADDRESS[2] = 11; - IP_ADDRESS[3] = 2; - NETMASK_ADDRESS[0] = 255; - NETMASK_ADDRESS[1] = 255; - NETMASK_ADDRESS[2] = 255; - NETMASK_ADDRESS[3] = 0; - GATEWAY_ADDRESS[0] = 192; - GATEWAY_ADDRESS[1] = 168; - GATEWAY_ADDRESS[2] = 11; - GATEWAY_ADDRESS[3] = 1; - ``` -`embeddedRTPS/include/rtps/config.h L36-L37` -``` -const std::array IP_ADDRESS = { - 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. -``` -2. 本アプリをビルドします - -#### 実行 -1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します -2. ビルドしたlinuxのアプリを実行します -3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です -``` -Conducting new Test... -Send message to the STM32. -Received message from STM32 with len:10 -0 : 10 -1 : 10 -2 : 10 -3 : 10 -4 : 10 -5 : 10 -6 : 10 -7 : 10 -8 : 10 -9 : 10 - -Conducting new Test... -Send message to the STM32. - -``` diff --git a/workspace/echoreply_mesh/app.cdl b/workspace/echoreply_mesh/app.cdl deleted file mode 100644 index 176c5a6..0000000 --- a/workspace/echoreply_mesh/app.cdl +++ /dev/null @@ -1,122 +0,0 @@ -/* - * サンプルプログラム(1)のコンポーネント記述ファイル - * - * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ - */ -/* - * カーネルオブジェクトの定義 - */ -import(); - -/* - * ターゲット非依存のセルタイプの定義 - */ -import("syssvc/tSerialPort.cdl"); -import("syssvc/tSerialAdapter.cdl"); -import("syssvc/tSysLog.cdl"); -import("syssvc/tSysLogAdapter.cdl"); -import("syssvc/tLogTask.cdl"); -import("syssvc/tBanner.cdl"); - -/* - * ターゲット依存部の取り込み - */ -import("target.cdl"); - -/* - * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" - * の行までのことを言う. - */ - -/* - * システムログ機能のアダプタの組上げ記述 - * - * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー - * スのシステムログ機能を呼び出すためのセルである.システムログ機能の - * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び - * 出さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSysLogAdapter SysLogAdapter { - cSysLog = SysLog.eSysLog; -}; - -/* - * シリアルインタフェースドライバのアダプタの組上げ記述 - * - * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー - * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための - * セルである.シリアルインタフェースドライバのサービスコールを呼び出 - * さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSerialAdapter SerialAdapter { - cSerialPort[0] = SerialPort1.eSerialPort; -}; - -/* - * システムログ機能の組上げ記述 - * - * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ - * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, - * システムログタスクはシステムログ機能を使用するため,それも外すこと - * が必要である.また,システムログ機能のアダプタも外さなければならな - * い.tecsgenが警告メッセージを出すが,無視してよい. - */ -cell tSysLog SysLog { - logBufferSize = 32; /* ログバッファのサイズ */ - initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); - /* ログバッファに記録すべき重要度 */ - initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); - /* 低レベル出力すべき重要度 */ - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * シリアルインタフェースドライバの組上げ記述 - * - * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 - * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー - * スドライバを使用するため,それも外すことが必要である.また,シリア - * ルインタフェースドライバのアダプタも外さなければならない. - */ -cell tSerialPort SerialPort1 { - receiveBufferSize = 256; /* 受信バッファのサイズ */ - sendBufferSize = 256; /* 送信バッファのサイズ */ - - /* ターゲット依存部との結合 */ - cSIOPort = SIOPortTarget1.eSIOPort; - eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ -}; - -/* - * システムログタスクの組上げ記述 - * - * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ - * ばよい. - */ -cell tLogTask LogTask { - priority = 3; /* システムログタスクの優先度 */ - stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ - - /* シリアルインタフェースドライバとの結合 */ - cSerialPort = SerialPort1.eSerialPort; - cnSerialPortManage = SerialPort1.enSerialPortManage; - - /* システムログ機能との結合 */ - cSysLog = SysLog.eSysLog; - - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * カーネル起動メッセージ出力の組上げ記述 - * - * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 - * を削除すればよい. - */ -cell tBanner Banner { - /* 属性の設定 */ - targetName = BannerTargetName; - copyrightNotice = BannerCopyrightNotice; -}; diff --git a/workspace/echoreply_mesh/app.cfg b/workspace/echoreply_mesh/app.cfg deleted file mode 100644 index eb0495d..0000000 --- a/workspace/echoreply_mesh/app.cfg +++ /dev/null @@ -1,14 +0,0 @@ -/* - * サンプルプログラム(1)のシステムコンフィギュレーションファイル - */ -INCLUDE("tecsgen.cfg"); -INCLUDE("asp3ext.cfg"); -INCLUDE("task.cfg"); - -#include "app.h" -#include "stm32f7xx_it.h" -CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); -CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); -CFG_INT(77, {TA_EDGE, -4}); - -CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_mesh/app.cpp b/workspace/echoreply_mesh/app.cpp deleted file mode 100644 index 1f90d6f..0000000 --- a/workspace/echoreply_mesh/app.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "app.h" -#include "mros2.h" -#include "shape_msgs/msg/mesh.hpp" - -#include "stm32f7xx_nucleo_144.h" - -mros2::Subscriber sub; -mros2::Publisher pub; - -void userCallback(shape_msgs::msg::Mesh *msg) -{ - MROS2_INFO("subscribed! %lu", msg->triangles[0].vertex_indices[0]); - MROS2_INFO("publishing!"); - pub.publish(*msg); -} - -int main(int argc, char * argv[]) -{ - MROS2_INFO("mROS 2 application is started"); - - mros2::init(argc, argv); - MROS2_DEBUG("mROS 2 initialization is completed"); - BSP_LED_Toggle(LED1); - - mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - shape_msgs::msg::Mesh msg; - - MROS2_INFO("ready to pub/sub message"); - mros2::spin(); - BSP_LED_Toggle(LED3); -} - -void main_task(void) -{ - main(0, NULL); -} - -void -led_cyclic_handler(intptr_t exinf) -{ - BSP_LED_Toggle(LED2); -} \ No newline at end of file diff --git a/workspace/echoreply_mesh/app.h b/workspace/echoreply_mesh/app.h deleted file mode 100644 index 36eb6cf..0000000 --- a/workspace/echoreply_mesh/app.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * TOPPERS/ASP Kernel - * Toyohashi Open Platform for Embedded Real-Time Systems/ - * Advanced Standard Profile Kernel - * - * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory - * Toyohashi Univ. of Technology, JAPAN - * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory - * Graduate School of Information Science, Nagoya Univ., JAPAN - * - * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ - * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 - * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. - * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 - * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー - * スコード中に含まれていること. - * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 - * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 - * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 - * の無保証規定を掲載すること. - * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 - * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ - * と. - * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 - * 作権表示,この利用条件および下記の無保証規定を掲載すること. - * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに - * 報告すること. - * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 - * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. - * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 - * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを - * 免責すること. - * - * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お - * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 - * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ - * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ - * の責任を負わない. - * - * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ - */ - -/* - * header file for the mros2 application - */ - -#include - -/* - * Priorities for TOPPERS tasks - */ - -#define MAIN_PRIORITY 5 - -#define HIGH_PRIORITY 9 -#define MID_PRIORITY 10 -#define LOW_PRIORITY 11 - -/* - * Constants that may depend on the target - */ - -#ifndef TASK_PORTID -#define TASK_PORTID 1 -#endif /* TASK_PORTID */ - -#ifndef STACK_SIZE -#define STACK_SIZE 4096 -#endif /* STACK_SIZE */ - -/* - * Declaration of prototyle functions - */ -#ifndef TOPPERS_MACRO_ONLY -#ifdef __cplusplus -extern "C" { -#endif -void main_task(void); -extern void led_cyclic_handler(intptr_t exinf); -#ifdef __cplusplus -} -#endif -void Error_Handler(); -#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.c deleted file mode 100644 index 41ef1da..0000000 --- a/workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "autosar_os_ext_asp3_user_config.h" - -const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), -}; - -const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) -{ - return autosar_os_ext_flag_user_map; -} - -int cmsis_get_flag_user_num(void) -{ - return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; -} diff --git a/workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.h deleted file mode 100644 index 7ad08bf..0000000 --- a/workspace/echoreply_mesh/config/autosar_os_ext_asp3_user_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ - -#include "cmsis_config_utl.h" - -#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) - -extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; - -#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_mesh/config/autosar_os_ext_user_config.c b/workspace/echoreply_mesh/config/autosar_os_ext_user_config.c deleted file mode 100644 index 940941b..0000000 --- a/workspace/echoreply_mesh/config/autosar_os_ext_user_config.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "cmsis_os.h" -#include "autosar_os_ext_user_config.h" - -extern void tcpip_thread(void *arg); -extern void ethernetif_set_link(void* argument); -extern void ethernetif_input(void* argument); -extern void callHbPubFunc(void *arg); -extern void callHbSubFunc(void *arg); -extern void StartDefaultTask(void * argument); -extern void callWriterThreadFunction(void *arg); -extern void callReaderThreadFunction(void *arg); -extern void callRunBroadcast(void *args); -extern void mros2_init(void *args); - - -UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { - { - .taskID = AutosarOsExtTcpTask, - .func = tcpip_thread, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthIfLinkTask, - .func = ethernetif_set_link, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthInputTask, - .func = ethernetif_input, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBPubTask, - .func = callHbPubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBSubTask, - .func = callHbSubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtSPDPTask, - .func = callRunBroadcast, - .argument = NULL, - }, - { - .taskID = AutosarOsExtWriterTask, - .func = callWriterThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtReaderTask, - .func = callReaderThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtMROS2Task, - .func = mros2_init, - .argument = NULL, - }, -}; - -UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) -{ - return user_thread_autosar_ostask_map; -} -int cmsis_get_app_heap_size(void) -{ - return APP_HEAP_SIZE; -} -int cmsis_get_user_thread_num(void) -{ - return USER_THREAD_NUM; -} diff --git a/workspace/echoreply_mesh/config/autosar_os_ext_user_config.h b/workspace/echoreply_mesh/config/autosar_os_ext_user_config.h deleted file mode 100644 index bab78d3..0000000 --- a/workspace/echoreply_mesh/config/autosar_os_ext_user_config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ - -#include "cmsis_os.h" -#include "cmsis_config_utl.h" - -/*********************************************** - * - * MEMORY - * - ***********************************************/ -#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ - - -/*********************************************** - * - * THREAD - * - ***********************************************/ -#define USER_THREAD_NUM 9U - -#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_mesh/config/mros2_user_config.c b/workspace/echoreply_mesh/config/mros2_user_config.c deleted file mode 100644 index 7d2c110..0000000 --- a/workspace/echoreply_mesh/config/mros2_user_config.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#define SUB_MSG_COUNT 10 - -int mros2_get_submsg_count(void) -{ - return SUB_MSG_COUNT; -} - - diff --git a/workspace/echoreply_mesh/config/task.cfg b/workspace/echoreply_mesh/config/task.cfg deleted file mode 100644 index f577110..0000000 --- a/workspace/echoreply_mesh/config/task.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#include "task_impl.h" - -CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); -CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); -CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); -CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); -CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); -CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); -CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); -CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); -CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); -CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); - -CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_mesh/task_impl.c b/workspace/echoreply_mesh/task_impl.c deleted file mode 100644 index afb9fca..0000000 --- a/workspace/echoreply_mesh/task_impl.c +++ /dev/null @@ -1,126 +0,0 @@ -#include "cmsis_os.h" -#include "cmsis_config_utl.h" -#include "task_impl.h" - -TASK(AutosarOsExtTcpTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthIfLinkTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthInputTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBPubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBSubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtSPDPTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtWriterTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtReaderTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtUserDefaultTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtMROS2Task) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} diff --git a/workspace/echoreply_mesh/task_impl.h b/workspace/echoreply_mesh/task_impl.h deleted file mode 100644 index 11e7a81..0000000 --- a/workspace/echoreply_mesh/task_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_TEST_H_ -#define _AUTOSAR_OS_EXT_TEST_H_ - -#include "cmsis_config_utl.h" - -extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); - -/* - * priorities of mROS 2 tasks for RTPS - * - * TODO: We assigned relatevely lower priorities for EthIfLinkTask and - * EthInputTask than the application. Check whether these are appropriate. - */ -#define MROS2_HIGH_PRIORITY MAIN_PRIORITY -#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 - -/* - * experimental: stack size of mROS 2 tasks for RTPS - * Each comment refers the location of original definition - */ -// application/include/lwipopt.h -// #define TCPIP_THREAD_STACKSIZE 1024 -#define MROS2_STACK_SIZE_TcpTask 1024 -// application/src/lwip.c -// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) -#define MROS2_STACK_SIZE_EthIfLinkTask 1024 -// application/src/ethernet.c -// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) -#define MROS2_STACK_SIZE_EthInputTask 350 -// embeddedRTPS/include/config.h -// const int HEARTBEAT_STACKSIZE = 1200; // byte -#define MROS2_STACK_SIZE_HBPubTask 1200 -#define MROS2_STACK_SIZE_HBSubTask 1200 -// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte -#define MROS2_STACK_SIZE_SPDPTask 550 -// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte -#define MROS2_STACK_SIZE_WriterTask 1100 -// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte -#define MROS2_STACK_SIZE_ReaderTask 1600 -// embeddedRTPS-STM32/stm32/Src/main.cpp -// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); -#define MROS2_STACK_SIZE_UserDefaultTask 250 - - -#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/echoreply_mesh/templates.hpp b/workspace/echoreply_mesh/templates.hpp deleted file mode 100644 index 8f293c1..0000000 --- a/workspace/echoreply_mesh/templates.hpp +++ /dev/null @@ -1,11 +0,0 @@ - -#include "shape_msgs/msg/mesh.hpp" - - -template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); -template void mros2::Publisher::publish(shape_msgs::msg::Mesh &msg); - - - -template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(shape_msgs::msg::Mesh*)); -template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/echoreply_mix/Makefile.inc b/workspace/echoreply_mix/Makefile.inc deleted file mode 100644 index f807ac1..0000000 --- a/workspace/echoreply_mix/Makefile.inc +++ /dev/null @@ -1,27 +0,0 @@ -# -# Makefile definition for mros2 application -# - -# name of main application -APPLNAME = app - -# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) -# NOTE: also check `initLogMask` in app.cdl for syslog setting -CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 - -# information for directory tree -APPLDIR := $(APPDIR) -APPLDIR += $(APPDIR)/config - -# link option for C++ code -SRCLANG = c++ -APPL_CXXLIBS += -specs=nano.specs - -# compile switch -CDEFS += -DUSE_ASP3_FOR_STM - -# additional files for configuration -APPL_COBJS := task_impl.o -APPL_COBJS += autosar_os_ext_user_config.o -APPL_COBJS += autosar_os_ext_asp3_user_config.o -APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_mix/README.md b/workspace/echoreply_mix/README.md deleted file mode 100644 index a6ee6cb..0000000 --- a/workspace/echoreply_mix/README.md +++ /dev/null @@ -1,68 +0,0 @@ -### EmbeddedRTPS動作確認用アプリ - -EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 -利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 - -#### LINUX側の準備 -1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします -``` -git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 -``` -2. 通信用アプリをビルドします -``` -cd embeddedRTPS-STM32 -cd linux -mkdir build -cd build -cmake -DTHIRDPARTY=ON .. -make -``` -3. PC上のファイヤウォールの設定を切ります - -#### STM側の設定 -1. IPアドレスを設定します。 -`application/src/lwip.c L69-L80` -``` - IP_ADDRESS[0] = 192; - IP_ADDRESS[1] = 168; - IP_ADDRESS[2] = 11; - IP_ADDRESS[3] = 2; - NETMASK_ADDRESS[0] = 255; - NETMASK_ADDRESS[1] = 255; - NETMASK_ADDRESS[2] = 255; - NETMASK_ADDRESS[3] = 0; - GATEWAY_ADDRESS[0] = 192; - GATEWAY_ADDRESS[1] = 168; - GATEWAY_ADDRESS[2] = 11; - GATEWAY_ADDRESS[3] = 1; - ``` -`embeddedRTPS/include/rtps/config.h L36-L37` -``` -const std::array IP_ADDRESS = { - 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. -``` -2. 本アプリをビルドします - -#### 実行 -1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します -2. ビルドしたlinuxのアプリを実行します -3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です -``` -Conducting new Test... -Send message to the STM32. -Received message from STM32 with len:10 -0 : 10 -1 : 10 -2 : 10 -3 : 10 -4 : 10 -5 : 10 -6 : 10 -7 : 10 -8 : 10 -9 : 10 - -Conducting new Test... -Send message to the STM32. - -``` diff --git a/workspace/echoreply_mix/app.cdl b/workspace/echoreply_mix/app.cdl deleted file mode 100644 index 176c5a6..0000000 --- a/workspace/echoreply_mix/app.cdl +++ /dev/null @@ -1,122 +0,0 @@ -/* - * サンプルプログラム(1)のコンポーネント記述ファイル - * - * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ - */ -/* - * カーネルオブジェクトの定義 - */ -import(); - -/* - * ターゲット非依存のセルタイプの定義 - */ -import("syssvc/tSerialPort.cdl"); -import("syssvc/tSerialAdapter.cdl"); -import("syssvc/tSysLog.cdl"); -import("syssvc/tSysLogAdapter.cdl"); -import("syssvc/tLogTask.cdl"); -import("syssvc/tBanner.cdl"); - -/* - * ターゲット依存部の取り込み - */ -import("target.cdl"); - -/* - * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" - * の行までのことを言う. - */ - -/* - * システムログ機能のアダプタの組上げ記述 - * - * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー - * スのシステムログ機能を呼び出すためのセルである.システムログ機能の - * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び - * 出さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSysLogAdapter SysLogAdapter { - cSysLog = SysLog.eSysLog; -}; - -/* - * シリアルインタフェースドライバのアダプタの組上げ記述 - * - * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー - * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための - * セルである.シリアルインタフェースドライバのサービスコールを呼び出 - * さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSerialAdapter SerialAdapter { - cSerialPort[0] = SerialPort1.eSerialPort; -}; - -/* - * システムログ機能の組上げ記述 - * - * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ - * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, - * システムログタスクはシステムログ機能を使用するため,それも外すこと - * が必要である.また,システムログ機能のアダプタも外さなければならな - * い.tecsgenが警告メッセージを出すが,無視してよい. - */ -cell tSysLog SysLog { - logBufferSize = 32; /* ログバッファのサイズ */ - initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); - /* ログバッファに記録すべき重要度 */ - initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); - /* 低レベル出力すべき重要度 */ - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * シリアルインタフェースドライバの組上げ記述 - * - * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 - * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー - * スドライバを使用するため,それも外すことが必要である.また,シリア - * ルインタフェースドライバのアダプタも外さなければならない. - */ -cell tSerialPort SerialPort1 { - receiveBufferSize = 256; /* 受信バッファのサイズ */ - sendBufferSize = 256; /* 送信バッファのサイズ */ - - /* ターゲット依存部との結合 */ - cSIOPort = SIOPortTarget1.eSIOPort; - eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ -}; - -/* - * システムログタスクの組上げ記述 - * - * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ - * ばよい. - */ -cell tLogTask LogTask { - priority = 3; /* システムログタスクの優先度 */ - stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ - - /* シリアルインタフェースドライバとの結合 */ - cSerialPort = SerialPort1.eSerialPort; - cnSerialPortManage = SerialPort1.enSerialPortManage; - - /* システムログ機能との結合 */ - cSysLog = SysLog.eSysLog; - - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * カーネル起動メッセージ出力の組上げ記述 - * - * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 - * を削除すればよい. - */ -cell tBanner Banner { - /* 属性の設定 */ - targetName = BannerTargetName; - copyrightNotice = BannerCopyrightNotice; -}; diff --git a/workspace/echoreply_mix/app.cfg b/workspace/echoreply_mix/app.cfg deleted file mode 100644 index eb0495d..0000000 --- a/workspace/echoreply_mix/app.cfg +++ /dev/null @@ -1,14 +0,0 @@ -/* - * サンプルプログラム(1)のシステムコンフィギュレーションファイル - */ -INCLUDE("tecsgen.cfg"); -INCLUDE("asp3ext.cfg"); -INCLUDE("task.cfg"); - -#include "app.h" -#include "stm32f7xx_it.h" -CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); -CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); -CFG_INT(77, {TA_EDGE, -4}); - -CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_mix/app.cpp b/workspace/echoreply_mix/app.cpp deleted file mode 100644 index 2600475..0000000 --- a/workspace/echoreply_mix/app.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "app.h" -#include "mros2.h" -#include "mix_msgs/msg/mix.hpp" - -#include "stm32f7xx_nucleo_144.h" - -mros2::Subscriber sub; -mros2::Publisher pub; - -void userCallback(mix_msgs::msg::Mix *msg) -{ - MROS2_INFO("subscribed msg!!"); - MROS2_INFO("publishing msg!!"); - pub.publish(*msg); -} - -int main(int argc, char * argv[]) -{ - MROS2_INFO("mROS 2 application is started"); - - mros2::init(argc, argv); - MROS2_DEBUG("mROS 2 initialization is completed"); - BSP_LED_Toggle(LED1); - - mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - mix_msgs::msg::Mix msg; - - MROS2_INFO("ready to pub/sub message"); - mros2::spin(); - BSP_LED_Toggle(LED3); -} - -void main_task(void) -{ - main(0, NULL); -} - -void -led_cyclic_handler(intptr_t exinf) -{ - BSP_LED_Toggle(LED2); -} \ No newline at end of file diff --git a/workspace/echoreply_mix/app.h b/workspace/echoreply_mix/app.h deleted file mode 100644 index 36eb6cf..0000000 --- a/workspace/echoreply_mix/app.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * TOPPERS/ASP Kernel - * Toyohashi Open Platform for Embedded Real-Time Systems/ - * Advanced Standard Profile Kernel - * - * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory - * Toyohashi Univ. of Technology, JAPAN - * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory - * Graduate School of Information Science, Nagoya Univ., JAPAN - * - * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ - * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 - * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. - * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 - * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー - * スコード中に含まれていること. - * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 - * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 - * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 - * の無保証規定を掲載すること. - * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 - * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ - * と. - * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 - * 作権表示,この利用条件および下記の無保証規定を掲載すること. - * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに - * 報告すること. - * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 - * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. - * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 - * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを - * 免責すること. - * - * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お - * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 - * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ - * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ - * の責任を負わない. - * - * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ - */ - -/* - * header file for the mros2 application - */ - -#include - -/* - * Priorities for TOPPERS tasks - */ - -#define MAIN_PRIORITY 5 - -#define HIGH_PRIORITY 9 -#define MID_PRIORITY 10 -#define LOW_PRIORITY 11 - -/* - * Constants that may depend on the target - */ - -#ifndef TASK_PORTID -#define TASK_PORTID 1 -#endif /* TASK_PORTID */ - -#ifndef STACK_SIZE -#define STACK_SIZE 4096 -#endif /* STACK_SIZE */ - -/* - * Declaration of prototyle functions - */ -#ifndef TOPPERS_MACRO_ONLY -#ifdef __cplusplus -extern "C" { -#endif -void main_task(void); -extern void led_cyclic_handler(intptr_t exinf); -#ifdef __cplusplus -} -#endif -void Error_Handler(); -#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_mix/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_mix/config/autosar_os_ext_asp3_user_config.c deleted file mode 100644 index 41ef1da..0000000 --- a/workspace/echoreply_mix/config/autosar_os_ext_asp3_user_config.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "autosar_os_ext_asp3_user_config.h" - -const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), -}; - -const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) -{ - return autosar_os_ext_flag_user_map; -} - -int cmsis_get_flag_user_num(void) -{ - return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; -} diff --git a/workspace/echoreply_mix/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_mix/config/autosar_os_ext_asp3_user_config.h deleted file mode 100644 index 7ad08bf..0000000 --- a/workspace/echoreply_mix/config/autosar_os_ext_asp3_user_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ - -#include "cmsis_config_utl.h" - -#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) - -extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; - -#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_mix/config/autosar_os_ext_user_config.c b/workspace/echoreply_mix/config/autosar_os_ext_user_config.c deleted file mode 100644 index 940941b..0000000 --- a/workspace/echoreply_mix/config/autosar_os_ext_user_config.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "cmsis_os.h" -#include "autosar_os_ext_user_config.h" - -extern void tcpip_thread(void *arg); -extern void ethernetif_set_link(void* argument); -extern void ethernetif_input(void* argument); -extern void callHbPubFunc(void *arg); -extern void callHbSubFunc(void *arg); -extern void StartDefaultTask(void * argument); -extern void callWriterThreadFunction(void *arg); -extern void callReaderThreadFunction(void *arg); -extern void callRunBroadcast(void *args); -extern void mros2_init(void *args); - - -UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { - { - .taskID = AutosarOsExtTcpTask, - .func = tcpip_thread, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthIfLinkTask, - .func = ethernetif_set_link, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthInputTask, - .func = ethernetif_input, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBPubTask, - .func = callHbPubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBSubTask, - .func = callHbSubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtSPDPTask, - .func = callRunBroadcast, - .argument = NULL, - }, - { - .taskID = AutosarOsExtWriterTask, - .func = callWriterThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtReaderTask, - .func = callReaderThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtMROS2Task, - .func = mros2_init, - .argument = NULL, - }, -}; - -UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) -{ - return user_thread_autosar_ostask_map; -} -int cmsis_get_app_heap_size(void) -{ - return APP_HEAP_SIZE; -} -int cmsis_get_user_thread_num(void) -{ - return USER_THREAD_NUM; -} diff --git a/workspace/echoreply_mix/config/autosar_os_ext_user_config.h b/workspace/echoreply_mix/config/autosar_os_ext_user_config.h deleted file mode 100644 index bab78d3..0000000 --- a/workspace/echoreply_mix/config/autosar_os_ext_user_config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ - -#include "cmsis_os.h" -#include "cmsis_config_utl.h" - -/*********************************************** - * - * MEMORY - * - ***********************************************/ -#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ - - -/*********************************************** - * - * THREAD - * - ***********************************************/ -#define USER_THREAD_NUM 9U - -#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_mix/config/mros2_user_config.c b/workspace/echoreply_mix/config/mros2_user_config.c deleted file mode 100644 index 7d2c110..0000000 --- a/workspace/echoreply_mix/config/mros2_user_config.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#define SUB_MSG_COUNT 10 - -int mros2_get_submsg_count(void) -{ - return SUB_MSG_COUNT; -} - - diff --git a/workspace/echoreply_mix/config/task.cfg b/workspace/echoreply_mix/config/task.cfg deleted file mode 100644 index f577110..0000000 --- a/workspace/echoreply_mix/config/task.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#include "task_impl.h" - -CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); -CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); -CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); -CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); -CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); -CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); -CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); -CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); -CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); -CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); - -CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_mix/task_impl.c b/workspace/echoreply_mix/task_impl.c deleted file mode 100644 index afb9fca..0000000 --- a/workspace/echoreply_mix/task_impl.c +++ /dev/null @@ -1,126 +0,0 @@ -#include "cmsis_os.h" -#include "cmsis_config_utl.h" -#include "task_impl.h" - -TASK(AutosarOsExtTcpTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthIfLinkTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthInputTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBPubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBSubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtSPDPTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtWriterTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtReaderTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtUserDefaultTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtMROS2Task) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} diff --git a/workspace/echoreply_mix/task_impl.h b/workspace/echoreply_mix/task_impl.h deleted file mode 100644 index 11e7a81..0000000 --- a/workspace/echoreply_mix/task_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_TEST_H_ -#define _AUTOSAR_OS_EXT_TEST_H_ - -#include "cmsis_config_utl.h" - -extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); - -/* - * priorities of mROS 2 tasks for RTPS - * - * TODO: We assigned relatevely lower priorities for EthIfLinkTask and - * EthInputTask than the application. Check whether these are appropriate. - */ -#define MROS2_HIGH_PRIORITY MAIN_PRIORITY -#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 - -/* - * experimental: stack size of mROS 2 tasks for RTPS - * Each comment refers the location of original definition - */ -// application/include/lwipopt.h -// #define TCPIP_THREAD_STACKSIZE 1024 -#define MROS2_STACK_SIZE_TcpTask 1024 -// application/src/lwip.c -// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) -#define MROS2_STACK_SIZE_EthIfLinkTask 1024 -// application/src/ethernet.c -// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) -#define MROS2_STACK_SIZE_EthInputTask 350 -// embeddedRTPS/include/config.h -// const int HEARTBEAT_STACKSIZE = 1200; // byte -#define MROS2_STACK_SIZE_HBPubTask 1200 -#define MROS2_STACK_SIZE_HBSubTask 1200 -// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte -#define MROS2_STACK_SIZE_SPDPTask 550 -// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte -#define MROS2_STACK_SIZE_WriterTask 1100 -// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte -#define MROS2_STACK_SIZE_ReaderTask 1600 -// embeddedRTPS-STM32/stm32/Src/main.cpp -// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); -#define MROS2_STACK_SIZE_UserDefaultTask 250 - - -#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/echoreply_mix/templates.hpp b/workspace/echoreply_mix/templates.hpp deleted file mode 100644 index d803f3f..0000000 --- a/workspace/echoreply_mix/templates.hpp +++ /dev/null @@ -1,11 +0,0 @@ - -#include "mix_msgs/msg/mix.hpp" - - -template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); -template void mros2::Publisher::publish(mix_msgs::msg::Mix &msg); - - - -template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(mix_msgs::msg::Mix*)); -template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/echoreply_odometry/README.md b/workspace/echoreply_odometry/README.md index a6ee6cb..92c7c88 100644 --- a/workspace/echoreply_odometry/README.md +++ b/workspace/echoreply_odometry/README.md @@ -1,68 +1,43 @@ -### EmbeddedRTPS動作確認用アプリ +### Odometry型通信動作確認用アプリ -EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 -利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 +Odometry型の通信の動作確認をするためのサンプルアプリです。 +以下の手順で確認できます。 -#### LINUX側の準備 -1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします -``` -git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 -``` -2. 通信用アプリをビルドします -``` -cd embeddedRTPS-STM32 -cd linux -mkdir build -cd build -cmake -DTHIRDPARTY=ON .. -make -``` -3. PC上のファイヤウォールの設定を切ります +1.workspace/custom_msgsで、nav_msgs/msg/Odometry.msgを作成し、Odometry型を定義する。なお、Odometry型には多くの任意型(PoseWithCovariance, TwistWithCovariance, ...) を含むので、それらの定義も各ファイルで行う。 -#### STM側の設定 -1. IPアドレスを設定します。 -`application/src/lwip.c L69-L80` -``` - IP_ADDRESS[0] = 192; - IP_ADDRESS[1] = 168; - IP_ADDRESS[2] = 11; - IP_ADDRESS[3] = 2; - NETMASK_ADDRESS[0] = 255; - NETMASK_ADDRESS[1] = 255; - NETMASK_ADDRESS[2] = 255; - NETMASK_ADDRESS[3] = 0; - GATEWAY_ADDRESS[0] = 192; - GATEWAY_ADDRESS[1] = 168; - GATEWAY_ADDRESS[2] = 11; - GATEWAY_ADDRESS[3] = 1; - ``` -`embeddedRTPS/include/rtps/config.h L36-L37` + ``` + header header + string child_frame_id + geometry_msgs/msg/PoseWithCovariance pose + geometry_msgs/msg/TwistWithCovariance twist + ``` + +2.nav_msgs内にmsg_settings.jsonを作成し、以下のように書き込む。今回通信に用いるのはOdometry型なので、Odometry型定義ファイルの場所を書き込む。 ``` -const std::array IP_ADDRESS = { - 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. + { + "pubsubMsgs": [ + "nav_msgs/msg/Odometry.msg" + ] + } ``` -2. 本アプリをビルドします -#### 実行 -1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します -2. ビルドしたlinuxのアプリを実行します -3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です -``` -Conducting new Test... -Send message to the STM32. -Received message from STM32 with len:10 -0 : 10 -1 : 10 -2 : 10 -3 : 10 -4 : 10 -5 : 10 -6 : 10 -7 : 10 -8 : 10 -9 : 10 +3.workspaceディレクトリにて、`make gen-msg msg=nav_msgs` によodometry.hppを生成する。 + +4.mros2-asp3-f767ziディレクトリにmros2_msgs/nav_msgs/msg/odometry.hppが生成されていることを確認する。 + +5.echoreply_odometryアプリ内で、生成したodometry.hppをincludeして使用する。 + +6.workspaceディレクトリにて、`make app=echoreply_odometry` によりアプリをビルドする。 + +7.Serial Console (picocomなど) を立ち上げて、初期化する。 + +8.hostのros2アプリからOdometry型のmessageを送信する。 -Conducting new Test... -Send message to the STM32. +9.messageを受信、これを再びhostのros2アプリに向かって送信する。(以下) ``` +subscribed msg!! +publishing msg!! +subscribed msg!! +publishing msg!! +``` \ No newline at end of file diff --git a/workspace/echoreply_odometry/app.cpp b/workspace/echoreply_odometry/app.cpp index 5aa2e19..f9e0e74 100644 --- a/workspace/echoreply_odometry/app.cpp +++ b/workspace/echoreply_odometry/app.cpp @@ -9,8 +9,8 @@ mros2::Publisher pub; void userCallback(nav_msgs::msg::Odometry *msg) { - MROS2_INFO("subscribed!"); - MROS2_INFO("publishing!"); + MROS2_INFO("subscribed msg!!"); + MROS2_INFO("publishing msg!!"); pub.publish(*msg); } diff --git a/workspace/echoreply_string_eval/Makefile.inc b/workspace/echoreply_string_eval/Makefile.inc deleted file mode 100644 index f807ac1..0000000 --- a/workspace/echoreply_string_eval/Makefile.inc +++ /dev/null @@ -1,27 +0,0 @@ -# -# Makefile definition for mros2 application -# - -# name of main application -APPLNAME = app - -# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) -# NOTE: also check `initLogMask` in app.cdl for syslog setting -CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 - -# information for directory tree -APPLDIR := $(APPDIR) -APPLDIR += $(APPDIR)/config - -# link option for C++ code -SRCLANG = c++ -APPL_CXXLIBS += -specs=nano.specs - -# compile switch -CDEFS += -DUSE_ASP3_FOR_STM - -# additional files for configuration -APPL_COBJS := task_impl.o -APPL_COBJS += autosar_os_ext_user_config.o -APPL_COBJS += autosar_os_ext_asp3_user_config.o -APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_string_eval/README.md b/workspace/echoreply_string_eval/README.md deleted file mode 100644 index 6ae2132..0000000 --- a/workspace/echoreply_string_eval/README.md +++ /dev/null @@ -1,24 +0,0 @@ -### string型通信動作確認用アプリ - -string型の通信の動作確認をするためのサンプルアプリです。 -以下の手順で確認できます。 - -1.workspaceディレクトリにて、`make app=echoreply_string` によりアプリをビルド - -2.Serial Console (picocomなど) を立ち上げて、初期化 - -3.hostのros2アプリからstring型のmessageを送信 - -4.messageを受信、これを再びhostのros2アプリに向かって送信 (以下) - -``` -Subscribed msg : Hello, world! 1 -Publishing msg : Hello, world! 1 -Subscribed msg : Hello, world! 2 -Publishing msg : Hello, world! 2 -Subscribed msg : Hello, world! 3 -Publishing msg : Hello, world! 3 -Subscribed msg : Hello, world! 4 -Publishing msg : Hello, world! 4 -... -``` diff --git a/workspace/echoreply_string_eval/app.cdl b/workspace/echoreply_string_eval/app.cdl deleted file mode 100644 index 176c5a6..0000000 --- a/workspace/echoreply_string_eval/app.cdl +++ /dev/null @@ -1,122 +0,0 @@ -/* - * サンプルプログラム(1)のコンポーネント記述ファイル - * - * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ - */ -/* - * カーネルオブジェクトの定義 - */ -import(); - -/* - * ターゲット非依存のセルタイプの定義 - */ -import("syssvc/tSerialPort.cdl"); -import("syssvc/tSerialAdapter.cdl"); -import("syssvc/tSysLog.cdl"); -import("syssvc/tSysLogAdapter.cdl"); -import("syssvc/tLogTask.cdl"); -import("syssvc/tBanner.cdl"); - -/* - * ターゲット依存部の取り込み - */ -import("target.cdl"); - -/* - * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" - * の行までのことを言う. - */ - -/* - * システムログ機能のアダプタの組上げ記述 - * - * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー - * スのシステムログ機能を呼び出すためのセルである.システムログ機能の - * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び - * 出さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSysLogAdapter SysLogAdapter { - cSysLog = SysLog.eSysLog; -}; - -/* - * シリアルインタフェースドライバのアダプタの組上げ記述 - * - * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー - * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための - * セルである.シリアルインタフェースドライバのサービスコールを呼び出 - * さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSerialAdapter SerialAdapter { - cSerialPort[0] = SerialPort1.eSerialPort; -}; - -/* - * システムログ機能の組上げ記述 - * - * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ - * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, - * システムログタスクはシステムログ機能を使用するため,それも外すこと - * が必要である.また,システムログ機能のアダプタも外さなければならな - * い.tecsgenが警告メッセージを出すが,無視してよい. - */ -cell tSysLog SysLog { - logBufferSize = 32; /* ログバッファのサイズ */ - initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); - /* ログバッファに記録すべき重要度 */ - initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); - /* 低レベル出力すべき重要度 */ - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * シリアルインタフェースドライバの組上げ記述 - * - * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 - * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー - * スドライバを使用するため,それも外すことが必要である.また,シリア - * ルインタフェースドライバのアダプタも外さなければならない. - */ -cell tSerialPort SerialPort1 { - receiveBufferSize = 256; /* 受信バッファのサイズ */ - sendBufferSize = 256; /* 送信バッファのサイズ */ - - /* ターゲット依存部との結合 */ - cSIOPort = SIOPortTarget1.eSIOPort; - eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ -}; - -/* - * システムログタスクの組上げ記述 - * - * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ - * ばよい. - */ -cell tLogTask LogTask { - priority = 3; /* システムログタスクの優先度 */ - stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ - - /* シリアルインタフェースドライバとの結合 */ - cSerialPort = SerialPort1.eSerialPort; - cnSerialPortManage = SerialPort1.enSerialPortManage; - - /* システムログ機能との結合 */ - cSysLog = SysLog.eSysLog; - - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * カーネル起動メッセージ出力の組上げ記述 - * - * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 - * を削除すればよい. - */ -cell tBanner Banner { - /* 属性の設定 */ - targetName = BannerTargetName; - copyrightNotice = BannerCopyrightNotice; -}; diff --git a/workspace/echoreply_string_eval/app.cfg b/workspace/echoreply_string_eval/app.cfg deleted file mode 100644 index eb0495d..0000000 --- a/workspace/echoreply_string_eval/app.cfg +++ /dev/null @@ -1,14 +0,0 @@ -/* - * サンプルプログラム(1)のシステムコンフィギュレーションファイル - */ -INCLUDE("tecsgen.cfg"); -INCLUDE("asp3ext.cfg"); -INCLUDE("task.cfg"); - -#include "app.h" -#include "stm32f7xx_it.h" -CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); -CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); -CFG_INT(77, {TA_EDGE, -4}); - -CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_string_eval/app.cpp b/workspace/echoreply_string_eval/app.cpp deleted file mode 100644 index ddb39a8..0000000 --- a/workspace/echoreply_string_eval/app.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "app.h" -#include "mros2.h" -#include "std_msgs/msg/string.hpp" - -#include "stm32f7xx_nucleo_144.h" - -mros2::Subscriber sub; -mros2::Publisher pub; - -void userCallback(std_msgs::msg::String *msg) -{ - pub.publish(*msg); -} - -int main(int argc, char * argv[]) -{ - MROS2_INFO("mROS 2 application is started"); - - mros2::init(argc, argv); - MROS2_DEBUG("mROS 2 initialization is completed"); - BSP_LED_Toggle(LED1); - - mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - std_msgs::msg::String msg; - - MROS2_INFO("ready to pub/sub message"); - mros2::spin(); - BSP_LED_Toggle(LED3); -} - -void main_task(void) -{ - main(0, NULL); -} - -void -led_cyclic_handler(intptr_t exinf) -{ - BSP_LED_Toggle(LED2); -} diff --git a/workspace/echoreply_string_eval/app.h b/workspace/echoreply_string_eval/app.h deleted file mode 100644 index 36eb6cf..0000000 --- a/workspace/echoreply_string_eval/app.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * TOPPERS/ASP Kernel - * Toyohashi Open Platform for Embedded Real-Time Systems/ - * Advanced Standard Profile Kernel - * - * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory - * Toyohashi Univ. of Technology, JAPAN - * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory - * Graduate School of Information Science, Nagoya Univ., JAPAN - * - * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ - * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 - * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. - * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 - * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー - * スコード中に含まれていること. - * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 - * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 - * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 - * の無保証規定を掲載すること. - * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 - * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ - * と. - * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 - * 作権表示,この利用条件および下記の無保証規定を掲載すること. - * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに - * 報告すること. - * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 - * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. - * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 - * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを - * 免責すること. - * - * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お - * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 - * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ - * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ - * の責任を負わない. - * - * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ - */ - -/* - * header file for the mros2 application - */ - -#include - -/* - * Priorities for TOPPERS tasks - */ - -#define MAIN_PRIORITY 5 - -#define HIGH_PRIORITY 9 -#define MID_PRIORITY 10 -#define LOW_PRIORITY 11 - -/* - * Constants that may depend on the target - */ - -#ifndef TASK_PORTID -#define TASK_PORTID 1 -#endif /* TASK_PORTID */ - -#ifndef STACK_SIZE -#define STACK_SIZE 4096 -#endif /* STACK_SIZE */ - -/* - * Declaration of prototyle functions - */ -#ifndef TOPPERS_MACRO_ONLY -#ifdef __cplusplus -extern "C" { -#endif -void main_task(void); -extern void led_cyclic_handler(intptr_t exinf); -#ifdef __cplusplus -} -#endif -void Error_Handler(); -#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.c deleted file mode 100644 index 41ef1da..0000000 --- a/workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "autosar_os_ext_asp3_user_config.h" - -const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), -}; - -const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) -{ - return autosar_os_ext_flag_user_map; -} - -int cmsis_get_flag_user_num(void) -{ - return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; -} diff --git a/workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.h deleted file mode 100644 index 7ad08bf..0000000 --- a/workspace/echoreply_string_eval/config/autosar_os_ext_asp3_user_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ - -#include "cmsis_config_utl.h" - -#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) - -extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; - -#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_string_eval/config/autosar_os_ext_user_config.c b/workspace/echoreply_string_eval/config/autosar_os_ext_user_config.c deleted file mode 100644 index 940941b..0000000 --- a/workspace/echoreply_string_eval/config/autosar_os_ext_user_config.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "cmsis_os.h" -#include "autosar_os_ext_user_config.h" - -extern void tcpip_thread(void *arg); -extern void ethernetif_set_link(void* argument); -extern void ethernetif_input(void* argument); -extern void callHbPubFunc(void *arg); -extern void callHbSubFunc(void *arg); -extern void StartDefaultTask(void * argument); -extern void callWriterThreadFunction(void *arg); -extern void callReaderThreadFunction(void *arg); -extern void callRunBroadcast(void *args); -extern void mros2_init(void *args); - - -UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { - { - .taskID = AutosarOsExtTcpTask, - .func = tcpip_thread, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthIfLinkTask, - .func = ethernetif_set_link, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthInputTask, - .func = ethernetif_input, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBPubTask, - .func = callHbPubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBSubTask, - .func = callHbSubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtSPDPTask, - .func = callRunBroadcast, - .argument = NULL, - }, - { - .taskID = AutosarOsExtWriterTask, - .func = callWriterThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtReaderTask, - .func = callReaderThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtMROS2Task, - .func = mros2_init, - .argument = NULL, - }, -}; - -UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) -{ - return user_thread_autosar_ostask_map; -} -int cmsis_get_app_heap_size(void) -{ - return APP_HEAP_SIZE; -} -int cmsis_get_user_thread_num(void) -{ - return USER_THREAD_NUM; -} diff --git a/workspace/echoreply_string_eval/config/autosar_os_ext_user_config.h b/workspace/echoreply_string_eval/config/autosar_os_ext_user_config.h deleted file mode 100644 index bab78d3..0000000 --- a/workspace/echoreply_string_eval/config/autosar_os_ext_user_config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ - -#include "cmsis_os.h" -#include "cmsis_config_utl.h" - -/*********************************************** - * - * MEMORY - * - ***********************************************/ -#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ - - -/*********************************************** - * - * THREAD - * - ***********************************************/ -#define USER_THREAD_NUM 9U - -#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_string_eval/config/mros2_user_config.c b/workspace/echoreply_string_eval/config/mros2_user_config.c deleted file mode 100644 index 7d2c110..0000000 --- a/workspace/echoreply_string_eval/config/mros2_user_config.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#define SUB_MSG_COUNT 10 - -int mros2_get_submsg_count(void) -{ - return SUB_MSG_COUNT; -} - - diff --git a/workspace/echoreply_string_eval/config/task.cfg b/workspace/echoreply_string_eval/config/task.cfg deleted file mode 100644 index f577110..0000000 --- a/workspace/echoreply_string_eval/config/task.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#include "task_impl.h" - -CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); -CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); -CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); -CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); -CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); -CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); -CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); -CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); -CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); -CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); - -CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_string_eval/task_impl.c b/workspace/echoreply_string_eval/task_impl.c deleted file mode 100644 index afb9fca..0000000 --- a/workspace/echoreply_string_eval/task_impl.c +++ /dev/null @@ -1,126 +0,0 @@ -#include "cmsis_os.h" -#include "cmsis_config_utl.h" -#include "task_impl.h" - -TASK(AutosarOsExtTcpTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthIfLinkTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthInputTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBPubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBSubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtSPDPTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtWriterTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtReaderTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtUserDefaultTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtMROS2Task) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} diff --git a/workspace/echoreply_string_eval/task_impl.h b/workspace/echoreply_string_eval/task_impl.h deleted file mode 100644 index 11e7a81..0000000 --- a/workspace/echoreply_string_eval/task_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_TEST_H_ -#define _AUTOSAR_OS_EXT_TEST_H_ - -#include "cmsis_config_utl.h" - -extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); - -/* - * priorities of mROS 2 tasks for RTPS - * - * TODO: We assigned relatevely lower priorities for EthIfLinkTask and - * EthInputTask than the application. Check whether these are appropriate. - */ -#define MROS2_HIGH_PRIORITY MAIN_PRIORITY -#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 - -/* - * experimental: stack size of mROS 2 tasks for RTPS - * Each comment refers the location of original definition - */ -// application/include/lwipopt.h -// #define TCPIP_THREAD_STACKSIZE 1024 -#define MROS2_STACK_SIZE_TcpTask 1024 -// application/src/lwip.c -// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) -#define MROS2_STACK_SIZE_EthIfLinkTask 1024 -// application/src/ethernet.c -// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) -#define MROS2_STACK_SIZE_EthInputTask 350 -// embeddedRTPS/include/config.h -// const int HEARTBEAT_STACKSIZE = 1200; // byte -#define MROS2_STACK_SIZE_HBPubTask 1200 -#define MROS2_STACK_SIZE_HBSubTask 1200 -// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte -#define MROS2_STACK_SIZE_SPDPTask 550 -// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte -#define MROS2_STACK_SIZE_WriterTask 1100 -// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte -#define MROS2_STACK_SIZE_ReaderTask 1600 -// embeddedRTPS-STM32/stm32/Src/main.cpp -// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); -#define MROS2_STACK_SIZE_UserDefaultTask 250 - - -#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/echoreply_string_eval/templates.hpp b/workspace/echoreply_string_eval/templates.hpp deleted file mode 100644 index 780d817..0000000 --- a/workspace/echoreply_string_eval/templates.hpp +++ /dev/null @@ -1,11 +0,0 @@ - -#include "std_msgs/msg/string.hpp" - - -template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); -template void mros2::Publisher::publish(std_msgs::msg::String &msg); - - - -template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::String*)); -template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/echoreply_twist/README.md b/workspace/echoreply_twist/README.md index a6ee6cb..1884ab1 100644 --- a/workspace/echoreply_twist/README.md +++ b/workspace/echoreply_twist/README.md @@ -1,68 +1,49 @@ -### EmbeddedRTPS動作確認用アプリ +### Twist型通信動作確認用アプリ -EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 -利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 +Twist型の通信の動作確認をするためのサンプルアプリです。 +Twist型とは、2つのVector3型からなるメッセージ型です。 +Vector3型は、3つのfloat64型からなるメッセージ型です。 +以下の手順で確認できます。 -#### LINUX側の準備 -1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします -``` -git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 -``` -2. 通信用アプリをビルドします -``` -cd embeddedRTPS-STM32 -cd linux -mkdir build -cd build -cmake -DTHIRDPARTY=ON .. -make -``` -3. PC上のファイヤウォールの設定を切ります +1.workspace/custom_msgsで、geometry_msgs/msg/Vector3.msgおよびTwist.msgを作成し、それぞれにおいて以下のようにVector3型およびTwist型を定義する。 -#### STM側の設定 -1. IPアドレスを設定します。 -`application/src/lwip.c L69-L80` -``` - IP_ADDRESS[0] = 192; - IP_ADDRESS[1] = 168; - IP_ADDRESS[2] = 11; - IP_ADDRESS[3] = 2; - NETMASK_ADDRESS[0] = 255; - NETMASK_ADDRESS[1] = 255; - NETMASK_ADDRESS[2] = 255; - NETMASK_ADDRESS[3] = 0; - GATEWAY_ADDRESS[0] = 192; - GATEWAY_ADDRESS[1] = 168; - GATEWAY_ADDRESS[2] = 11; - GATEWAY_ADDRESS[3] = 1; - ``` -`embeddedRTPS/include/rtps/config.h L36-L37` + ``` + float64 x + float64 y + float64 z + ``` + + ``` + geometry_msgs/msg/Vector3 linear + geometry_msgs/msg/Vector3 angular + ``` + +2.geometry_msgs内にmsg_settings.jsonを作成し、以下のように書き込む。今回通信に用いるのはTwist型なので、Twist型定義ファイルの場所を書き込む。(Vector3型はTwist型に含まれるが、通信を行う型自体はVector3型でないので記載しなくて良い) ``` -const std::array IP_ADDRESS = { - 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. + { + "pubsubMsgs": [ + "geometry_msgs/msg/Twist.msg" + ] + } ``` -2. 本アプリをビルドします -#### 実行 -1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します -2. ビルドしたlinuxのアプリを実行します -3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です -``` -Conducting new Test... -Send message to the STM32. -Received message from STM32 with len:10 -0 : 10 -1 : 10 -2 : 10 -3 : 10 -4 : 10 -5 : 10 -6 : 10 -7 : 10 -8 : 10 -9 : 10 +3.workspaceディレクトリにて、`make gen-msg msg=geometry_msgs` によtwist.hppを生成する。 + +4.mros2-asp3-f767ziディレクトリにmros2_msgs/geometry_msgs/msg/twist.hppが生成されていることを確認する。 + +5.echoreply_twistアプリ内で、生成したtwist.hppをincludeして使用する。 + +6.workspaceディレクトリにて、`make app=echoreply_twist` によりアプリをビルドする。 + +7.Serial Console (picocomなど) を立ち上げて、初期化する。 + +8.hostのros2アプリからTwist型のmessageを送信する。 -Conducting new Test... -Send message to the STM32. +9.messageを受信、これを再びhostのros2アプリに向かって送信する。(以下) ``` +subscribed msg!! +publishing msg!! +subscribed msg!! +publishing msg!! +``` \ No newline at end of file diff --git a/workspace/echoreply_twist/app.cpp b/workspace/echoreply_twist/app.cpp index 7df6707..29a9763 100644 --- a/workspace/echoreply_twist/app.cpp +++ b/workspace/echoreply_twist/app.cpp @@ -1,6 +1,5 @@ #include "app.h" #include "mros2.h" -#include #include "geometry_msgs/msg/twist.hpp" #include "stm32f7xx_nucleo_144.h" @@ -8,24 +7,11 @@ mros2::Subscriber sub; mros2::Publisher pub; -std::array timeArr; -uint32_t count = 0; - void userCallback(geometry_msgs::msg::Twist *msg) { - if (count == 200){ - for (int i=0;i<200;i++){ - MROS2_INFO("%lu", timeArr[i]); - dly_tsk(1000); - } - MROS2_INFO("----------------"); - } else if (count > 200){ - - } else { - timeArr[count] = fch_hrt(); - pub.publish(*msg); - count++; - } + MROS2_INFO("subscribed msg!!"); + MROS2_INFO("publishing msg!!"); + pub.publish(*msg); } int main(int argc, char * argv[]) diff --git a/workspace/echoreply_twist_string/Makefile.inc b/workspace/echoreply_twist_string/Makefile.inc deleted file mode 100644 index f807ac1..0000000 --- a/workspace/echoreply_twist_string/Makefile.inc +++ /dev/null @@ -1,27 +0,0 @@ -# -# Makefile definition for mros2 application -# - -# name of main application -APPLNAME = app - -# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) -# NOTE: also check `initLogMask` in app.cdl for syslog setting -CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 - -# information for directory tree -APPLDIR := $(APPDIR) -APPLDIR += $(APPDIR)/config - -# link option for C++ code -SRCLANG = c++ -APPL_CXXLIBS += -specs=nano.specs - -# compile switch -CDEFS += -DUSE_ASP3_FOR_STM - -# additional files for configuration -APPL_COBJS := task_impl.o -APPL_COBJS += autosar_os_ext_user_config.o -APPL_COBJS += autosar_os_ext_asp3_user_config.o -APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_twist_string/README.md b/workspace/echoreply_twist_string/README.md deleted file mode 100644 index a6ee6cb..0000000 --- a/workspace/echoreply_twist_string/README.md +++ /dev/null @@ -1,68 +0,0 @@ -### EmbeddedRTPS動作確認用アプリ - -EmbeddedRTPSの動作確認をする(=embeddedRTPS開発元が提供するのテストプログラムを実行する)ためのサンプルアプリです。 -利用に当たっては、embeddedRTPS-STM32のリポジトリ内にある通信用アプリをビルドして実行する必要があります。 - -#### LINUX側の準備 -1.適当なディレクトリに、embeddedRTPS-STM32のリポジトリをcloneします -``` -git clone --recursive https://github.com/embedded-software-laboratory/embeddedRTPS-STM32 -``` -2. 通信用アプリをビルドします -``` -cd embeddedRTPS-STM32 -cd linux -mkdir build -cd build -cmake -DTHIRDPARTY=ON .. -make -``` -3. PC上のファイヤウォールの設定を切ります - -#### STM側の設定 -1. IPアドレスを設定します。 -`application/src/lwip.c L69-L80` -``` - IP_ADDRESS[0] = 192; - IP_ADDRESS[1] = 168; - IP_ADDRESS[2] = 11; - IP_ADDRESS[3] = 2; - NETMASK_ADDRESS[0] = 255; - NETMASK_ADDRESS[1] = 255; - NETMASK_ADDRESS[2] = 255; - NETMASK_ADDRESS[3] = 0; - GATEWAY_ADDRESS[0] = 192; - GATEWAY_ADDRESS[1] = 168; - GATEWAY_ADDRESS[2] = 11; - GATEWAY_ADDRESS[3] = 1; - ``` -`embeddedRTPS/include/rtps/config.h L36-L37` -``` -const std::array IP_ADDRESS = { - 192, 168, 11, 2}; // Needs to be set in lwipcfg.h too. -``` -2. 本アプリをビルドします - -#### 実行 -1. STM32側のアプリを、STM32CubeIDEのデバッガ機能などにより実行します -2. ビルドしたlinuxのアプリを実行します -3. 以下のように、linux側から送信されたデータがstmから返送され、その旨のメッセージが出れば成功です -``` -Conducting new Test... -Send message to the STM32. -Received message from STM32 with len:10 -0 : 10 -1 : 10 -2 : 10 -3 : 10 -4 : 10 -5 : 10 -6 : 10 -7 : 10 -8 : 10 -9 : 10 - -Conducting new Test... -Send message to the STM32. - -``` diff --git a/workspace/echoreply_twist_string/app.cdl b/workspace/echoreply_twist_string/app.cdl deleted file mode 100644 index 176c5a6..0000000 --- a/workspace/echoreply_twist_string/app.cdl +++ /dev/null @@ -1,122 +0,0 @@ -/* - * サンプルプログラム(1)のコンポーネント記述ファイル - * - * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ - */ -/* - * カーネルオブジェクトの定義 - */ -import(); - -/* - * ターゲット非依存のセルタイプの定義 - */ -import("syssvc/tSerialPort.cdl"); -import("syssvc/tSerialAdapter.cdl"); -import("syssvc/tSysLog.cdl"); -import("syssvc/tSysLogAdapter.cdl"); -import("syssvc/tLogTask.cdl"); -import("syssvc/tBanner.cdl"); - -/* - * ターゲット依存部の取り込み - */ -import("target.cdl"); - -/* - * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" - * の行までのことを言う. - */ - -/* - * システムログ機能のアダプタの組上げ記述 - * - * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー - * スのシステムログ機能を呼び出すためのセルである.システムログ機能の - * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び - * 出さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSysLogAdapter SysLogAdapter { - cSysLog = SysLog.eSysLog; -}; - -/* - * シリアルインタフェースドライバのアダプタの組上げ記述 - * - * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー - * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための - * セルである.シリアルインタフェースドライバのサービスコールを呼び出 - * さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSerialAdapter SerialAdapter { - cSerialPort[0] = SerialPort1.eSerialPort; -}; - -/* - * システムログ機能の組上げ記述 - * - * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ - * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, - * システムログタスクはシステムログ機能を使用するため,それも外すこと - * が必要である.また,システムログ機能のアダプタも外さなければならな - * い.tecsgenが警告メッセージを出すが,無視してよい. - */ -cell tSysLog SysLog { - logBufferSize = 32; /* ログバッファのサイズ */ - initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); - /* ログバッファに記録すべき重要度 */ - initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); - /* 低レベル出力すべき重要度 */ - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * シリアルインタフェースドライバの組上げ記述 - * - * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 - * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー - * スドライバを使用するため,それも外すことが必要である.また,シリア - * ルインタフェースドライバのアダプタも外さなければならない. - */ -cell tSerialPort SerialPort1 { - receiveBufferSize = 256; /* 受信バッファのサイズ */ - sendBufferSize = 256; /* 送信バッファのサイズ */ - - /* ターゲット依存部との結合 */ - cSIOPort = SIOPortTarget1.eSIOPort; - eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ -}; - -/* - * システムログタスクの組上げ記述 - * - * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ - * ばよい. - */ -cell tLogTask LogTask { - priority = 3; /* システムログタスクの優先度 */ - stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ - - /* シリアルインタフェースドライバとの結合 */ - cSerialPort = SerialPort1.eSerialPort; - cnSerialPortManage = SerialPort1.enSerialPortManage; - - /* システムログ機能との結合 */ - cSysLog = SysLog.eSysLog; - - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * カーネル起動メッセージ出力の組上げ記述 - * - * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 - * を削除すればよい. - */ -cell tBanner Banner { - /* 属性の設定 */ - targetName = BannerTargetName; - copyrightNotice = BannerCopyrightNotice; -}; diff --git a/workspace/echoreply_twist_string/app.cfg b/workspace/echoreply_twist_string/app.cfg deleted file mode 100644 index eb0495d..0000000 --- a/workspace/echoreply_twist_string/app.cfg +++ /dev/null @@ -1,14 +0,0 @@ -/* - * サンプルプログラム(1)のシステムコンフィギュレーションファイル - */ -INCLUDE("tecsgen.cfg"); -INCLUDE("asp3ext.cfg"); -INCLUDE("task.cfg"); - -#include "app.h" -#include "stm32f7xx_it.h" -CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); -CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); -CFG_INT(77, {TA_EDGE, -4}); - -CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_twist_string/app.cpp b/workspace/echoreply_twist_string/app.cpp deleted file mode 100644 index 3940c46..0000000 --- a/workspace/echoreply_twist_string/app.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include "app.h" -#include "mros2.h" -#include "std_msgs/msg/string.hpp" -#include - -#include "stm32f7xx_nucleo_144.h" - -std::string double_to_string(double value) -{ - int intpart, fracpart; - char str[12]; - intpart = (int)value; - fracpart = (int)((value - intpart) * 1000000); - sprintf(str, "%d.%06d", intpart, fracpart); - return str; -} - -mros2::Subscriber sub; -mros2::Publisher pub; - -void userCallback(std_msgs::msg::String *msg) -{ - std::string sub_str1 = msg->data.substr(0,8); - std::string sub_str2 = msg->data.substr(8,8); - std::string sub_str3 = msg->data.substr(16,8); - std::string sub_str4 = msg->data.substr(24,8); - std::string sub_str5 = msg->data.substr(32,8); - std::string sub_str6 = msg->data.substr(40,8); - - double linear_x = std::stod(sub_str1); - double linear_y = std::stod(sub_str2); - double linear_z = std::stod(sub_str3); - double angular_x = std::stod(sub_str4); - double angular_y = std::stod(sub_str5); - double angular_z = std::stod(sub_str6); - - auto reconverted_message = std_msgs::msg::String(); - - std::string pub_str1 = double_to_string(linear_x); - std::string pub_str2 = double_to_string(linear_y); - std::string pub_str3 = double_to_string(linear_z); - std::string pub_str4 = double_to_string(angular_x); - std::string pub_str5 = double_to_string(angular_y); - std::string pub_str6 = double_to_string(angular_z); - - std::string pub_str = pub_str1 + pub_str2 + pub_str3 + pub_str4 + pub_str5 + pub_str6; - reconverted_message.data = pub_str; - - pub.publish(reconverted_message); -} - -int main(int argc, char * argv[]) -{ - MROS2_INFO("mROS 2 application is started"); - - mros2::init(argc, argv); - MROS2_DEBUG("mROS 2 initialization is completed"); - BSP_LED_Toggle(LED1); - - mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - std_msgs::msg::String msg; - - MROS2_INFO("ready to pub/sub message"); - mros2::spin(); - BSP_LED_Toggle(LED3); -} - -void main_task(void) -{ - main(0, NULL); -} - -void -led_cyclic_handler(intptr_t exinf) -{ - BSP_LED_Toggle(LED2); -} \ No newline at end of file diff --git a/workspace/echoreply_twist_string/app.h b/workspace/echoreply_twist_string/app.h deleted file mode 100644 index 36eb6cf..0000000 --- a/workspace/echoreply_twist_string/app.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * TOPPERS/ASP Kernel - * Toyohashi Open Platform for Embedded Real-Time Systems/ - * Advanced Standard Profile Kernel - * - * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory - * Toyohashi Univ. of Technology, JAPAN - * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory - * Graduate School of Information Science, Nagoya Univ., JAPAN - * - * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ - * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 - * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. - * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 - * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー - * スコード中に含まれていること. - * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 - * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 - * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 - * の無保証規定を掲載すること. - * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 - * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ - * と. - * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 - * 作権表示,この利用条件および下記の無保証規定を掲載すること. - * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに - * 報告すること. - * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 - * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. - * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 - * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを - * 免責すること. - * - * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お - * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 - * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ - * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ - * の責任を負わない. - * - * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ - */ - -/* - * header file for the mros2 application - */ - -#include - -/* - * Priorities for TOPPERS tasks - */ - -#define MAIN_PRIORITY 5 - -#define HIGH_PRIORITY 9 -#define MID_PRIORITY 10 -#define LOW_PRIORITY 11 - -/* - * Constants that may depend on the target - */ - -#ifndef TASK_PORTID -#define TASK_PORTID 1 -#endif /* TASK_PORTID */ - -#ifndef STACK_SIZE -#define STACK_SIZE 4096 -#endif /* STACK_SIZE */ - -/* - * Declaration of prototyle functions - */ -#ifndef TOPPERS_MACRO_ONLY -#ifdef __cplusplus -extern "C" { -#endif -void main_task(void); -extern void led_cyclic_handler(intptr_t exinf); -#ifdef __cplusplus -} -#endif -void Error_Handler(); -#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.c deleted file mode 100644 index 41ef1da..0000000 --- a/workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "autosar_os_ext_asp3_user_config.h" - -const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), -}; - -const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) -{ - return autosar_os_ext_flag_user_map; -} - -int cmsis_get_flag_user_num(void) -{ - return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; -} diff --git a/workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.h deleted file mode 100644 index 7ad08bf..0000000 --- a/workspace/echoreply_twist_string/config/autosar_os_ext_asp3_user_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ - -#include "cmsis_config_utl.h" - -#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) - -extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; - -#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_twist_string/config/autosar_os_ext_user_config.c b/workspace/echoreply_twist_string/config/autosar_os_ext_user_config.c deleted file mode 100644 index 940941b..0000000 --- a/workspace/echoreply_twist_string/config/autosar_os_ext_user_config.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "cmsis_os.h" -#include "autosar_os_ext_user_config.h" - -extern void tcpip_thread(void *arg); -extern void ethernetif_set_link(void* argument); -extern void ethernetif_input(void* argument); -extern void callHbPubFunc(void *arg); -extern void callHbSubFunc(void *arg); -extern void StartDefaultTask(void * argument); -extern void callWriterThreadFunction(void *arg); -extern void callReaderThreadFunction(void *arg); -extern void callRunBroadcast(void *args); -extern void mros2_init(void *args); - - -UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { - { - .taskID = AutosarOsExtTcpTask, - .func = tcpip_thread, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthIfLinkTask, - .func = ethernetif_set_link, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthInputTask, - .func = ethernetif_input, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBPubTask, - .func = callHbPubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBSubTask, - .func = callHbSubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtSPDPTask, - .func = callRunBroadcast, - .argument = NULL, - }, - { - .taskID = AutosarOsExtWriterTask, - .func = callWriterThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtReaderTask, - .func = callReaderThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtMROS2Task, - .func = mros2_init, - .argument = NULL, - }, -}; - -UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) -{ - return user_thread_autosar_ostask_map; -} -int cmsis_get_app_heap_size(void) -{ - return APP_HEAP_SIZE; -} -int cmsis_get_user_thread_num(void) -{ - return USER_THREAD_NUM; -} diff --git a/workspace/echoreply_twist_string/config/autosar_os_ext_user_config.h b/workspace/echoreply_twist_string/config/autosar_os_ext_user_config.h deleted file mode 100644 index bab78d3..0000000 --- a/workspace/echoreply_twist_string/config/autosar_os_ext_user_config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ - -#include "cmsis_os.h" -#include "cmsis_config_utl.h" - -/*********************************************** - * - * MEMORY - * - ***********************************************/ -#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ - - -/*********************************************** - * - * THREAD - * - ***********************************************/ -#define USER_THREAD_NUM 9U - -#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_twist_string/config/mros2_user_config.c b/workspace/echoreply_twist_string/config/mros2_user_config.c deleted file mode 100644 index 7d2c110..0000000 --- a/workspace/echoreply_twist_string/config/mros2_user_config.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#define SUB_MSG_COUNT 10 - -int mros2_get_submsg_count(void) -{ - return SUB_MSG_COUNT; -} - - diff --git a/workspace/echoreply_twist_string/config/task.cfg b/workspace/echoreply_twist_string/config/task.cfg deleted file mode 100644 index f577110..0000000 --- a/workspace/echoreply_twist_string/config/task.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#include "task_impl.h" - -CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); -CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); -CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); -CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); -CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); -CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); -CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); -CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); -CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); -CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); - -CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_twist_string/task_impl.c b/workspace/echoreply_twist_string/task_impl.c deleted file mode 100644 index afb9fca..0000000 --- a/workspace/echoreply_twist_string/task_impl.c +++ /dev/null @@ -1,126 +0,0 @@ -#include "cmsis_os.h" -#include "cmsis_config_utl.h" -#include "task_impl.h" - -TASK(AutosarOsExtTcpTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthIfLinkTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthInputTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBPubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBSubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtSPDPTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtWriterTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtReaderTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtUserDefaultTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtMROS2Task) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} diff --git a/workspace/echoreply_twist_string/task_impl.h b/workspace/echoreply_twist_string/task_impl.h deleted file mode 100644 index 11e7a81..0000000 --- a/workspace/echoreply_twist_string/task_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_TEST_H_ -#define _AUTOSAR_OS_EXT_TEST_H_ - -#include "cmsis_config_utl.h" - -extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); - -/* - * priorities of mROS 2 tasks for RTPS - * - * TODO: We assigned relatevely lower priorities for EthIfLinkTask and - * EthInputTask than the application. Check whether these are appropriate. - */ -#define MROS2_HIGH_PRIORITY MAIN_PRIORITY -#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 - -/* - * experimental: stack size of mROS 2 tasks for RTPS - * Each comment refers the location of original definition - */ -// application/include/lwipopt.h -// #define TCPIP_THREAD_STACKSIZE 1024 -#define MROS2_STACK_SIZE_TcpTask 1024 -// application/src/lwip.c -// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) -#define MROS2_STACK_SIZE_EthIfLinkTask 1024 -// application/src/ethernet.c -// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) -#define MROS2_STACK_SIZE_EthInputTask 350 -// embeddedRTPS/include/config.h -// const int HEARTBEAT_STACKSIZE = 1200; // byte -#define MROS2_STACK_SIZE_HBPubTask 1200 -#define MROS2_STACK_SIZE_HBSubTask 1200 -// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte -#define MROS2_STACK_SIZE_SPDPTask 550 -// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte -#define MROS2_STACK_SIZE_WriterTask 1100 -// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte -#define MROS2_STACK_SIZE_ReaderTask 1600 -// embeddedRTPS-STM32/stm32/Src/main.cpp -// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); -#define MROS2_STACK_SIZE_UserDefaultTask 250 - - -#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/echoreply_twist_string/templates.hpp b/workspace/echoreply_twist_string/templates.hpp deleted file mode 100644 index 780d817..0000000 --- a/workspace/echoreply_twist_string/templates.hpp +++ /dev/null @@ -1,11 +0,0 @@ - -#include "std_msgs/msg/string.hpp" - - -template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); -template void mros2::Publisher::publish(std_msgs::msg::String &msg); - - - -template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::String*)); -template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/echoreply_uint16/app.cpp b/workspace/echoreply_uint16/app.cpp index 1d98c8f..35c9728 100644 --- a/workspace/echoreply_uint16/app.cpp +++ b/workspace/echoreply_uint16/app.cpp @@ -9,8 +9,8 @@ mros2::Publisher pub; void userCallback(std_msgs::msg::UInt16 *msg) { - MROS2_INFO("subscribed msg: '%d'", msg->data); - MROS2_INFO("publishing msg: '%d'", msg->data); + MROS2_INFO("subscribed msg: %u", msg->data); + MROS2_INFO("publishing msg: %u", msg->data); pub.publish(*msg); } @@ -25,6 +25,7 @@ int main(int argc, char * argv[]) mros2::Node node = mros2::Node::create_node("mros2_node"); pub = node.create_publisher("to_linux", 10); sub = node.create_subscription("to_stm", 10, userCallback); + std_msgs::msg::UInt16 msg; MROS2_INFO("ready to pub/sub message"); mros2::spin(); @@ -40,4 +41,4 @@ void led_cyclic_handler(intptr_t exinf) { BSP_LED_Toggle(LED2); -} \ No newline at end of file +} From 4ce8c3b4a58b2205b0b693e8b164b57e17920427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sun, 13 Feb 2022 15:57:24 +0900 Subject: [PATCH 64/80] follow asp3-f767zi submodule commitID of main branch --- asp3-f767zi | 2 +- workspace/Makefile | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/asp3-f767zi b/asp3-f767zi index dc1ea84..924f49e 160000 --- a/asp3-f767zi +++ b/asp3-f767zi @@ -1 +1 @@ -Subproject commit dc1ea84dd21f9f322d6cdd912a78148c3225d8ee +Subproject commit 924f49eca36f7b305b94a1f86b48849387f744b3 diff --git a/workspace/Makefile b/workspace/Makefile index 9a3fbcd..2b72276 100644 --- a/workspace/Makefile +++ b/workspace/Makefile @@ -4,9 +4,8 @@ APPNAME := ${app} BUILDSPACE := build BOARDNAME := NODE_F767ZI -# this BOARDPATH is for MAC OS (not for Linux) -BOARDPATH := /Volumes/${BOARDNAME} -# BOARDPATH for for Linux is -> BOARDPATH := /media/${USER}/${BOARDNAME} +BOARDPATH := /media/${USER}/${BOARDNAME} +# BOARDPATH for Mac OS -> BOARDPATH := /Volumes/${BOARDNAME} MSGDIR := custom_msgs/${msg} MROS2DIR := ../mros2 From ebf4cb64d435ce86f39a0bb5d8bf63c7a83d37bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sun, 13 Feb 2022 16:01:34 +0900 Subject: [PATCH 65/80] prepared for merge into main except README --- .expo/.README.md.icloud | Bin 157 -> 0 bytes .expo/.settings.json.icloud | Bin 160 -> 0 bytes .gitignore | 14 +------------- header_includer/header_includer.hpp | 1 - 4 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 .expo/.README.md.icloud delete mode 100644 .expo/.settings.json.icloud diff --git a/.expo/.README.md.icloud b/.expo/.README.md.icloud deleted file mode 100644 index 0fd5d5ae176b80c52ad7eaf54e310e031e0f6752..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 157 zcmYc)$jK}&F)+By$i&RT$`<1n92(@~mzbOComv?$AOPmNW#*&?XI4RkB;Z0psm1xF zMaiill?5QF$RJlo7hhMs+!R4(>39Jdtm=YN(@S#_i#YgY^u0pD8Nh&%5kfPtLunXQ F1_0L=DBJ)5 diff --git a/.expo/.settings.json.icloud b/.expo/.settings.json.icloud deleted file mode 100644 index e9807bbec133178366521bc2e3bc1f539acebfc7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 160 zcmYc)$jK}&F)+By$i&RT$`<1n92(@~mzbOComv?$AOPmNW#*&?XI4RkB;Z0psm1xF zMaiill?5QF*y7ZZlFYpHV!f>5{5*k*cmWx#N`q3 Date: Sun, 13 Feb 2022 17:00:09 +0900 Subject: [PATCH 66/80] fix README for some apps --- workspace/echoreply_header/templates.hpp | 11 +++++++++++ workspace/echoreply_joint_state/README.md | 8 ++++---- workspace/echoreply_odometry/README.md | 20 ++++++++++---------- workspace/echoreply_twist/README.md | 2 +- 4 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 workspace/echoreply_header/templates.hpp diff --git a/workspace/echoreply_header/templates.hpp b/workspace/echoreply_header/templates.hpp new file mode 100644 index 0000000..b352303 --- /dev/null +++ b/workspace/echoreply_header/templates.hpp @@ -0,0 +1,11 @@ + +#include "std_msgs/msg/header.hpp" + + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::Header &msg); + + + +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::Header*)); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/echoreply_joint_state/README.md b/workspace/echoreply_joint_state/README.md index d745839..5cf7cdc 100644 --- a/workspace/echoreply_joint_state/README.md +++ b/workspace/echoreply_joint_state/README.md @@ -37,8 +37,8 @@ JointState型の通信の動作確認をするためのサンプルアプリで 9.messageを受信、これを再びhostのros2アプリに向かって送信する。(以下) ``` -subscribed msg!! -publishing msg!! -subscribed msg!! -publishing msg!! + subscribed msg!! + publishing msg!! + subscribed msg!! + publishing msg!! ``` \ No newline at end of file diff --git a/workspace/echoreply_odometry/README.md b/workspace/echoreply_odometry/README.md index 92c7c88..8584d9c 100644 --- a/workspace/echoreply_odometry/README.md +++ b/workspace/echoreply_odometry/README.md @@ -3,23 +3,23 @@ Odometry型の通信の動作確認をするためのサンプルアプリです。 以下の手順で確認できます。 -1.workspace/custom_msgsで、nav_msgs/msg/Odometry.msgを作成し、Odometry型を定義する。なお、Odometry型には多くの任意型(PoseWithCovariance, TwistWithCovariance, ...) を含むので、それらの定義も各ファイルで行う。 +1.workspace/custom_msgsで、nav_msgs/msg/Odometry.msgを作成し、Odometry型を定義する。なお、Odometry型は多くの任意型(PoseWithCovariance, TwistWithCovariance, ...) を含むので、それらの定義も各ファイルで行う。 ``` header header string child_frame_id geometry_msgs/msg/PoseWithCovariance pose geometry_msgs/msg/TwistWithCovariance twist - ``` + ``` 2.nav_msgs内にmsg_settings.jsonを作成し、以下のように書き込む。今回通信に用いるのはOdometry型なので、Odometry型定義ファイルの場所を書き込む。 -``` + ``` { "pubsubMsgs": [ "nav_msgs/msg/Odometry.msg" ] } -``` + ``` 3.workspaceディレクトリにて、`make gen-msg msg=nav_msgs` によodometry.hppを生成する。 @@ -35,9 +35,9 @@ Odometry型の通信の動作確認をするためのサンプルアプリです 9.messageを受信、これを再びhostのros2アプリに向かって送信する。(以下) -``` -subscribed msg!! -publishing msg!! -subscribed msg!! -publishing msg!! -``` \ No newline at end of file + ``` + subscribed msg!! + publishing msg!! + subscribed msg!! + publishing msg!! + ``` \ No newline at end of file diff --git a/workspace/echoreply_twist/README.md b/workspace/echoreply_twist/README.md index 1884ab1..c1670a1 100644 --- a/workspace/echoreply_twist/README.md +++ b/workspace/echoreply_twist/README.md @@ -1,7 +1,7 @@ ### Twist型通信動作確認用アプリ Twist型の通信の動作確認をするためのサンプルアプリです。 -Twist型とは、2つのVector3型からなるメッセージ型です。 +Twist型は、2つのVector3型からなるメッセージ型です。 Vector3型は、3つのfloat64型からなるメッセージ型です。 以下の手順で確認できます。 From c40c8def967408a8623869f6757136b81b70bcfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Mon, 14 Feb 2022 12:34:40 +0900 Subject: [PATCH 67/80] delete joint_state/odometry apps --- workspace/echoreply_joint_state/Makefile.inc | 27 ---- workspace/echoreply_joint_state/README.md | 44 ------ workspace/echoreply_joint_state/app.cdl | 122 ----------------- workspace/echoreply_joint_state/app.cfg | 14 -- workspace/echoreply_joint_state/app.cpp | 44 ------ workspace/echoreply_joint_state/app.h | 84 ------------ .../config/autosar_os_ext_asp3_user_config.c | 24 ---- .../config/autosar_os_ext_asp3_user_config.h | 10 -- .../config/autosar_os_ext_user_config.c | 75 ----------- .../config/autosar_os_ext_user_config.h | 22 --- .../config/mros2_user_config.c | 10 -- .../echoreply_joint_state/config/task.cfg | 24 ---- workspace/echoreply_joint_state/task_impl.c | 126 ------------------ workspace/echoreply_joint_state/task_impl.h | 54 -------- workspace/echoreply_joint_state/templates.hpp | 11 -- workspace/echoreply_odometry/Makefile.inc | 27 ---- workspace/echoreply_odometry/README.md | 43 ------ workspace/echoreply_odometry/app.cdl | 122 ----------------- workspace/echoreply_odometry/app.cfg | 14 -- workspace/echoreply_odometry/app.cpp | 44 ------ workspace/echoreply_odometry/app.h | 84 ------------ .../config/autosar_os_ext_asp3_user_config.c | 24 ---- .../config/autosar_os_ext_asp3_user_config.h | 10 -- .../config/autosar_os_ext_user_config.c | 75 ----------- .../config/autosar_os_ext_user_config.h | 22 --- .../config/mros2_user_config.c | 10 -- workspace/echoreply_odometry/config/task.cfg | 24 ---- workspace/echoreply_odometry/task_impl.c | 126 ------------------ workspace/echoreply_odometry/task_impl.h | 54 -------- workspace/echoreply_odometry/templates.hpp | 11 -- 30 files changed, 1381 deletions(-) delete mode 100644 workspace/echoreply_joint_state/Makefile.inc delete mode 100644 workspace/echoreply_joint_state/README.md delete mode 100644 workspace/echoreply_joint_state/app.cdl delete mode 100644 workspace/echoreply_joint_state/app.cfg delete mode 100644 workspace/echoreply_joint_state/app.cpp delete mode 100644 workspace/echoreply_joint_state/app.h delete mode 100644 workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.c delete mode 100644 workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.h delete mode 100644 workspace/echoreply_joint_state/config/autosar_os_ext_user_config.c delete mode 100644 workspace/echoreply_joint_state/config/autosar_os_ext_user_config.h delete mode 100644 workspace/echoreply_joint_state/config/mros2_user_config.c delete mode 100644 workspace/echoreply_joint_state/config/task.cfg delete mode 100644 workspace/echoreply_joint_state/task_impl.c delete mode 100644 workspace/echoreply_joint_state/task_impl.h delete mode 100644 workspace/echoreply_joint_state/templates.hpp delete mode 100644 workspace/echoreply_odometry/Makefile.inc delete mode 100644 workspace/echoreply_odometry/README.md delete mode 100644 workspace/echoreply_odometry/app.cdl delete mode 100644 workspace/echoreply_odometry/app.cfg delete mode 100644 workspace/echoreply_odometry/app.cpp delete mode 100644 workspace/echoreply_odometry/app.h delete mode 100644 workspace/echoreply_odometry/config/autosar_os_ext_asp3_user_config.c delete mode 100644 workspace/echoreply_odometry/config/autosar_os_ext_asp3_user_config.h delete mode 100644 workspace/echoreply_odometry/config/autosar_os_ext_user_config.c delete mode 100644 workspace/echoreply_odometry/config/autosar_os_ext_user_config.h delete mode 100644 workspace/echoreply_odometry/config/mros2_user_config.c delete mode 100644 workspace/echoreply_odometry/config/task.cfg delete mode 100644 workspace/echoreply_odometry/task_impl.c delete mode 100644 workspace/echoreply_odometry/task_impl.h delete mode 100644 workspace/echoreply_odometry/templates.hpp diff --git a/workspace/echoreply_joint_state/Makefile.inc b/workspace/echoreply_joint_state/Makefile.inc deleted file mode 100644 index f807ac1..0000000 --- a/workspace/echoreply_joint_state/Makefile.inc +++ /dev/null @@ -1,27 +0,0 @@ -# -# Makefile definition for mros2 application -# - -# name of main application -APPLNAME = app - -# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) -# NOTE: also check `initLogMask` in app.cdl for syslog setting -CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 - -# information for directory tree -APPLDIR := $(APPDIR) -APPLDIR += $(APPDIR)/config - -# link option for C++ code -SRCLANG = c++ -APPL_CXXLIBS += -specs=nano.specs - -# compile switch -CDEFS += -DUSE_ASP3_FOR_STM - -# additional files for configuration -APPL_COBJS := task_impl.o -APPL_COBJS += autosar_os_ext_user_config.o -APPL_COBJS += autosar_os_ext_asp3_user_config.o -APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_joint_state/README.md b/workspace/echoreply_joint_state/README.md deleted file mode 100644 index 5cf7cdc..0000000 --- a/workspace/echoreply_joint_state/README.md +++ /dev/null @@ -1,44 +0,0 @@ -### JointState型通信動作確認用アプリ - -JointState型の通信の動作確認をするためのサンプルアプリです。 -以下の手順で確認できます。 - -1.workspace/custom_msgsで、sensor_msgs/msg/JointState.msgを作成し、JointState型を定義する。 - - ``` - header header - string[] name - float64[] position - float64[] velocity - float64[] effort - ``` - -2.sensor_msgs内にmsg_settings.jsonを作成し、以下のように書き込む。今回通信に用いるのはJointState型なので、JointState型定義ファイルの場所を書き込む。 -``` - { - "pubsubMsgs": [ - "sensor_msgs/msg/JointState.msg" - ] - } -``` - -3.workspaceディレクトリにて、`make gen-msg msg=sensor_msgs` によjoint_state.hppを生成する。 - -4.mros2-asp3-f767ziディレクトリにmros2_msgs/sensor_msgs/msg/joint_state.hppが生成されていることを確認する。 - -5.echoreply_joint_stateアプリ内で、生成したjoint_state.hppをincludeして使用する。 - -6.workspaceディレクトリにて、`make app=echoreply_joint_state` によりアプリをビルドする。 - -7.Serial Console (picocomなど) を立ち上げて、初期化する。 - -8.hostのros2アプリからJointState型のmessageを送信する。 - -9.messageを受信、これを再びhostのros2アプリに向かって送信する。(以下) - -``` - subscribed msg!! - publishing msg!! - subscribed msg!! - publishing msg!! -``` \ No newline at end of file diff --git a/workspace/echoreply_joint_state/app.cdl b/workspace/echoreply_joint_state/app.cdl deleted file mode 100644 index 176c5a6..0000000 --- a/workspace/echoreply_joint_state/app.cdl +++ /dev/null @@ -1,122 +0,0 @@ -/* - * サンプルプログラム(1)のコンポーネント記述ファイル - * - * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ - */ -/* - * カーネルオブジェクトの定義 - */ -import(); - -/* - * ターゲット非依存のセルタイプの定義 - */ -import("syssvc/tSerialPort.cdl"); -import("syssvc/tSerialAdapter.cdl"); -import("syssvc/tSysLog.cdl"); -import("syssvc/tSysLogAdapter.cdl"); -import("syssvc/tLogTask.cdl"); -import("syssvc/tBanner.cdl"); - -/* - * ターゲット依存部の取り込み - */ -import("target.cdl"); - -/* - * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" - * の行までのことを言う. - */ - -/* - * システムログ機能のアダプタの組上げ記述 - * - * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー - * スのシステムログ機能を呼び出すためのセルである.システムログ機能の - * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び - * 出さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSysLogAdapter SysLogAdapter { - cSysLog = SysLog.eSysLog; -}; - -/* - * シリアルインタフェースドライバのアダプタの組上げ記述 - * - * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー - * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための - * セルである.シリアルインタフェースドライバのサービスコールを呼び出 - * さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSerialAdapter SerialAdapter { - cSerialPort[0] = SerialPort1.eSerialPort; -}; - -/* - * システムログ機能の組上げ記述 - * - * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ - * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, - * システムログタスクはシステムログ機能を使用するため,それも外すこと - * が必要である.また,システムログ機能のアダプタも外さなければならな - * い.tecsgenが警告メッセージを出すが,無視してよい. - */ -cell tSysLog SysLog { - logBufferSize = 32; /* ログバッファのサイズ */ - initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); - /* ログバッファに記録すべき重要度 */ - initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); - /* 低レベル出力すべき重要度 */ - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * シリアルインタフェースドライバの組上げ記述 - * - * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 - * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー - * スドライバを使用するため,それも外すことが必要である.また,シリア - * ルインタフェースドライバのアダプタも外さなければならない. - */ -cell tSerialPort SerialPort1 { - receiveBufferSize = 256; /* 受信バッファのサイズ */ - sendBufferSize = 256; /* 送信バッファのサイズ */ - - /* ターゲット依存部との結合 */ - cSIOPort = SIOPortTarget1.eSIOPort; - eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ -}; - -/* - * システムログタスクの組上げ記述 - * - * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ - * ばよい. - */ -cell tLogTask LogTask { - priority = 3; /* システムログタスクの優先度 */ - stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ - - /* シリアルインタフェースドライバとの結合 */ - cSerialPort = SerialPort1.eSerialPort; - cnSerialPortManage = SerialPort1.enSerialPortManage; - - /* システムログ機能との結合 */ - cSysLog = SysLog.eSysLog; - - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * カーネル起動メッセージ出力の組上げ記述 - * - * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 - * を削除すればよい. - */ -cell tBanner Banner { - /* 属性の設定 */ - targetName = BannerTargetName; - copyrightNotice = BannerCopyrightNotice; -}; diff --git a/workspace/echoreply_joint_state/app.cfg b/workspace/echoreply_joint_state/app.cfg deleted file mode 100644 index eb0495d..0000000 --- a/workspace/echoreply_joint_state/app.cfg +++ /dev/null @@ -1,14 +0,0 @@ -/* - * サンプルプログラム(1)のシステムコンフィギュレーションファイル - */ -INCLUDE("tecsgen.cfg"); -INCLUDE("asp3ext.cfg"); -INCLUDE("task.cfg"); - -#include "app.h" -#include "stm32f7xx_it.h" -CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); -CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); -CFG_INT(77, {TA_EDGE, -4}); - -CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_joint_state/app.cpp b/workspace/echoreply_joint_state/app.cpp deleted file mode 100644 index 1885dac..0000000 --- a/workspace/echoreply_joint_state/app.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "app.h" -#include "mros2.h" -#include "sensor_msgs/msg/joint_state.hpp" - -#include "stm32f7xx_nucleo_144.h" - -mros2::Subscriber sub; -mros2::Publisher pub; - -void userCallback(sensor_msgs::msg::JointState *msg) -{ - MROS2_INFO("subscribed msg!!"); - MROS2_INFO("publishing msg!!"); - pub.publish(*msg); -} - -int main(int argc, char * argv[]) -{ - MROS2_INFO("mROS 2 application is started"); - - mros2::init(argc, argv); - MROS2_DEBUG("mROS 2 initialization is completed"); - BSP_LED_Toggle(LED1); - - mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - sensor_msgs::msg::JointState msg; - - MROS2_INFO("ready to pub/sub message"); - mros2::spin(); - BSP_LED_Toggle(LED3); -} - -void main_task(void) -{ - main(0, NULL); -} - -void -led_cyclic_handler(intptr_t exinf) -{ - BSP_LED_Toggle(LED2); -} \ No newline at end of file diff --git a/workspace/echoreply_joint_state/app.h b/workspace/echoreply_joint_state/app.h deleted file mode 100644 index 36eb6cf..0000000 --- a/workspace/echoreply_joint_state/app.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * TOPPERS/ASP Kernel - * Toyohashi Open Platform for Embedded Real-Time Systems/ - * Advanced Standard Profile Kernel - * - * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory - * Toyohashi Univ. of Technology, JAPAN - * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory - * Graduate School of Information Science, Nagoya Univ., JAPAN - * - * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ - * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 - * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. - * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 - * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー - * スコード中に含まれていること. - * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 - * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 - * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 - * の無保証規定を掲載すること. - * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 - * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ - * と. - * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 - * 作権表示,この利用条件および下記の無保証規定を掲載すること. - * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに - * 報告すること. - * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 - * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. - * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 - * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを - * 免責すること. - * - * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お - * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 - * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ - * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ - * の責任を負わない. - * - * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ - */ - -/* - * header file for the mros2 application - */ - -#include - -/* - * Priorities for TOPPERS tasks - */ - -#define MAIN_PRIORITY 5 - -#define HIGH_PRIORITY 9 -#define MID_PRIORITY 10 -#define LOW_PRIORITY 11 - -/* - * Constants that may depend on the target - */ - -#ifndef TASK_PORTID -#define TASK_PORTID 1 -#endif /* TASK_PORTID */ - -#ifndef STACK_SIZE -#define STACK_SIZE 4096 -#endif /* STACK_SIZE */ - -/* - * Declaration of prototyle functions - */ -#ifndef TOPPERS_MACRO_ONLY -#ifdef __cplusplus -extern "C" { -#endif -void main_task(void); -extern void led_cyclic_handler(intptr_t exinf); -#ifdef __cplusplus -} -#endif -void Error_Handler(); -#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.c deleted file mode 100644 index 41ef1da..0000000 --- a/workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "autosar_os_ext_asp3_user_config.h" - -const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), -}; - -const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) -{ - return autosar_os_ext_flag_user_map; -} - -int cmsis_get_flag_user_num(void) -{ - return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; -} diff --git a/workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.h deleted file mode 100644 index 7ad08bf..0000000 --- a/workspace/echoreply_joint_state/config/autosar_os_ext_asp3_user_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ - -#include "cmsis_config_utl.h" - -#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) - -extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; - -#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_joint_state/config/autosar_os_ext_user_config.c b/workspace/echoreply_joint_state/config/autosar_os_ext_user_config.c deleted file mode 100644 index 940941b..0000000 --- a/workspace/echoreply_joint_state/config/autosar_os_ext_user_config.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "cmsis_os.h" -#include "autosar_os_ext_user_config.h" - -extern void tcpip_thread(void *arg); -extern void ethernetif_set_link(void* argument); -extern void ethernetif_input(void* argument); -extern void callHbPubFunc(void *arg); -extern void callHbSubFunc(void *arg); -extern void StartDefaultTask(void * argument); -extern void callWriterThreadFunction(void *arg); -extern void callReaderThreadFunction(void *arg); -extern void callRunBroadcast(void *args); -extern void mros2_init(void *args); - - -UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { - { - .taskID = AutosarOsExtTcpTask, - .func = tcpip_thread, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthIfLinkTask, - .func = ethernetif_set_link, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthInputTask, - .func = ethernetif_input, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBPubTask, - .func = callHbPubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBSubTask, - .func = callHbSubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtSPDPTask, - .func = callRunBroadcast, - .argument = NULL, - }, - { - .taskID = AutosarOsExtWriterTask, - .func = callWriterThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtReaderTask, - .func = callReaderThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtMROS2Task, - .func = mros2_init, - .argument = NULL, - }, -}; - -UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) -{ - return user_thread_autosar_ostask_map; -} -int cmsis_get_app_heap_size(void) -{ - return APP_HEAP_SIZE; -} -int cmsis_get_user_thread_num(void) -{ - return USER_THREAD_NUM; -} diff --git a/workspace/echoreply_joint_state/config/autosar_os_ext_user_config.h b/workspace/echoreply_joint_state/config/autosar_os_ext_user_config.h deleted file mode 100644 index bab78d3..0000000 --- a/workspace/echoreply_joint_state/config/autosar_os_ext_user_config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ - -#include "cmsis_os.h" -#include "cmsis_config_utl.h" - -/*********************************************** - * - * MEMORY - * - ***********************************************/ -#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ - - -/*********************************************** - * - * THREAD - * - ***********************************************/ -#define USER_THREAD_NUM 9U - -#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_joint_state/config/mros2_user_config.c b/workspace/echoreply_joint_state/config/mros2_user_config.c deleted file mode 100644 index 7d2c110..0000000 --- a/workspace/echoreply_joint_state/config/mros2_user_config.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#define SUB_MSG_COUNT 10 - -int mros2_get_submsg_count(void) -{ - return SUB_MSG_COUNT; -} - - diff --git a/workspace/echoreply_joint_state/config/task.cfg b/workspace/echoreply_joint_state/config/task.cfg deleted file mode 100644 index f577110..0000000 --- a/workspace/echoreply_joint_state/config/task.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#include "task_impl.h" - -CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); -CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); -CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); -CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); -CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); -CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); -CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); -CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); -CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); -CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); - -CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_joint_state/task_impl.c b/workspace/echoreply_joint_state/task_impl.c deleted file mode 100644 index afb9fca..0000000 --- a/workspace/echoreply_joint_state/task_impl.c +++ /dev/null @@ -1,126 +0,0 @@ -#include "cmsis_os.h" -#include "cmsis_config_utl.h" -#include "task_impl.h" - -TASK(AutosarOsExtTcpTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthIfLinkTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthInputTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBPubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBSubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtSPDPTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtWriterTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtReaderTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtUserDefaultTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtMROS2Task) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} diff --git a/workspace/echoreply_joint_state/task_impl.h b/workspace/echoreply_joint_state/task_impl.h deleted file mode 100644 index 11e7a81..0000000 --- a/workspace/echoreply_joint_state/task_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_TEST_H_ -#define _AUTOSAR_OS_EXT_TEST_H_ - -#include "cmsis_config_utl.h" - -extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); - -/* - * priorities of mROS 2 tasks for RTPS - * - * TODO: We assigned relatevely lower priorities for EthIfLinkTask and - * EthInputTask than the application. Check whether these are appropriate. - */ -#define MROS2_HIGH_PRIORITY MAIN_PRIORITY -#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 - -/* - * experimental: stack size of mROS 2 tasks for RTPS - * Each comment refers the location of original definition - */ -// application/include/lwipopt.h -// #define TCPIP_THREAD_STACKSIZE 1024 -#define MROS2_STACK_SIZE_TcpTask 1024 -// application/src/lwip.c -// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) -#define MROS2_STACK_SIZE_EthIfLinkTask 1024 -// application/src/ethernet.c -// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) -#define MROS2_STACK_SIZE_EthInputTask 350 -// embeddedRTPS/include/config.h -// const int HEARTBEAT_STACKSIZE = 1200; // byte -#define MROS2_STACK_SIZE_HBPubTask 1200 -#define MROS2_STACK_SIZE_HBSubTask 1200 -// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte -#define MROS2_STACK_SIZE_SPDPTask 550 -// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte -#define MROS2_STACK_SIZE_WriterTask 1100 -// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte -#define MROS2_STACK_SIZE_ReaderTask 1600 -// embeddedRTPS-STM32/stm32/Src/main.cpp -// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); -#define MROS2_STACK_SIZE_UserDefaultTask 250 - - -#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/echoreply_joint_state/templates.hpp b/workspace/echoreply_joint_state/templates.hpp deleted file mode 100644 index 875b397..0000000 --- a/workspace/echoreply_joint_state/templates.hpp +++ /dev/null @@ -1,11 +0,0 @@ - -#include "sensor_msgs/msg/joint_state.hpp" - - -template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); -template void mros2::Publisher::publish(sensor_msgs::msg::JointState &msg); - - - -template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(sensor_msgs::msg::JointState*)); -template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/echoreply_odometry/Makefile.inc b/workspace/echoreply_odometry/Makefile.inc deleted file mode 100644 index f807ac1..0000000 --- a/workspace/echoreply_odometry/Makefile.inc +++ /dev/null @@ -1,27 +0,0 @@ -# -# Makefile definition for mros2 application -# - -# name of main application -APPLNAME = app - -# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) -# NOTE: also check `initLogMask` in app.cdl for syslog setting -CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 - -# information for directory tree -APPLDIR := $(APPDIR) -APPLDIR += $(APPDIR)/config - -# link option for C++ code -SRCLANG = c++ -APPL_CXXLIBS += -specs=nano.specs - -# compile switch -CDEFS += -DUSE_ASP3_FOR_STM - -# additional files for configuration -APPL_COBJS := task_impl.o -APPL_COBJS += autosar_os_ext_user_config.o -APPL_COBJS += autosar_os_ext_asp3_user_config.o -APPL_COBJS += mros2_user_config.o diff --git a/workspace/echoreply_odometry/README.md b/workspace/echoreply_odometry/README.md deleted file mode 100644 index 8584d9c..0000000 --- a/workspace/echoreply_odometry/README.md +++ /dev/null @@ -1,43 +0,0 @@ -### Odometry型通信動作確認用アプリ - -Odometry型の通信の動作確認をするためのサンプルアプリです。 -以下の手順で確認できます。 - -1.workspace/custom_msgsで、nav_msgs/msg/Odometry.msgを作成し、Odometry型を定義する。なお、Odometry型は多くの任意型(PoseWithCovariance, TwistWithCovariance, ...) を含むので、それらの定義も各ファイルで行う。 - - ``` - header header - string child_frame_id - geometry_msgs/msg/PoseWithCovariance pose - geometry_msgs/msg/TwistWithCovariance twist - ``` - -2.nav_msgs内にmsg_settings.jsonを作成し、以下のように書き込む。今回通信に用いるのはOdometry型なので、Odometry型定義ファイルの場所を書き込む。 - ``` - { - "pubsubMsgs": [ - "nav_msgs/msg/Odometry.msg" - ] - } - ``` - -3.workspaceディレクトリにて、`make gen-msg msg=nav_msgs` によodometry.hppを生成する。 - -4.mros2-asp3-f767ziディレクトリにmros2_msgs/nav_msgs/msg/odometry.hppが生成されていることを確認する。 - -5.echoreply_odometryアプリ内で、生成したodometry.hppをincludeして使用する。 - -6.workspaceディレクトリにて、`make app=echoreply_odometry` によりアプリをビルドする。 - -7.Serial Console (picocomなど) を立ち上げて、初期化する。 - -8.hostのros2アプリからOdometry型のmessageを送信する。 - -9.messageを受信、これを再びhostのros2アプリに向かって送信する。(以下) - - ``` - subscribed msg!! - publishing msg!! - subscribed msg!! - publishing msg!! - ``` \ No newline at end of file diff --git a/workspace/echoreply_odometry/app.cdl b/workspace/echoreply_odometry/app.cdl deleted file mode 100644 index 176c5a6..0000000 --- a/workspace/echoreply_odometry/app.cdl +++ /dev/null @@ -1,122 +0,0 @@ -/* - * サンプルプログラム(1)のコンポーネント記述ファイル - * - * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ - */ -/* - * カーネルオブジェクトの定義 - */ -import(); - -/* - * ターゲット非依存のセルタイプの定義 - */ -import("syssvc/tSerialPort.cdl"); -import("syssvc/tSerialAdapter.cdl"); -import("syssvc/tSysLog.cdl"); -import("syssvc/tSysLogAdapter.cdl"); -import("syssvc/tLogTask.cdl"); -import("syssvc/tBanner.cdl"); - -/* - * ターゲット依存部の取り込み - */ -import("target.cdl"); - -/* - * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" - * の行までのことを言う. - */ - -/* - * システムログ機能のアダプタの組上げ記述 - * - * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー - * スのシステムログ機能を呼び出すためのセルである.システムログ機能の - * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び - * 出さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSysLogAdapter SysLogAdapter { - cSysLog = SysLog.eSysLog; -}; - -/* - * シリアルインタフェースドライバのアダプタの組上げ記述 - * - * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー - * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための - * セルである.シリアルインタフェースドライバのサービスコールを呼び出 - * さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSerialAdapter SerialAdapter { - cSerialPort[0] = SerialPort1.eSerialPort; -}; - -/* - * システムログ機能の組上げ記述 - * - * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ - * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, - * システムログタスクはシステムログ機能を使用するため,それも外すこと - * が必要である.また,システムログ機能のアダプタも外さなければならな - * い.tecsgenが警告メッセージを出すが,無視してよい. - */ -cell tSysLog SysLog { - logBufferSize = 32; /* ログバッファのサイズ */ - initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); - /* ログバッファに記録すべき重要度 */ - initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); - /* 低レベル出力すべき重要度 */ - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * シリアルインタフェースドライバの組上げ記述 - * - * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 - * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー - * スドライバを使用するため,それも外すことが必要である.また,シリア - * ルインタフェースドライバのアダプタも外さなければならない. - */ -cell tSerialPort SerialPort1 { - receiveBufferSize = 256; /* 受信バッファのサイズ */ - sendBufferSize = 256; /* 送信バッファのサイズ */ - - /* ターゲット依存部との結合 */ - cSIOPort = SIOPortTarget1.eSIOPort; - eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ -}; - -/* - * システムログタスクの組上げ記述 - * - * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ - * ばよい. - */ -cell tLogTask LogTask { - priority = 3; /* システムログタスクの優先度 */ - stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ - - /* シリアルインタフェースドライバとの結合 */ - cSerialPort = SerialPort1.eSerialPort; - cnSerialPortManage = SerialPort1.enSerialPortManage; - - /* システムログ機能との結合 */ - cSysLog = SysLog.eSysLog; - - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * カーネル起動メッセージ出力の組上げ記述 - * - * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 - * を削除すればよい. - */ -cell tBanner Banner { - /* 属性の設定 */ - targetName = BannerTargetName; - copyrightNotice = BannerCopyrightNotice; -}; diff --git a/workspace/echoreply_odometry/app.cfg b/workspace/echoreply_odometry/app.cfg deleted file mode 100644 index eb0495d..0000000 --- a/workspace/echoreply_odometry/app.cfg +++ /dev/null @@ -1,14 +0,0 @@ -/* - * サンプルプログラム(1)のシステムコンフィギュレーションファイル - */ -INCLUDE("tecsgen.cfg"); -INCLUDE("asp3ext.cfg"); -INCLUDE("task.cfg"); - -#include "app.h" -#include "stm32f7xx_it.h" -CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); -CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); -CFG_INT(77, {TA_EDGE, -4}); - -CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/echoreply_odometry/app.cpp b/workspace/echoreply_odometry/app.cpp deleted file mode 100644 index f9e0e74..0000000 --- a/workspace/echoreply_odometry/app.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "app.h" -#include "mros2.h" -#include "nav_msgs/msg/odometry.hpp" - -#include "stm32f7xx_nucleo_144.h" - -mros2::Subscriber sub; -mros2::Publisher pub; - -void userCallback(nav_msgs::msg::Odometry *msg) -{ - MROS2_INFO("subscribed msg!!"); - MROS2_INFO("publishing msg!!"); - pub.publish(*msg); -} - -int main(int argc, char * argv[]) -{ - MROS2_INFO("mROS 2 application is started"); - - mros2::init(argc, argv); - MROS2_DEBUG("mROS 2 initialization is completed"); - BSP_LED_Toggle(LED1); - - mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - nav_msgs::msg::Odometry msg; - - MROS2_INFO("ready to pub/sub message"); - mros2::spin(); - BSP_LED_Toggle(LED3); -} - -void main_task(void) -{ - main(0, NULL); -} - -void -led_cyclic_handler(intptr_t exinf) -{ - BSP_LED_Toggle(LED2); -} \ No newline at end of file diff --git a/workspace/echoreply_odometry/app.h b/workspace/echoreply_odometry/app.h deleted file mode 100644 index 36eb6cf..0000000 --- a/workspace/echoreply_odometry/app.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * TOPPERS/ASP Kernel - * Toyohashi Open Platform for Embedded Real-Time Systems/ - * Advanced Standard Profile Kernel - * - * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory - * Toyohashi Univ. of Technology, JAPAN - * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory - * Graduate School of Information Science, Nagoya Univ., JAPAN - * - * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ - * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 - * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. - * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 - * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー - * スコード中に含まれていること. - * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 - * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 - * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 - * の無保証規定を掲載すること. - * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 - * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ - * と. - * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 - * 作権表示,この利用条件および下記の無保証規定を掲載すること. - * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに - * 報告すること. - * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 - * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. - * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 - * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを - * 免責すること. - * - * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お - * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 - * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ - * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ - * の責任を負わない. - * - * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ - */ - -/* - * header file for the mros2 application - */ - -#include - -/* - * Priorities for TOPPERS tasks - */ - -#define MAIN_PRIORITY 5 - -#define HIGH_PRIORITY 9 -#define MID_PRIORITY 10 -#define LOW_PRIORITY 11 - -/* - * Constants that may depend on the target - */ - -#ifndef TASK_PORTID -#define TASK_PORTID 1 -#endif /* TASK_PORTID */ - -#ifndef STACK_SIZE -#define STACK_SIZE 4096 -#endif /* STACK_SIZE */ - -/* - * Declaration of prototyle functions - */ -#ifndef TOPPERS_MACRO_ONLY -#ifdef __cplusplus -extern "C" { -#endif -void main_task(void); -extern void led_cyclic_handler(intptr_t exinf); -#ifdef __cplusplus -} -#endif -void Error_Handler(); -#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/echoreply_odometry/config/autosar_os_ext_asp3_user_config.c b/workspace/echoreply_odometry/config/autosar_os_ext_asp3_user_config.c deleted file mode 100644 index 41ef1da..0000000 --- a/workspace/echoreply_odometry/config/autosar_os_ext_asp3_user_config.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "autosar_os_ext_asp3_user_config.h" - -const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), -}; - -const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) -{ - return autosar_os_ext_flag_user_map; -} - -int cmsis_get_flag_user_num(void) -{ - return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; -} diff --git a/workspace/echoreply_odometry/config/autosar_os_ext_asp3_user_config.h b/workspace/echoreply_odometry/config/autosar_os_ext_asp3_user_config.h deleted file mode 100644 index 7ad08bf..0000000 --- a/workspace/echoreply_odometry/config/autosar_os_ext_asp3_user_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ - -#include "cmsis_config_utl.h" - -#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) - -extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; - -#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_odometry/config/autosar_os_ext_user_config.c b/workspace/echoreply_odometry/config/autosar_os_ext_user_config.c deleted file mode 100644 index 940941b..0000000 --- a/workspace/echoreply_odometry/config/autosar_os_ext_user_config.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "cmsis_os.h" -#include "autosar_os_ext_user_config.h" - -extern void tcpip_thread(void *arg); -extern void ethernetif_set_link(void* argument); -extern void ethernetif_input(void* argument); -extern void callHbPubFunc(void *arg); -extern void callHbSubFunc(void *arg); -extern void StartDefaultTask(void * argument); -extern void callWriterThreadFunction(void *arg); -extern void callReaderThreadFunction(void *arg); -extern void callRunBroadcast(void *args); -extern void mros2_init(void *args); - - -UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { - { - .taskID = AutosarOsExtTcpTask, - .func = tcpip_thread, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthIfLinkTask, - .func = ethernetif_set_link, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthInputTask, - .func = ethernetif_input, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBPubTask, - .func = callHbPubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBSubTask, - .func = callHbSubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtSPDPTask, - .func = callRunBroadcast, - .argument = NULL, - }, - { - .taskID = AutosarOsExtWriterTask, - .func = callWriterThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtReaderTask, - .func = callReaderThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtMROS2Task, - .func = mros2_init, - .argument = NULL, - }, -}; - -UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) -{ - return user_thread_autosar_ostask_map; -} -int cmsis_get_app_heap_size(void) -{ - return APP_HEAP_SIZE; -} -int cmsis_get_user_thread_num(void) -{ - return USER_THREAD_NUM; -} diff --git a/workspace/echoreply_odometry/config/autosar_os_ext_user_config.h b/workspace/echoreply_odometry/config/autosar_os_ext_user_config.h deleted file mode 100644 index bab78d3..0000000 --- a/workspace/echoreply_odometry/config/autosar_os_ext_user_config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ - -#include "cmsis_os.h" -#include "cmsis_config_utl.h" - -/*********************************************** - * - * MEMORY - * - ***********************************************/ -#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ - - -/*********************************************** - * - * THREAD - * - ***********************************************/ -#define USER_THREAD_NUM 9U - -#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/echoreply_odometry/config/mros2_user_config.c b/workspace/echoreply_odometry/config/mros2_user_config.c deleted file mode 100644 index 7d2c110..0000000 --- a/workspace/echoreply_odometry/config/mros2_user_config.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#define SUB_MSG_COUNT 10 - -int mros2_get_submsg_count(void) -{ - return SUB_MSG_COUNT; -} - - diff --git a/workspace/echoreply_odometry/config/task.cfg b/workspace/echoreply_odometry/config/task.cfg deleted file mode 100644 index f577110..0000000 --- a/workspace/echoreply_odometry/config/task.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#include "task_impl.h" - -CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); -CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); -CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); -CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); -CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); -CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); -CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); -CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); -CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); -CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); - -CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/echoreply_odometry/task_impl.c b/workspace/echoreply_odometry/task_impl.c deleted file mode 100644 index afb9fca..0000000 --- a/workspace/echoreply_odometry/task_impl.c +++ /dev/null @@ -1,126 +0,0 @@ -#include "cmsis_os.h" -#include "cmsis_config_utl.h" -#include "task_impl.h" - -TASK(AutosarOsExtTcpTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthIfLinkTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthInputTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBPubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBSubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtSPDPTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtWriterTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtReaderTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtUserDefaultTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtMROS2Task) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} diff --git a/workspace/echoreply_odometry/task_impl.h b/workspace/echoreply_odometry/task_impl.h deleted file mode 100644 index 11e7a81..0000000 --- a/workspace/echoreply_odometry/task_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_TEST_H_ -#define _AUTOSAR_OS_EXT_TEST_H_ - -#include "cmsis_config_utl.h" - -extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); - -/* - * priorities of mROS 2 tasks for RTPS - * - * TODO: We assigned relatevely lower priorities for EthIfLinkTask and - * EthInputTask than the application. Check whether these are appropriate. - */ -#define MROS2_HIGH_PRIORITY MAIN_PRIORITY -#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 - -/* - * experimental: stack size of mROS 2 tasks for RTPS - * Each comment refers the location of original definition - */ -// application/include/lwipopt.h -// #define TCPIP_THREAD_STACKSIZE 1024 -#define MROS2_STACK_SIZE_TcpTask 1024 -// application/src/lwip.c -// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) -#define MROS2_STACK_SIZE_EthIfLinkTask 1024 -// application/src/ethernet.c -// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) -#define MROS2_STACK_SIZE_EthInputTask 350 -// embeddedRTPS/include/config.h -// const int HEARTBEAT_STACKSIZE = 1200; // byte -#define MROS2_STACK_SIZE_HBPubTask 1200 -#define MROS2_STACK_SIZE_HBSubTask 1200 -// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte -#define MROS2_STACK_SIZE_SPDPTask 550 -// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte -#define MROS2_STACK_SIZE_WriterTask 1100 -// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte -#define MROS2_STACK_SIZE_ReaderTask 1600 -// embeddedRTPS-STM32/stm32/Src/main.cpp -// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); -#define MROS2_STACK_SIZE_UserDefaultTask 250 - - -#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/echoreply_odometry/templates.hpp b/workspace/echoreply_odometry/templates.hpp deleted file mode 100644 index 1c677f6..0000000 --- a/workspace/echoreply_odometry/templates.hpp +++ /dev/null @@ -1,11 +0,0 @@ - -#include "nav_msgs/msg/odometry.hpp" - - -template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); -template void mros2::Publisher::publish(nav_msgs::msg::Odometry &msg); - - - -template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(nav_msgs::msg::Odometry*)); -template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); From 991ce53e7c5e3c9c78e344690b023d156f74bbfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Mon, 14 Feb 2022 21:38:15 +0900 Subject: [PATCH 68/80] clean workspace/ for v2.4.0 --- workspace/Makefile | 2 +- .../geometry_msgs/msg/PoseWithCovariance.msg | 2 - .../geometry_msgs/msg/TwistWithCovariance.msg | 2 - .../custom_msgs/nav_msgs/msg/Odometry.msg | 4 - .../custom_msgs/nav_msgs/msg_settings.json | 5 - .../sensor_msgs/msg/JointState.msg | 5 - .../custom_msgs/sensor_msgs/msg_settings.json | 5 - workspace/echoreply_float32/README.md | 26 ---- workspace/echoreply_header/README.md | 19 --- workspace/echoreply_header/app.cpp | 44 ------ workspace/echoreply_header/templates.hpp | 11 -- workspace/echoreply_string/README.md | 14 +- workspace/echoreply_string/app.cpp | 4 +- workspace/echoreply_twist/README.md | 49 ------- workspace/echoreply_twist/app.cpp | 44 ------ workspace/echoreply_twist/templates.hpp | 11 -- .../Makefile.inc | 0 workspace/pub_float32/README.md | 24 ++++ .../app.cdl | 0 .../app.cfg | 0 .../app.cpp | 31 ++--- .../{echoreply_float32 => pub_float32}/app.h | 0 .../config/autosar_os_ext_asp3_user_config.c | 0 .../config/autosar_os_ext_asp3_user_config.h | 0 .../config/autosar_os_ext_user_config.c | 0 .../config/autosar_os_ext_user_config.h | 0 .../config/mros2_user_config.c | 0 .../config/task.cfg | 0 .../task_impl.c | 0 .../task_impl.h | 0 workspace/pub_float32/templates.hpp | 8 ++ workspace/pub_string/Makefile.inc | 27 ---- workspace/pub_string/README.md | 17 --- workspace/pub_string/app.cdl | 122 ----------------- workspace/pub_string/app.cfg | 14 -- workspace/pub_string/app.cpp | 42 ------ workspace/pub_string/app.h | 84 ------------ .../config/autosar_os_ext_asp3_user_config.c | 24 ---- .../config/autosar_os_ext_asp3_user_config.h | 10 -- .../config/autosar_os_ext_user_config.c | 75 ----------- .../config/autosar_os_ext_user_config.h | 22 --- .../pub_string/config/mros2_user_config.c | 10 -- workspace/pub_string/config/task.cfg | 24 ---- workspace/pub_string/task_impl.c | 126 ------------------ workspace/pub_string/task_impl.h | 54 -------- .../Makefile.inc | 0 workspace/pub_twist/README.md | 65 +++++++++ .../{echoreply_header => pub_twist}/app.cdl | 0 .../{echoreply_header => pub_twist}/app.cfg | 0 workspace/pub_twist/app.cpp | 55 ++++++++ .../{echoreply_header => pub_twist}/app.h | 0 .../config/autosar_os_ext_asp3_user_config.c | 0 .../config/autosar_os_ext_asp3_user_config.h | 0 .../config/autosar_os_ext_user_config.c | 0 .../config/autosar_os_ext_user_config.h | 0 .../config/mros2_user_config.c | 0 .../config/task.cfg | 0 .../task_impl.c | 0 .../task_impl.h | 0 workspace/pub_twist/templates.hpp | 8 ++ .../Makefile.inc | 0 workspace/sub_pose/README.md | 73 ++++++++++ .../{echoreply_twist => sub_pose}/app.cdl | 0 .../{echoreply_twist => sub_pose}/app.cfg | 0 workspace/{sub_string => sub_pose}/app.cpp | 18 +-- workspace/{echoreply_twist => sub_pose}/app.h | 0 .../config/autosar_os_ext_asp3_user_config.c | 0 .../config/autosar_os_ext_asp3_user_config.h | 0 .../config/autosar_os_ext_user_config.c | 0 .../config/autosar_os_ext_user_config.h | 0 .../config/mros2_user_config.c | 0 .../config/task.cfg | 0 .../{echoreply_twist => sub_pose}/task_impl.c | 0 .../{echoreply_twist => sub_pose}/task_impl.h | 0 workspace/sub_pose/templates.hpp | 8 ++ workspace/sub_string/Makefile.inc | 27 ---- workspace/sub_string/README.md | 19 --- workspace/sub_string/app.cdl | 122 ----------------- workspace/sub_string/app.cfg | 14 -- workspace/sub_string/app.h | 84 ------------ .../config/autosar_os_ext_asp3_user_config.c | 24 ---- .../config/autosar_os_ext_asp3_user_config.h | 10 -- .../config/autosar_os_ext_user_config.c | 75 ----------- .../config/autosar_os_ext_user_config.h | 22 --- .../sub_string/config/mros2_user_config.c | 10 -- workspace/sub_string/config/task.cfg | 24 ---- workspace/sub_string/task_impl.c | 126 ------------------ workspace/sub_string/task_impl.h | 54 -------- .../Makefile.inc | 0 .../README.md | 0 .../{echoreply_uint16 => sub_uint16}/app.cdl | 0 .../{echoreply_uint16 => sub_uint16}/app.cfg | 0 .../{echoreply_uint16 => sub_uint16}/app.cpp | 5 - .../{echoreply_uint16 => sub_uint16}/app.h | 0 .../config/autosar_os_ext_asp3_user_config.c | 0 .../config/autosar_os_ext_asp3_user_config.h | 0 .../config/autosar_os_ext_user_config.c | 0 .../config/autosar_os_ext_user_config.h | 0 .../config/mros2_user_config.c | 0 .../config/task.cfg | 0 .../task_impl.c | 0 .../task_impl.h | 0 workspace/sub_uint16/templates.hpp | 8 ++ 103 files changed, 281 insertions(+), 1531 deletions(-) delete mode 100644 workspace/custom_msgs/geometry_msgs/msg/PoseWithCovariance.msg delete mode 100644 workspace/custom_msgs/geometry_msgs/msg/TwistWithCovariance.msg delete mode 100644 workspace/custom_msgs/nav_msgs/msg/Odometry.msg delete mode 100644 workspace/custom_msgs/nav_msgs/msg_settings.json delete mode 100644 workspace/custom_msgs/sensor_msgs/msg/JointState.msg delete mode 100644 workspace/custom_msgs/sensor_msgs/msg_settings.json delete mode 100644 workspace/echoreply_float32/README.md delete mode 100644 workspace/echoreply_header/README.md delete mode 100644 workspace/echoreply_header/app.cpp delete mode 100644 workspace/echoreply_header/templates.hpp delete mode 100644 workspace/echoreply_twist/README.md delete mode 100644 workspace/echoreply_twist/app.cpp delete mode 100644 workspace/echoreply_twist/templates.hpp rename workspace/{echoreply_float32 => pub_float32}/Makefile.inc (100%) create mode 100644 workspace/pub_float32/README.md rename workspace/{echoreply_float32 => pub_float32}/app.cdl (100%) rename workspace/{echoreply_float32 => pub_float32}/app.cfg (100%) rename workspace/{echoreply_float32 => pub_float32}/app.cpp (51%) rename workspace/{echoreply_float32 => pub_float32}/app.h (100%) rename workspace/{echoreply_float32 => pub_float32}/config/autosar_os_ext_asp3_user_config.c (100%) rename workspace/{echoreply_float32 => pub_float32}/config/autosar_os_ext_asp3_user_config.h (100%) rename workspace/{echoreply_float32 => pub_float32}/config/autosar_os_ext_user_config.c (100%) rename workspace/{echoreply_float32 => pub_float32}/config/autosar_os_ext_user_config.h (100%) rename workspace/{echoreply_float32 => pub_float32}/config/mros2_user_config.c (100%) rename workspace/{echoreply_float32 => pub_float32}/config/task.cfg (100%) rename workspace/{echoreply_float32 => pub_float32}/task_impl.c (100%) rename workspace/{echoreply_float32 => pub_float32}/task_impl.h (100%) create mode 100644 workspace/pub_float32/templates.hpp delete mode 100644 workspace/pub_string/Makefile.inc delete mode 100644 workspace/pub_string/README.md delete mode 100644 workspace/pub_string/app.cdl delete mode 100644 workspace/pub_string/app.cfg delete mode 100644 workspace/pub_string/app.cpp delete mode 100644 workspace/pub_string/app.h delete mode 100644 workspace/pub_string/config/autosar_os_ext_asp3_user_config.c delete mode 100644 workspace/pub_string/config/autosar_os_ext_asp3_user_config.h delete mode 100644 workspace/pub_string/config/autosar_os_ext_user_config.c delete mode 100644 workspace/pub_string/config/autosar_os_ext_user_config.h delete mode 100644 workspace/pub_string/config/mros2_user_config.c delete mode 100644 workspace/pub_string/config/task.cfg delete mode 100644 workspace/pub_string/task_impl.c delete mode 100644 workspace/pub_string/task_impl.h rename workspace/{echoreply_header => pub_twist}/Makefile.inc (100%) create mode 100644 workspace/pub_twist/README.md rename workspace/{echoreply_header => pub_twist}/app.cdl (100%) rename workspace/{echoreply_header => pub_twist}/app.cfg (100%) create mode 100644 workspace/pub_twist/app.cpp rename workspace/{echoreply_header => pub_twist}/app.h (100%) rename workspace/{echoreply_header => pub_twist}/config/autosar_os_ext_asp3_user_config.c (100%) rename workspace/{echoreply_header => pub_twist}/config/autosar_os_ext_asp3_user_config.h (100%) rename workspace/{echoreply_header => pub_twist}/config/autosar_os_ext_user_config.c (100%) rename workspace/{echoreply_header => pub_twist}/config/autosar_os_ext_user_config.h (100%) rename workspace/{echoreply_header => pub_twist}/config/mros2_user_config.c (100%) rename workspace/{echoreply_header => pub_twist}/config/task.cfg (100%) rename workspace/{echoreply_header => pub_twist}/task_impl.c (100%) rename workspace/{echoreply_header => pub_twist}/task_impl.h (100%) create mode 100644 workspace/pub_twist/templates.hpp rename workspace/{echoreply_twist => sub_pose}/Makefile.inc (100%) create mode 100644 workspace/sub_pose/README.md rename workspace/{echoreply_twist => sub_pose}/app.cdl (100%) rename workspace/{echoreply_twist => sub_pose}/app.cfg (100%) rename workspace/{sub_string => sub_pose}/app.cpp (52%) rename workspace/{echoreply_twist => sub_pose}/app.h (100%) rename workspace/{echoreply_twist => sub_pose}/config/autosar_os_ext_asp3_user_config.c (100%) rename workspace/{echoreply_twist => sub_pose}/config/autosar_os_ext_asp3_user_config.h (100%) rename workspace/{echoreply_twist => sub_pose}/config/autosar_os_ext_user_config.c (100%) rename workspace/{echoreply_twist => sub_pose}/config/autosar_os_ext_user_config.h (100%) rename workspace/{echoreply_twist => sub_pose}/config/mros2_user_config.c (100%) rename workspace/{echoreply_twist => sub_pose}/config/task.cfg (100%) rename workspace/{echoreply_twist => sub_pose}/task_impl.c (100%) rename workspace/{echoreply_twist => sub_pose}/task_impl.h (100%) create mode 100644 workspace/sub_pose/templates.hpp delete mode 100644 workspace/sub_string/Makefile.inc delete mode 100644 workspace/sub_string/README.md delete mode 100644 workspace/sub_string/app.cdl delete mode 100644 workspace/sub_string/app.cfg delete mode 100644 workspace/sub_string/app.h delete mode 100644 workspace/sub_string/config/autosar_os_ext_asp3_user_config.c delete mode 100644 workspace/sub_string/config/autosar_os_ext_asp3_user_config.h delete mode 100644 workspace/sub_string/config/autosar_os_ext_user_config.c delete mode 100644 workspace/sub_string/config/autosar_os_ext_user_config.h delete mode 100644 workspace/sub_string/config/mros2_user_config.c delete mode 100644 workspace/sub_string/config/task.cfg delete mode 100644 workspace/sub_string/task_impl.c delete mode 100644 workspace/sub_string/task_impl.h rename workspace/{echoreply_uint16 => sub_uint16}/Makefile.inc (100%) rename workspace/{echoreply_uint16 => sub_uint16}/README.md (100%) rename workspace/{echoreply_uint16 => sub_uint16}/app.cdl (100%) rename workspace/{echoreply_uint16 => sub_uint16}/app.cfg (100%) rename workspace/{echoreply_uint16 => sub_uint16}/app.cpp (76%) rename workspace/{echoreply_uint16 => sub_uint16}/app.h (100%) rename workspace/{echoreply_uint16 => sub_uint16}/config/autosar_os_ext_asp3_user_config.c (100%) rename workspace/{echoreply_uint16 => sub_uint16}/config/autosar_os_ext_asp3_user_config.h (100%) rename workspace/{echoreply_uint16 => sub_uint16}/config/autosar_os_ext_user_config.c (100%) rename workspace/{echoreply_uint16 => sub_uint16}/config/autosar_os_ext_user_config.h (100%) rename workspace/{echoreply_uint16 => sub_uint16}/config/mros2_user_config.c (100%) rename workspace/{echoreply_uint16 => sub_uint16}/config/task.cfg (100%) rename workspace/{echoreply_uint16 => sub_uint16}/task_impl.c (100%) rename workspace/{echoreply_uint16 => sub_uint16}/task_impl.h (100%) create mode 100644 workspace/sub_uint16/templates.hpp diff --git a/workspace/Makefile b/workspace/Makefile index 2b72276..ce3e203 100644 --- a/workspace/Makefile +++ b/workspace/Makefile @@ -5,7 +5,7 @@ BUILDSPACE := build BOARDNAME := NODE_F767ZI BOARDPATH := /media/${USER}/${BOARDNAME} -# BOARDPATH for Mac OS -> BOARDPATH := /Volumes/${BOARDNAME} +# BOARDPATH for MAC OS -> BOARDPATH := /Volumes/${BOARDNAME} MSGDIR := custom_msgs/${msg} MROS2DIR := ../mros2 diff --git a/workspace/custom_msgs/geometry_msgs/msg/PoseWithCovariance.msg b/workspace/custom_msgs/geometry_msgs/msg/PoseWithCovariance.msg deleted file mode 100644 index bfef6c5..0000000 --- a/workspace/custom_msgs/geometry_msgs/msg/PoseWithCovariance.msg +++ /dev/null @@ -1,2 +0,0 @@ -geometry_msgs/msg/Pose pose -float64[36] covariance \ No newline at end of file diff --git a/workspace/custom_msgs/geometry_msgs/msg/TwistWithCovariance.msg b/workspace/custom_msgs/geometry_msgs/msg/TwistWithCovariance.msg deleted file mode 100644 index 82b175c..0000000 --- a/workspace/custom_msgs/geometry_msgs/msg/TwistWithCovariance.msg +++ /dev/null @@ -1,2 +0,0 @@ -geometry_msgs/msg/Twist twist -float64[36] covariance \ No newline at end of file diff --git a/workspace/custom_msgs/nav_msgs/msg/Odometry.msg b/workspace/custom_msgs/nav_msgs/msg/Odometry.msg deleted file mode 100644 index 7c775a9..0000000 --- a/workspace/custom_msgs/nav_msgs/msg/Odometry.msg +++ /dev/null @@ -1,4 +0,0 @@ -header header -string child_frame_id -geometry_msgs/msg/PoseWithCovariance pose -geometry_msgs/msg/TwistWithCovariance twist diff --git a/workspace/custom_msgs/nav_msgs/msg_settings.json b/workspace/custom_msgs/nav_msgs/msg_settings.json deleted file mode 100644 index 150c6eb..0000000 --- a/workspace/custom_msgs/nav_msgs/msg_settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "pubsubMsgs": [ - "nav_msgs/msg/Odometry.msg" - ] -} \ No newline at end of file diff --git a/workspace/custom_msgs/sensor_msgs/msg/JointState.msg b/workspace/custom_msgs/sensor_msgs/msg/JointState.msg deleted file mode 100644 index 5f4e133..0000000 --- a/workspace/custom_msgs/sensor_msgs/msg/JointState.msg +++ /dev/null @@ -1,5 +0,0 @@ -header header -string[] name -float64[] position -float64[] velocity -float64[] effort \ No newline at end of file diff --git a/workspace/custom_msgs/sensor_msgs/msg_settings.json b/workspace/custom_msgs/sensor_msgs/msg_settings.json deleted file mode 100644 index 58b7a6d..0000000 --- a/workspace/custom_msgs/sensor_msgs/msg_settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "pubsubMsgs": [ - "sensor_msgs/msg/JointState.msg" - ] -} \ No newline at end of file diff --git a/workspace/echoreply_float32/README.md b/workspace/echoreply_float32/README.md deleted file mode 100644 index 0a7c33f..0000000 --- a/workspace/echoreply_float32/README.md +++ /dev/null @@ -1,26 +0,0 @@ -### float32型通信動作確認用アプリ - -float32型の通信の動作確認をするためのサンプルアプリです。 -以下の手順で確認できます。 - -1.workspaceディレクトリにて、`make app=echoreply_float32` によりアプリをビルド - -2.Serial Console (picocomなど) を立ち上げて、初期化 - -3.hostのros2アプリからfloat32型のmessageを送信 - -4.messageを受信、これを再びhostのros2アプリに向かって送信 -(ただし、float型の表示上の不具合により、messageが5より大きく10より小さい値の時と、そうでない時で異なる表示がなされる) - -``` -msg <= 5 or 10 <= msg -msg <= 5 or 10 <= msg -msg <= 5 or 10 <= msg -... -msg <= 5 or 10 <= msg -5 < msg < 10 -5 < msg < 10 -5 < msg < 10 -... - -``` diff --git a/workspace/echoreply_header/README.md b/workspace/echoreply_header/README.md deleted file mode 100644 index b3b268b..0000000 --- a/workspace/echoreply_header/README.md +++ /dev/null @@ -1,19 +0,0 @@ -### header型通信動作確認用アプリ - -header型の通信の動作確認をするためのサンプルアプリです。 -以下の手順で確認できます。 - -1.workspaceディレクトリにて、`make app=echoreply_header` によりアプリをビルド - -2.Serial Console (picocomなど) を立ち上げて、初期化 - -3.hostのros2アプリからheader型のmessageを送信 - -4.messageを受信、これを再びhostのros2アプリに向かって送信 (以下) - -``` -subscribed msg!! -publishing msg!! -subscribed msg!! -publishing msg!! -``` diff --git a/workspace/echoreply_header/app.cpp b/workspace/echoreply_header/app.cpp deleted file mode 100644 index 18a8863..0000000 --- a/workspace/echoreply_header/app.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "app.h" -#include "mros2.h" -#include "std_msgs/msg/header.hpp" - -#include "stm32f7xx_nucleo_144.h" - -mros2::Subscriber sub; -mros2::Publisher pub; - -void userCallback(std_msgs::msg::Header *msg) -{ - MROS2_INFO("subscribed msg!!"); - MROS2_INFO("publishing msg!!"); - pub.publish(*msg); -} - -int main(int argc, char * argv[]) -{ - MROS2_INFO("mROS 2 application is started"); - - mros2::init(argc, argv); - MROS2_DEBUG("mROS 2 initialization is completed"); - BSP_LED_Toggle(LED1); - - mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - std_msgs::msg::Header msg; - - MROS2_INFO("ready to pub/sub message"); - mros2::spin(); - BSP_LED_Toggle(LED3); -} - -void main_task(void) -{ - main(0, NULL); -} - -void -led_cyclic_handler(intptr_t exinf) -{ - BSP_LED_Toggle(LED2); -} diff --git a/workspace/echoreply_header/templates.hpp b/workspace/echoreply_header/templates.hpp deleted file mode 100644 index b352303..0000000 --- a/workspace/echoreply_header/templates.hpp +++ /dev/null @@ -1,11 +0,0 @@ - -#include "std_msgs/msg/header.hpp" - - -template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); -template void mros2::Publisher::publish(std_msgs::msg::Header &msg); - - - -template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::Header*)); -template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/echoreply_string/README.md b/workspace/echoreply_string/README.md index 6ae2132..dccd01c 100644 --- a/workspace/echoreply_string/README.md +++ b/workspace/echoreply_string/README.md @@ -2,14 +2,20 @@ string型の通信の動作確認をするためのサンプルアプリです。 以下の手順で確認できます。 +This is a sample application for string-type communication. +Please follow the steps below. -1.workspaceディレクトリにて、`make app=echoreply_string` によりアプリをビルド +1.workspaceディレクトリにて、`make app=echoreply_string` によりアプリをビルドする。 + Execute `make app=echoreply_string` in workspace direcroty, then this app will be built. -2.Serial Console (picocomなど) を立ち上げて、初期化 +2.Serial Console (picocomなど) を立ち上げて、初期化する。 + Open serial console (ex. picocom) and initialize your micro computer board. -3.hostのros2アプリからstring型のmessageを送信 +3.通信するホストデバイス上で、mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) のmros2_echoback_stringアプリを起動する。 + On the host device to communicate with, run mros2_echoback_string app in mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) . -4.messageを受信、これを再びhostのros2アプリに向かって送信 (以下) +4.以下のようなログが確認できたら通信成功! + If you get logs below, which means success!! ``` Subscribed msg : Hello, world! 1 diff --git a/workspace/echoreply_string/app.cpp b/workspace/echoreply_string/app.cpp index f16b455..aee056f 100644 --- a/workspace/echoreply_string/app.cpp +++ b/workspace/echoreply_string/app.cpp @@ -9,8 +9,8 @@ mros2::Publisher pub; void userCallback(std_msgs::msg::String *msg) { - MROS2_INFO("subscribed msg: '%s'", msg->data.c_str()); - MROS2_INFO("publishing msg: '%s'", msg->data.c_str()); + MROS2_INFO("Subscribed msg : Hello, world! %s", msg->data.c_str()); + MROS2_INFO("Publishing msg : Hello, world! %s", msg->data.c_str()); pub.publish(*msg); } diff --git a/workspace/echoreply_twist/README.md b/workspace/echoreply_twist/README.md deleted file mode 100644 index c1670a1..0000000 --- a/workspace/echoreply_twist/README.md +++ /dev/null @@ -1,49 +0,0 @@ -### Twist型通信動作確認用アプリ - -Twist型の通信の動作確認をするためのサンプルアプリです。 -Twist型は、2つのVector3型からなるメッセージ型です。 -Vector3型は、3つのfloat64型からなるメッセージ型です。 -以下の手順で確認できます。 - -1.workspace/custom_msgsで、geometry_msgs/msg/Vector3.msgおよびTwist.msgを作成し、それぞれにおいて以下のようにVector3型およびTwist型を定義する。 - - ``` - float64 x - float64 y - float64 z - ``` - - ``` - geometry_msgs/msg/Vector3 linear - geometry_msgs/msg/Vector3 angular - ``` - -2.geometry_msgs内にmsg_settings.jsonを作成し、以下のように書き込む。今回通信に用いるのはTwist型なので、Twist型定義ファイルの場所を書き込む。(Vector3型はTwist型に含まれるが、通信を行う型自体はVector3型でないので記載しなくて良い) -``` - { - "pubsubMsgs": [ - "geometry_msgs/msg/Twist.msg" - ] - } -``` - -3.workspaceディレクトリにて、`make gen-msg msg=geometry_msgs` によtwist.hppを生成する。 - -4.mros2-asp3-f767ziディレクトリにmros2_msgs/geometry_msgs/msg/twist.hppが生成されていることを確認する。 - -5.echoreply_twistアプリ内で、生成したtwist.hppをincludeして使用する。 - -6.workspaceディレクトリにて、`make app=echoreply_twist` によりアプリをビルドする。 - -7.Serial Console (picocomなど) を立ち上げて、初期化する。 - -8.hostのros2アプリからTwist型のmessageを送信する。 - -9.messageを受信、これを再びhostのros2アプリに向かって送信する。(以下) - -``` -subscribed msg!! -publishing msg!! -subscribed msg!! -publishing msg!! -``` \ No newline at end of file diff --git a/workspace/echoreply_twist/app.cpp b/workspace/echoreply_twist/app.cpp deleted file mode 100644 index 29a9763..0000000 --- a/workspace/echoreply_twist/app.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "app.h" -#include "mros2.h" -#include "geometry_msgs/msg/twist.hpp" - -#include "stm32f7xx_nucleo_144.h" - -mros2::Subscriber sub; -mros2::Publisher pub; - -void userCallback(geometry_msgs::msg::Twist *msg) -{ - MROS2_INFO("subscribed msg!!"); - MROS2_INFO("publishing msg!!"); - pub.publish(*msg); -} - -int main(int argc, char * argv[]) -{ - MROS2_INFO("mROS 2 application is started"); - - mros2::init(argc, argv); - MROS2_DEBUG("mROS 2 initialization is completed"); - BSP_LED_Toggle(LED1); - - mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - geometry_msgs::msg::Twist msg; - - MROS2_INFO("ready to pub/sub message"); - mros2::spin(); - BSP_LED_Toggle(LED3); -} - -void main_task(void) -{ - main(0, NULL); -} - -void -led_cyclic_handler(intptr_t exinf) -{ - BSP_LED_Toggle(LED2); -} \ No newline at end of file diff --git a/workspace/echoreply_twist/templates.hpp b/workspace/echoreply_twist/templates.hpp deleted file mode 100644 index 11c4a00..0000000 --- a/workspace/echoreply_twist/templates.hpp +++ /dev/null @@ -1,11 +0,0 @@ - -#include "geometry_msgs/msg/twist.hpp" - - -template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); -template void mros2::Publisher::publish(geometry_msgs::msg::Twist &msg); - - - -template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(geometry_msgs::msg::Twist*)); -template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/echoreply_float32/Makefile.inc b/workspace/pub_float32/Makefile.inc similarity index 100% rename from workspace/echoreply_float32/Makefile.inc rename to workspace/pub_float32/Makefile.inc diff --git a/workspace/pub_float32/README.md b/workspace/pub_float32/README.md new file mode 100644 index 0000000..24d6b7f --- /dev/null +++ b/workspace/pub_float32/README.md @@ -0,0 +1,24 @@ +### float32型通信動作確認用アプリ + +float32型の通信の動作確認をするためのサンプルアプリです。 +以下の手順で確認できます。 +This is a sample application for float32-type communication. +Please follow the steps below. + +1.workspaceディレクトリにて、`make app=pub_float32` によりアプリをビルドする。 + Execute `make app=pub_float32` in workspace direcroty, then this app will be built. + +2.Serial Console (picocomなど) を立ち上げて、初期化 + Open serial console (ex. picocom) and initialize your micro computer board. + +3.通信するホストデバイス上で、mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) のmros2_sub_float32アプリを起動する。 + On the host device to communicate with, run mros2_sub_float32 app in mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) . + +4.以下のようなログが確認できたら通信成功! + If you get logs below, which means success!! +``` +publishing float msg!! +publishing float msg!! +... + +``` diff --git a/workspace/echoreply_float32/app.cdl b/workspace/pub_float32/app.cdl similarity index 100% rename from workspace/echoreply_float32/app.cdl rename to workspace/pub_float32/app.cdl diff --git a/workspace/echoreply_float32/app.cfg b/workspace/pub_float32/app.cfg similarity index 100% rename from workspace/echoreply_float32/app.cfg rename to workspace/pub_float32/app.cfg diff --git a/workspace/echoreply_float32/app.cpp b/workspace/pub_float32/app.cpp similarity index 51% rename from workspace/echoreply_float32/app.cpp rename to workspace/pub_float32/app.cpp index d9daec0..cb1c592 100644 --- a/workspace/echoreply_float32/app.cpp +++ b/workspace/pub_float32/app.cpp @@ -4,27 +4,8 @@ #include "stm32f7xx_nucleo_144.h" -mros2::Subscriber sub; mros2::Publisher pub; -void userCallback(std_msgs::msg::Float32 *msg) -{ - if (0.0 >= msg->data) { - MROS2_INFO("msg <= 0.0"); - } else if (0.0 < msg->data && msg->data < 0.5) { - MROS2_INFO("0.0 < msg < 0.5"); - } else if (0.5 < msg->data && msg->data < 1.0) { - MROS2_INFO("0.5 < msg < 1.0"); - } else { - MROS2_INFO("msg >= 1.0"); - } - /* TODO: make MROS2_INFO support float type - MROS2_INFO("subscribed msg: '%f'", msg->data); - MROS2_INFO("publishing msg: '%f'", msg->data); - */ - pub.publish(*msg); -} - int main(int argc, char *argv[]) { MROS2_INFO("mROS 2 application is started"); @@ -35,10 +16,16 @@ int main(int argc, char *argv[]) mros2::Node node = mros2::Node::create_node("mros2_node"); pub = node.create_publisher("to_linux", 10); - sub = node.create_subscription("to_stm", 10, userCallback); - std_msgs::msg::Float32 msg; - MROS2_INFO("ready to pub/sub message"); + + std_msgs::msg::Float32 msg; + auto publish_count = 0; + while (1) { + msg.data = publish_count++/1.0; + MROS2_INFO("publishing float msg!!"); + pub.publish(msg); + osDelay(1000); + } mros2::spin(); BSP_LED_Toggle(LED3); } diff --git a/workspace/echoreply_float32/app.h b/workspace/pub_float32/app.h similarity index 100% rename from workspace/echoreply_float32/app.h rename to workspace/pub_float32/app.h diff --git a/workspace/echoreply_float32/config/autosar_os_ext_asp3_user_config.c b/workspace/pub_float32/config/autosar_os_ext_asp3_user_config.c similarity index 100% rename from workspace/echoreply_float32/config/autosar_os_ext_asp3_user_config.c rename to workspace/pub_float32/config/autosar_os_ext_asp3_user_config.c diff --git a/workspace/echoreply_float32/config/autosar_os_ext_asp3_user_config.h b/workspace/pub_float32/config/autosar_os_ext_asp3_user_config.h similarity index 100% rename from workspace/echoreply_float32/config/autosar_os_ext_asp3_user_config.h rename to workspace/pub_float32/config/autosar_os_ext_asp3_user_config.h diff --git a/workspace/echoreply_float32/config/autosar_os_ext_user_config.c b/workspace/pub_float32/config/autosar_os_ext_user_config.c similarity index 100% rename from workspace/echoreply_float32/config/autosar_os_ext_user_config.c rename to workspace/pub_float32/config/autosar_os_ext_user_config.c diff --git a/workspace/echoreply_float32/config/autosar_os_ext_user_config.h b/workspace/pub_float32/config/autosar_os_ext_user_config.h similarity index 100% rename from workspace/echoreply_float32/config/autosar_os_ext_user_config.h rename to workspace/pub_float32/config/autosar_os_ext_user_config.h diff --git a/workspace/echoreply_float32/config/mros2_user_config.c b/workspace/pub_float32/config/mros2_user_config.c similarity index 100% rename from workspace/echoreply_float32/config/mros2_user_config.c rename to workspace/pub_float32/config/mros2_user_config.c diff --git a/workspace/echoreply_float32/config/task.cfg b/workspace/pub_float32/config/task.cfg similarity index 100% rename from workspace/echoreply_float32/config/task.cfg rename to workspace/pub_float32/config/task.cfg diff --git a/workspace/echoreply_float32/task_impl.c b/workspace/pub_float32/task_impl.c similarity index 100% rename from workspace/echoreply_float32/task_impl.c rename to workspace/pub_float32/task_impl.c diff --git a/workspace/echoreply_float32/task_impl.h b/workspace/pub_float32/task_impl.h similarity index 100% rename from workspace/echoreply_float32/task_impl.h rename to workspace/pub_float32/task_impl.h diff --git a/workspace/pub_float32/templates.hpp b/workspace/pub_float32/templates.hpp new file mode 100644 index 0000000..79e5244 --- /dev/null +++ b/workspace/pub_float32/templates.hpp @@ -0,0 +1,8 @@ + +#include "std_msgs/msg/float32.hpp" + + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::Float32 &msg); + + diff --git a/workspace/pub_string/Makefile.inc b/workspace/pub_string/Makefile.inc deleted file mode 100644 index f807ac1..0000000 --- a/workspace/pub_string/Makefile.inc +++ /dev/null @@ -1,27 +0,0 @@ -# -# Makefile definition for mros2 application -# - -# name of main application -APPLNAME = app - -# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) -# NOTE: also check `initLogMask` in app.cdl for syslog setting -CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 - -# information for directory tree -APPLDIR := $(APPDIR) -APPLDIR += $(APPDIR)/config - -# link option for C++ code -SRCLANG = c++ -APPL_CXXLIBS += -specs=nano.specs - -# compile switch -CDEFS += -DUSE_ASP3_FOR_STM - -# additional files for configuration -APPL_COBJS := task_impl.o -APPL_COBJS += autosar_os_ext_user_config.o -APPL_COBJS += autosar_os_ext_asp3_user_config.o -APPL_COBJS += mros2_user_config.o diff --git a/workspace/pub_string/README.md b/workspace/pub_string/README.md deleted file mode 100644 index 79467a9..0000000 --- a/workspace/pub_string/README.md +++ /dev/null @@ -1,17 +0,0 @@ -### string型出版動作確認用アプリ - -string型の出版の動作確認をするためのサンプルアプリです。 -以下の手順で確認できます。 - -1.workspaceディレクトリにて、`make app=pub_string` によりアプリをビルド - -2.Serial Console (picocomなど) を立ち上げて、初期化 - -3.hostのros2アプリに向かってstring型のmessageを送信 (以下) - -``` -Hello from mROS 2!! 1 -Hello from mROS 2!! 2 -Hello from mROS 2!! 3 -... -``` diff --git a/workspace/pub_string/app.cdl b/workspace/pub_string/app.cdl deleted file mode 100644 index 176c5a6..0000000 --- a/workspace/pub_string/app.cdl +++ /dev/null @@ -1,122 +0,0 @@ -/* - * サンプルプログラム(1)のコンポーネント記述ファイル - * - * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ - */ -/* - * カーネルオブジェクトの定義 - */ -import(); - -/* - * ターゲット非依存のセルタイプの定義 - */ -import("syssvc/tSerialPort.cdl"); -import("syssvc/tSerialAdapter.cdl"); -import("syssvc/tSysLog.cdl"); -import("syssvc/tSysLogAdapter.cdl"); -import("syssvc/tLogTask.cdl"); -import("syssvc/tBanner.cdl"); - -/* - * ターゲット依存部の取り込み - */ -import("target.cdl"); - -/* - * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" - * の行までのことを言う. - */ - -/* - * システムログ機能のアダプタの組上げ記述 - * - * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー - * スのシステムログ機能を呼び出すためのセルである.システムログ機能の - * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び - * 出さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSysLogAdapter SysLogAdapter { - cSysLog = SysLog.eSysLog; -}; - -/* - * シリアルインタフェースドライバのアダプタの組上げ記述 - * - * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー - * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための - * セルである.シリアルインタフェースドライバのサービスコールを呼び出 - * さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSerialAdapter SerialAdapter { - cSerialPort[0] = SerialPort1.eSerialPort; -}; - -/* - * システムログ機能の組上げ記述 - * - * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ - * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, - * システムログタスクはシステムログ機能を使用するため,それも外すこと - * が必要である.また,システムログ機能のアダプタも外さなければならな - * い.tecsgenが警告メッセージを出すが,無視してよい. - */ -cell tSysLog SysLog { - logBufferSize = 32; /* ログバッファのサイズ */ - initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); - /* ログバッファに記録すべき重要度 */ - initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); - /* 低レベル出力すべき重要度 */ - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * シリアルインタフェースドライバの組上げ記述 - * - * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 - * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー - * スドライバを使用するため,それも外すことが必要である.また,シリア - * ルインタフェースドライバのアダプタも外さなければならない. - */ -cell tSerialPort SerialPort1 { - receiveBufferSize = 256; /* 受信バッファのサイズ */ - sendBufferSize = 256; /* 送信バッファのサイズ */ - - /* ターゲット依存部との結合 */ - cSIOPort = SIOPortTarget1.eSIOPort; - eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ -}; - -/* - * システムログタスクの組上げ記述 - * - * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ - * ばよい. - */ -cell tLogTask LogTask { - priority = 3; /* システムログタスクの優先度 */ - stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ - - /* シリアルインタフェースドライバとの結合 */ - cSerialPort = SerialPort1.eSerialPort; - cnSerialPortManage = SerialPort1.enSerialPortManage; - - /* システムログ機能との結合 */ - cSysLog = SysLog.eSysLog; - - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * カーネル起動メッセージ出力の組上げ記述 - * - * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 - * を削除すればよい. - */ -cell tBanner Banner { - /* 属性の設定 */ - targetName = BannerTargetName; - copyrightNotice = BannerCopyrightNotice; -}; diff --git a/workspace/pub_string/app.cfg b/workspace/pub_string/app.cfg deleted file mode 100644 index eb0495d..0000000 --- a/workspace/pub_string/app.cfg +++ /dev/null @@ -1,14 +0,0 @@ -/* - * サンプルプログラム(1)のシステムコンフィギュレーションファイル - */ -INCLUDE("tecsgen.cfg"); -INCLUDE("asp3ext.cfg"); -INCLUDE("task.cfg"); - -#include "app.h" -#include "stm32f7xx_it.h" -CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); -CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); -CFG_INT(77, {TA_EDGE, -4}); - -CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/pub_string/app.cpp b/workspace/pub_string/app.cpp deleted file mode 100644 index 7049533..0000000 --- a/workspace/pub_string/app.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "app.h" -#include "mros2.h" -#include "std_msgs/msg/string.hpp" - -#include "cmsis_os.h" -#include "stm32f7xx_nucleo_144.h" - -int main(int argc, char * argv[]) -{ - MROS2_INFO("mROS 2 application is started"); - - mros2::init(argc, argv); - MROS2_DEBUG("mROS 2 initialization is completed"); - BSP_LED_Toggle(LED1); - - mros2::Node node = mros2::Node::create_node("mros2_node"); - mros2::Publisher pub = node.create_publisher("to_linux", 10); - MROS2_INFO("ready to publish message"); - - std_msgs::msg::String msg; - auto publish_count = 0; - while (1) { - msg.data = "Hello from mROS 2!! " + std::to_string(publish_count++); - MROS2_INFO("publishing msg: '%s'", msg.data.c_str()); - pub.publish(msg); - osDelay(1000); - } - - mros2::spin(); - BSP_LED_Toggle(LED3); -} - -void main_task(void) -{ - main(0, NULL); -} - -void -led_cyclic_handler(intptr_t exinf) -{ - BSP_LED_Toggle(LED2); -} diff --git a/workspace/pub_string/app.h b/workspace/pub_string/app.h deleted file mode 100644 index 36eb6cf..0000000 --- a/workspace/pub_string/app.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * TOPPERS/ASP Kernel - * Toyohashi Open Platform for Embedded Real-Time Systems/ - * Advanced Standard Profile Kernel - * - * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory - * Toyohashi Univ. of Technology, JAPAN - * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory - * Graduate School of Information Science, Nagoya Univ., JAPAN - * - * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ - * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 - * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. - * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 - * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー - * スコード中に含まれていること. - * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 - * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 - * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 - * の無保証規定を掲載すること. - * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 - * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ - * と. - * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 - * 作権表示,この利用条件および下記の無保証規定を掲載すること. - * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに - * 報告すること. - * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 - * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. - * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 - * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを - * 免責すること. - * - * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お - * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 - * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ - * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ - * の責任を負わない. - * - * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ - */ - -/* - * header file for the mros2 application - */ - -#include - -/* - * Priorities for TOPPERS tasks - */ - -#define MAIN_PRIORITY 5 - -#define HIGH_PRIORITY 9 -#define MID_PRIORITY 10 -#define LOW_PRIORITY 11 - -/* - * Constants that may depend on the target - */ - -#ifndef TASK_PORTID -#define TASK_PORTID 1 -#endif /* TASK_PORTID */ - -#ifndef STACK_SIZE -#define STACK_SIZE 4096 -#endif /* STACK_SIZE */ - -/* - * Declaration of prototyle functions - */ -#ifndef TOPPERS_MACRO_ONLY -#ifdef __cplusplus -extern "C" { -#endif -void main_task(void); -extern void led_cyclic_handler(intptr_t exinf); -#ifdef __cplusplus -} -#endif -void Error_Handler(); -#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/pub_string/config/autosar_os_ext_asp3_user_config.c b/workspace/pub_string/config/autosar_os_ext_asp3_user_config.c deleted file mode 100644 index 41ef1da..0000000 --- a/workspace/pub_string/config/autosar_os_ext_asp3_user_config.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "autosar_os_ext_asp3_user_config.h" - -const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), -}; - -const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) -{ - return autosar_os_ext_flag_user_map; -} - -int cmsis_get_flag_user_num(void) -{ - return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; -} diff --git a/workspace/pub_string/config/autosar_os_ext_asp3_user_config.h b/workspace/pub_string/config/autosar_os_ext_asp3_user_config.h deleted file mode 100644 index 7ad08bf..0000000 --- a/workspace/pub_string/config/autosar_os_ext_asp3_user_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ - -#include "cmsis_config_utl.h" - -#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) - -extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; - -#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/pub_string/config/autosar_os_ext_user_config.c b/workspace/pub_string/config/autosar_os_ext_user_config.c deleted file mode 100644 index 940941b..0000000 --- a/workspace/pub_string/config/autosar_os_ext_user_config.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "cmsis_os.h" -#include "autosar_os_ext_user_config.h" - -extern void tcpip_thread(void *arg); -extern void ethernetif_set_link(void* argument); -extern void ethernetif_input(void* argument); -extern void callHbPubFunc(void *arg); -extern void callHbSubFunc(void *arg); -extern void StartDefaultTask(void * argument); -extern void callWriterThreadFunction(void *arg); -extern void callReaderThreadFunction(void *arg); -extern void callRunBroadcast(void *args); -extern void mros2_init(void *args); - - -UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { - { - .taskID = AutosarOsExtTcpTask, - .func = tcpip_thread, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthIfLinkTask, - .func = ethernetif_set_link, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthInputTask, - .func = ethernetif_input, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBPubTask, - .func = callHbPubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBSubTask, - .func = callHbSubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtSPDPTask, - .func = callRunBroadcast, - .argument = NULL, - }, - { - .taskID = AutosarOsExtWriterTask, - .func = callWriterThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtReaderTask, - .func = callReaderThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtMROS2Task, - .func = mros2_init, - .argument = NULL, - }, -}; - -UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) -{ - return user_thread_autosar_ostask_map; -} -int cmsis_get_app_heap_size(void) -{ - return APP_HEAP_SIZE; -} -int cmsis_get_user_thread_num(void) -{ - return USER_THREAD_NUM; -} diff --git a/workspace/pub_string/config/autosar_os_ext_user_config.h b/workspace/pub_string/config/autosar_os_ext_user_config.h deleted file mode 100644 index bab78d3..0000000 --- a/workspace/pub_string/config/autosar_os_ext_user_config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ - -#include "cmsis_os.h" -#include "cmsis_config_utl.h" - -/*********************************************** - * - * MEMORY - * - ***********************************************/ -#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ - - -/*********************************************** - * - * THREAD - * - ***********************************************/ -#define USER_THREAD_NUM 9U - -#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/pub_string/config/mros2_user_config.c b/workspace/pub_string/config/mros2_user_config.c deleted file mode 100644 index 7d2c110..0000000 --- a/workspace/pub_string/config/mros2_user_config.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#define SUB_MSG_COUNT 10 - -int mros2_get_submsg_count(void) -{ - return SUB_MSG_COUNT; -} - - diff --git a/workspace/pub_string/config/task.cfg b/workspace/pub_string/config/task.cfg deleted file mode 100644 index f577110..0000000 --- a/workspace/pub_string/config/task.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#include "task_impl.h" - -CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); -CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); -CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); -CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); -CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); -CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); -CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); -CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); -CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); -CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); - -CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/pub_string/task_impl.c b/workspace/pub_string/task_impl.c deleted file mode 100644 index afb9fca..0000000 --- a/workspace/pub_string/task_impl.c +++ /dev/null @@ -1,126 +0,0 @@ -#include "cmsis_os.h" -#include "cmsis_config_utl.h" -#include "task_impl.h" - -TASK(AutosarOsExtTcpTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthIfLinkTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthInputTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBPubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBSubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtSPDPTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtWriterTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtReaderTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtUserDefaultTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtMROS2Task) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} diff --git a/workspace/pub_string/task_impl.h b/workspace/pub_string/task_impl.h deleted file mode 100644 index 11e7a81..0000000 --- a/workspace/pub_string/task_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_TEST_H_ -#define _AUTOSAR_OS_EXT_TEST_H_ - -#include "cmsis_config_utl.h" - -extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); - -/* - * priorities of mROS 2 tasks for RTPS - * - * TODO: We assigned relatevely lower priorities for EthIfLinkTask and - * EthInputTask than the application. Check whether these are appropriate. - */ -#define MROS2_HIGH_PRIORITY MAIN_PRIORITY -#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 - -/* - * experimental: stack size of mROS 2 tasks for RTPS - * Each comment refers the location of original definition - */ -// application/include/lwipopt.h -// #define TCPIP_THREAD_STACKSIZE 1024 -#define MROS2_STACK_SIZE_TcpTask 1024 -// application/src/lwip.c -// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) -#define MROS2_STACK_SIZE_EthIfLinkTask 1024 -// application/src/ethernet.c -// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) -#define MROS2_STACK_SIZE_EthInputTask 350 -// embeddedRTPS/include/config.h -// const int HEARTBEAT_STACKSIZE = 1200; // byte -#define MROS2_STACK_SIZE_HBPubTask 1200 -#define MROS2_STACK_SIZE_HBSubTask 1200 -// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte -#define MROS2_STACK_SIZE_SPDPTask 550 -// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte -#define MROS2_STACK_SIZE_WriterTask 1100 -// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte -#define MROS2_STACK_SIZE_ReaderTask 1600 -// embeddedRTPS-STM32/stm32/Src/main.cpp -// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); -#define MROS2_STACK_SIZE_UserDefaultTask 250 - - -#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/echoreply_header/Makefile.inc b/workspace/pub_twist/Makefile.inc similarity index 100% rename from workspace/echoreply_header/Makefile.inc rename to workspace/pub_twist/Makefile.inc diff --git a/workspace/pub_twist/README.md b/workspace/pub_twist/README.md new file mode 100644 index 0000000..90f071e --- /dev/null +++ b/workspace/pub_twist/README.md @@ -0,0 +1,65 @@ +### Twist型通信動作確認用アプリ + +Twist型の通信の動作確認をするためのサンプルアプリです。 +以下の手順で確認できます。 +This is a sample application for Twist-type communication. +Please follow the steps below. + +1.Twist型は基本型ではなく任意型なので、まずその定義ファイルを用意する。 + ただし、Twist型はVector3型という任意型を含むので、その定義ファイルも用意する。 + Since Twist-type is not built-in type, you need to prepare the Twist-type definition file. + Note that Twist-type has Vector3-type, which is also user-defined type, in it, so you need to prepare the Vector3-type definition file. + + Vector3.msg + ``` + float64 x + float64 y + float64 z + ``` + + Twist.msg + ``` + geometry_msgs/msg/Vector3 linear + geometry_msgs/msg/Vector3 angular + ``` + +2.geometry_msgs/msgというディレクトリをcustom_msgsディレクトリ下に作成し、その下にこれらを配置する。 + Make geometry_msgs/msg dirctory under custom_msgs directory, then set these definition files. + +3.geometry_msgsディレクトリ下にmsg_settings.jsonというファイルを作成する。 + 以下のように、pubsubMsgsをkeyとするvalueに、通信を実際に行う型の定義ファイルのパスを全て、 + 配列として記載する。ただし、今回は内部にVector3型を含む任意型であるTwist型による通信を行うが、 + その際Vector3型のパスは記載しなくて良い。 + Make msg_settings.json under geometry_msgs directory. + Then set all paths to each definition files used in this app at pubsubMsgs' value like below. + Note that Twist-type message is to be sent now and Twist-type has Vector3-type, but you don't have to write path to Vector3-type definition file. + +``` + { + "pubsubMsgs": [ + "geometry_msgs/msg/Twist.msg" + ] + } + + +4.workspaceディレクトリで、`make gen-msg msg=geometry_msgs`を実行する。 + するとルートディレクトリに、mros2_msgs/geometry_msgs/msg/vector3.hppおよびmros2_msgs/geometry_msgs/msg/twist.hppが生成される。 + Execute `make gen-msg msg=geometry_msgs` in workspace direcroty, then vector3.hpp and twist.hpp will be generated in {root}/mros2_msgs/geometry_msgs/msg directory. + +5.workspaceディレクトリにて、`make app=pub_twist` によりアプリをビルドする。 + Execute `make app=pub_twist` in workspace direcroty, then this app will be built. + +6.Serial Console (picocomなど) を立ち上げて、初期化 + Open serial console (ex. picocom) and initialize your micro computer board. + +7.通信するホストデバイス上で、mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) のmros2_sub_twistアプリを起動する。 + On the host device to communicate with, run mros2_sub_twist app in mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) . + +8.以下のようなログが確認できたら通信成功! + If you get logs below, which means success!! +``` +publishing float msg!! +publishing float msg!! +... + +``` \ No newline at end of file diff --git a/workspace/echoreply_header/app.cdl b/workspace/pub_twist/app.cdl similarity index 100% rename from workspace/echoreply_header/app.cdl rename to workspace/pub_twist/app.cdl diff --git a/workspace/echoreply_header/app.cfg b/workspace/pub_twist/app.cfg similarity index 100% rename from workspace/echoreply_header/app.cfg rename to workspace/pub_twist/app.cfg diff --git a/workspace/pub_twist/app.cpp b/workspace/pub_twist/app.cpp new file mode 100644 index 0000000..16b6379 --- /dev/null +++ b/workspace/pub_twist/app.cpp @@ -0,0 +1,55 @@ +#include "app.h" +#include "mros2.h" +#include "geometry_msgs/msg/vector3.hpp" +#include "geometry_msgs/msg/twist.hpp" + +#include "stm32f7xx_nucleo_144.h" + +mros2::Publisher pub; + +int main(int argc, char * argv[]) +{ + MROS2_INFO("mROS 2 application is started"); + + mros2::init(argc, argv); + MROS2_DEBUG("mROS 2 initialization is completed"); + BSP_LED_Toggle(LED1); + + mros2::Node node = mros2::Node::create_node("pub_twist"); + pub = node.create_publisher("cmd_vel", 10); + MROS2_INFO("ready to pub/sub message"); + + geometry_msgs::msg::Vector3 linear; + geometry_msgs::msg::Vector3 angular; + geometry_msgs::msg::Twist twist; + + auto publish_count = 0; + while (1) { + linear.x = publish_count/1.0; + linear.y = publish_count/1.0; + linear.z = publish_count/1.0; + angular.x = publish_count/1.0; + angular.y = publish_count/1.0; + angular.z = publish_count/1.0; + twist.linear = linear; + twist.angular = angular; + MROS2_INFO("publishing Twist msg!!"); + pub.publish(twist); + publish_count++; + osDelay(1000); + } + + mros2::spin(); + BSP_LED_Toggle(LED3); +} + +void main_task(void) +{ + main(0, NULL); +} + +void +led_cyclic_handler(intptr_t exinf) +{ + BSP_LED_Toggle(LED2); +} \ No newline at end of file diff --git a/workspace/echoreply_header/app.h b/workspace/pub_twist/app.h similarity index 100% rename from workspace/echoreply_header/app.h rename to workspace/pub_twist/app.h diff --git a/workspace/echoreply_header/config/autosar_os_ext_asp3_user_config.c b/workspace/pub_twist/config/autosar_os_ext_asp3_user_config.c similarity index 100% rename from workspace/echoreply_header/config/autosar_os_ext_asp3_user_config.c rename to workspace/pub_twist/config/autosar_os_ext_asp3_user_config.c diff --git a/workspace/echoreply_header/config/autosar_os_ext_asp3_user_config.h b/workspace/pub_twist/config/autosar_os_ext_asp3_user_config.h similarity index 100% rename from workspace/echoreply_header/config/autosar_os_ext_asp3_user_config.h rename to workspace/pub_twist/config/autosar_os_ext_asp3_user_config.h diff --git a/workspace/echoreply_header/config/autosar_os_ext_user_config.c b/workspace/pub_twist/config/autosar_os_ext_user_config.c similarity index 100% rename from workspace/echoreply_header/config/autosar_os_ext_user_config.c rename to workspace/pub_twist/config/autosar_os_ext_user_config.c diff --git a/workspace/echoreply_header/config/autosar_os_ext_user_config.h b/workspace/pub_twist/config/autosar_os_ext_user_config.h similarity index 100% rename from workspace/echoreply_header/config/autosar_os_ext_user_config.h rename to workspace/pub_twist/config/autosar_os_ext_user_config.h diff --git a/workspace/echoreply_header/config/mros2_user_config.c b/workspace/pub_twist/config/mros2_user_config.c similarity index 100% rename from workspace/echoreply_header/config/mros2_user_config.c rename to workspace/pub_twist/config/mros2_user_config.c diff --git a/workspace/echoreply_header/config/task.cfg b/workspace/pub_twist/config/task.cfg similarity index 100% rename from workspace/echoreply_header/config/task.cfg rename to workspace/pub_twist/config/task.cfg diff --git a/workspace/echoreply_header/task_impl.c b/workspace/pub_twist/task_impl.c similarity index 100% rename from workspace/echoreply_header/task_impl.c rename to workspace/pub_twist/task_impl.c diff --git a/workspace/echoreply_header/task_impl.h b/workspace/pub_twist/task_impl.h similarity index 100% rename from workspace/echoreply_header/task_impl.h rename to workspace/pub_twist/task_impl.h diff --git a/workspace/pub_twist/templates.hpp b/workspace/pub_twist/templates.hpp new file mode 100644 index 0000000..cf48c39 --- /dev/null +++ b/workspace/pub_twist/templates.hpp @@ -0,0 +1,8 @@ + +#include "geometry_msgs/msg/twist.hpp" + + +template mros2::Publisher mros2::Node::create_publisher(std::string topic_name, int qos); +template void mros2::Publisher::publish(geometry_msgs::msg::Twist &msg); + + diff --git a/workspace/echoreply_twist/Makefile.inc b/workspace/sub_pose/Makefile.inc similarity index 100% rename from workspace/echoreply_twist/Makefile.inc rename to workspace/sub_pose/Makefile.inc diff --git a/workspace/sub_pose/README.md b/workspace/sub_pose/README.md new file mode 100644 index 0000000..8fb777c --- /dev/null +++ b/workspace/sub_pose/README.md @@ -0,0 +1,73 @@ +### Pose型通信動作確認用アプリ + +Pose型の通信の動作確認をするためのサンプルアプリです。 +以下の手順で確認できます。 +This is a sample application for Pose-type communication. +Please follow the steps below. + +1.Pose型は基本型ではなく任意型なので、まずその定義ファイルを用意する。 + ただし、Pose型はPoint型,Quaternion型という任意型を含むので、その定義ファイルも用意する。 + Since Pose-type is not built-in type, you need to prepare the Pose-type definition file. + Note that Pose-type has Point-type and Quaternion-type, which are also user-defined type, in it, so you need to prepare the Point-type and Quaternion-type definition file. + + Point.msg + ``` + float64 x + float64 y + float64 z + ``` + + Quaternion.msg + ``` + float64 x + float64 y + float64 z + float64 w + ``` + + Pose.msg + ``` + geometry_msgs/msg/Point position + geometry_msgs/msg/Quaternion orientation + ``` + +2.geometry_msgs/msgというディレクトリをcustom_msgsディレクトリ下に作成し、その下にこれらを配置する。 + Make geometry_msgs/msg dirctory under custom_msgs directory, then set these definition files. + +3.geometry_msgsディレクトリ下にmsg_settings.jsonというファイルを作成する。 + 以下のように、pubsubMsgsをkeyとするvalueに、通信を実際に行う型の定義ファイルのパスを全て、 + 配列として記載する。ただし、今回は内部にPoint型,Quaternion型を含む任意型であるPose型による通信を行うが、 + その際Point型,Quaternion型のパスは記載しなくて良い。 + Make msg_settings.json under geometry_msgs directory. + Then set all paths to each definition files used in this app at pubsubMsgs' value like below. + Note that Pose-type message is to be sent now and Pose-type has Point-type and Quaternion-type, but you don't have to write path to Point-type and Quaternion-type definition file. + +``` + { + "pubsubMsgs": [ + "geometry_msgs/msg/Pose.msg" + ] + } + + +4.workspaceディレクトリで、`make gen-msg msg=geometry_msgs`を実行する。 + するとルートディレクトリに、mros2_msgs/geometry_msgs/msg/point.hpp, mros2_msgs/geometry_msgs/msg/quaternion.hpp およびmros2_msgs/geometry_msgs/msg/pose.hppが生成される。 + Execute `make gen-msg msg=geometry_msgs` in workspace direcroty, then point.hpp, quaternion.hpp and pose.hpp will be generated in {root}/mros2_msgs/geometry_msgs/msg directory. + +5.workspaceディレクトリにて、`make app=sub_pose` によりアプリをビルドする。 + Execute `make app=sub_pose` in workspace direcroty, then this app will be built. + +6.Serial Console (picocomなど) を立ち上げて、初期化 + Open serial console (ex. picocom) and initialize your micro computer board. + +7.通信するホストデバイス上で、mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) のmros2_pub_poseアプリを起動する。 + On the host device to communicate with, run mros2_pub_pose app in mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) . + +8.以下のようなログが確認できたら通信成功! + If you get logs below, which means success!! +``` +publishing float msg!! +publishing float msg!! +... + +``` \ No newline at end of file diff --git a/workspace/echoreply_twist/app.cdl b/workspace/sub_pose/app.cdl similarity index 100% rename from workspace/echoreply_twist/app.cdl rename to workspace/sub_pose/app.cdl diff --git a/workspace/echoreply_twist/app.cfg b/workspace/sub_pose/app.cfg similarity index 100% rename from workspace/echoreply_twist/app.cfg rename to workspace/sub_pose/app.cfg diff --git a/workspace/sub_string/app.cpp b/workspace/sub_pose/app.cpp similarity index 52% rename from workspace/sub_string/app.cpp rename to workspace/sub_pose/app.cpp index f8950e9..5b6468f 100644 --- a/workspace/sub_string/app.cpp +++ b/workspace/sub_pose/app.cpp @@ -1,12 +1,14 @@ #include "app.h" #include "mros2.h" -#include "std_msgs/msg/string.hpp" +#include "geometry_msgs/msg/pose.hpp" #include "stm32f7xx_nucleo_144.h" -void userCallback(std_msgs::msg::String *msg) +mros2::Subscriber sub; + +void userCallback(geometry_msgs::msg::Pose *msg) { - MROS2_INFO("subscribed msg: '%s'", msg->data.c_str()); + MROS2_INFO("subscribed Pose msg!!"); } int main(int argc, char * argv[]) @@ -17,10 +19,10 @@ int main(int argc, char * argv[]) MROS2_DEBUG("mROS 2 initialization is completed"); BSP_LED_Toggle(LED1); - mros2::Node node = mros2::Node::create_node("mros2_node"); - mros2::Subscriber sub = node.create_subscription("to_stm", 10, userCallback); - - MROS2_INFO("ready to subscribe message"); + mros2::Node node = mros2::Node::create_node("sub_pose"); + sub = node.create_subscription("cmd_vel", 10, userCallback); + + MROS2_INFO("ready to pub/sub message"); mros2::spin(); BSP_LED_Toggle(LED3); } @@ -34,4 +36,4 @@ void led_cyclic_handler(intptr_t exinf) { BSP_LED_Toggle(LED2); -} +} \ No newline at end of file diff --git a/workspace/echoreply_twist/app.h b/workspace/sub_pose/app.h similarity index 100% rename from workspace/echoreply_twist/app.h rename to workspace/sub_pose/app.h diff --git a/workspace/echoreply_twist/config/autosar_os_ext_asp3_user_config.c b/workspace/sub_pose/config/autosar_os_ext_asp3_user_config.c similarity index 100% rename from workspace/echoreply_twist/config/autosar_os_ext_asp3_user_config.c rename to workspace/sub_pose/config/autosar_os_ext_asp3_user_config.c diff --git a/workspace/echoreply_twist/config/autosar_os_ext_asp3_user_config.h b/workspace/sub_pose/config/autosar_os_ext_asp3_user_config.h similarity index 100% rename from workspace/echoreply_twist/config/autosar_os_ext_asp3_user_config.h rename to workspace/sub_pose/config/autosar_os_ext_asp3_user_config.h diff --git a/workspace/echoreply_twist/config/autosar_os_ext_user_config.c b/workspace/sub_pose/config/autosar_os_ext_user_config.c similarity index 100% rename from workspace/echoreply_twist/config/autosar_os_ext_user_config.c rename to workspace/sub_pose/config/autosar_os_ext_user_config.c diff --git a/workspace/echoreply_twist/config/autosar_os_ext_user_config.h b/workspace/sub_pose/config/autosar_os_ext_user_config.h similarity index 100% rename from workspace/echoreply_twist/config/autosar_os_ext_user_config.h rename to workspace/sub_pose/config/autosar_os_ext_user_config.h diff --git a/workspace/echoreply_twist/config/mros2_user_config.c b/workspace/sub_pose/config/mros2_user_config.c similarity index 100% rename from workspace/echoreply_twist/config/mros2_user_config.c rename to workspace/sub_pose/config/mros2_user_config.c diff --git a/workspace/echoreply_twist/config/task.cfg b/workspace/sub_pose/config/task.cfg similarity index 100% rename from workspace/echoreply_twist/config/task.cfg rename to workspace/sub_pose/config/task.cfg diff --git a/workspace/echoreply_twist/task_impl.c b/workspace/sub_pose/task_impl.c similarity index 100% rename from workspace/echoreply_twist/task_impl.c rename to workspace/sub_pose/task_impl.c diff --git a/workspace/echoreply_twist/task_impl.h b/workspace/sub_pose/task_impl.h similarity index 100% rename from workspace/echoreply_twist/task_impl.h rename to workspace/sub_pose/task_impl.h diff --git a/workspace/sub_pose/templates.hpp b/workspace/sub_pose/templates.hpp new file mode 100644 index 0000000..f952807 --- /dev/null +++ b/workspace/sub_pose/templates.hpp @@ -0,0 +1,8 @@ + +#include "geometry_msgs/msg/pose.hpp" + + + + +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(geometry_msgs::msg::Pose*)); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); diff --git a/workspace/sub_string/Makefile.inc b/workspace/sub_string/Makefile.inc deleted file mode 100644 index f807ac1..0000000 --- a/workspace/sub_string/Makefile.inc +++ /dev/null @@ -1,27 +0,0 @@ -# -# Makefile definition for mros2 application -# - -# name of main application -APPLNAME = app - -# log level: 0(DEBUG), 1(INFO), 2(WARN), 3(ERROR), 4(FATAL), 5(NONE) -# NOTE: also check `initLogMask` in app.cdl for syslog setting -CDEFS := -DMROS2_LOG_MIN_SEVERITY=0 - -# information for directory tree -APPLDIR := $(APPDIR) -APPLDIR += $(APPDIR)/config - -# link option for C++ code -SRCLANG = c++ -APPL_CXXLIBS += -specs=nano.specs - -# compile switch -CDEFS += -DUSE_ASP3_FOR_STM - -# additional files for configuration -APPL_COBJS := task_impl.o -APPL_COBJS += autosar_os_ext_user_config.o -APPL_COBJS += autosar_os_ext_asp3_user_config.o -APPL_COBJS += mros2_user_config.o diff --git a/workspace/sub_string/README.md b/workspace/sub_string/README.md deleted file mode 100644 index a4c9968..0000000 --- a/workspace/sub_string/README.md +++ /dev/null @@ -1,19 +0,0 @@ -### string型購読動作確認用アプリ - -string型の購読の動作確認をするためのサンプルアプリです。 -以下の手順で確認できます。 - -1.workspaceディレクトリにて、`make app=sub_string` によりアプリをビルド - -2.Serial Console (picocomなど) を立ち上げて、初期化 - -3.hostのros2アプリからstring型のmessageを送信 - -4.messageを受信し、表示(以下) - -``` -Hello from mROS 2!! 1 -Hello from mROS 2!! 2 -Hello from mROS 2!! 3 -... -``` diff --git a/workspace/sub_string/app.cdl b/workspace/sub_string/app.cdl deleted file mode 100644 index 176c5a6..0000000 --- a/workspace/sub_string/app.cdl +++ /dev/null @@ -1,122 +0,0 @@ -/* - * サンプルプログラム(1)のコンポーネント記述ファイル - * - * $Id: sample1.cdl 839 2017-10-17 02:48:52Z ertl-hiro $ - */ -/* - * カーネルオブジェクトの定義 - */ -import(); - -/* - * ターゲット非依存のセルタイプの定義 - */ -import("syssvc/tSerialPort.cdl"); -import("syssvc/tSerialAdapter.cdl"); -import("syssvc/tSysLog.cdl"); -import("syssvc/tSysLogAdapter.cdl"); -import("syssvc/tLogTask.cdl"); -import("syssvc/tBanner.cdl"); - -/* - * ターゲット依存部の取り込み - */ -import("target.cdl"); - -/* - * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};" - * の行までのことを言う. - */ - -/* - * システムログ機能のアダプタの組上げ記述 - * - * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー - * スのシステムログ機能を呼び出すためのセルである.システムログ機能の - * サービスコール(syslog,syslog_0〜syslog_5,t_perrorを含む)を呼び - * 出さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSysLogAdapter SysLogAdapter { - cSysLog = SysLog.eSysLog; -}; - -/* - * シリアルインタフェースドライバのアダプタの組上げ記述 - * - * シリアルインタフェースドライバのアダプタは,C言語で記述されたコー - * ドから,TECSベースのシリアルインタフェースドライバを呼び出すための - * セルである.シリアルインタフェースドライバのサービスコールを呼び出 - * さない場合には,以下のセルの組上げ記述を削除してよい. - */ -cell tSerialAdapter SerialAdapter { - cSerialPort[0] = SerialPort1.eSerialPort; -}; - -/* - * システムログ機能の組上げ記述 - * - * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ - * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし, - * システムログタスクはシステムログ機能を使用するため,それも外すこと - * が必要である.また,システムログ機能のアダプタも外さなければならな - * い.tecsgenが警告メッセージを出すが,無視してよい. - */ -cell tSysLog SysLog { - logBufferSize = 32; /* ログバッファのサイズ */ - initLogMask = C_EXP("LOG_UPTO(LOG_DEBUG)"); - /* ログバッファに記録すべき重要度 */ - initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)"); - /* 低レベル出力すべき重要度 */ - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * シリアルインタフェースドライバの組上げ記述 - * - * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記 - * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー - * スドライバを使用するため,それも外すことが必要である.また,シリア - * ルインタフェースドライバのアダプタも外さなければならない. - */ -cell tSerialPort SerialPort1 { - receiveBufferSize = 256; /* 受信バッファのサイズ */ - sendBufferSize = 256; /* 送信バッファのサイズ */ - - /* ターゲット依存部との結合 */ - cSIOPort = SIOPortTarget1.eSIOPort; - eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */ -}; - -/* - * システムログタスクの組上げ記述 - * - * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ - * ばよい. - */ -cell tLogTask LogTask { - priority = 3; /* システムログタスクの優先度 */ - stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */ - - /* シリアルインタフェースドライバとの結合 */ - cSerialPort = SerialPort1.eSerialPort; - cnSerialPortManage = SerialPort1.enSerialPortManage; - - /* システムログ機能との結合 */ - cSysLog = SysLog.eSysLog; - - /* 低レベル出力との結合 */ - cPutLog = PutLogTarget.ePutLog; -}; - -/* - * カーネル起動メッセージ出力の組上げ記述 - * - * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述 - * を削除すればよい. - */ -cell tBanner Banner { - /* 属性の設定 */ - targetName = BannerTargetName; - copyrightNotice = BannerCopyrightNotice; -}; diff --git a/workspace/sub_string/app.cfg b/workspace/sub_string/app.cfg deleted file mode 100644 index eb0495d..0000000 --- a/workspace/sub_string/app.cfg +++ /dev/null @@ -1,14 +0,0 @@ -/* - * サンプルプログラム(1)のシステムコンフィギュレーションファイル - */ -INCLUDE("tecsgen.cfg"); -INCLUDE("asp3ext.cfg"); -INCLUDE("task.cfg"); - -#include "app.h" -#include "stm32f7xx_it.h" -CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, STACK_SIZE, NULL }); -CRE_ISR(ETH_IRQ_HANDLER, { TA_NULL, 0, 77, ETH_IRQHandler, 1 }); -CFG_INT(77, {TA_EDGE, -4}); - -CRE_CYC(LED_CYCHDR, { TA_STA, { TNFY_HANDLER, 0, led_cyclic_handler }, 1000000, 0 }); diff --git a/workspace/sub_string/app.h b/workspace/sub_string/app.h deleted file mode 100644 index 36eb6cf..0000000 --- a/workspace/sub_string/app.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * TOPPERS/ASP Kernel - * Toyohashi Open Platform for Embedded Real-Time Systems/ - * Advanced Standard Profile Kernel - * - * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory - * Toyohashi Univ. of Technology, JAPAN - * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory - * Graduate School of Information Science, Nagoya Univ., JAPAN - * - * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ - * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 - * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. - * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 - * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー - * スコード中に含まれていること. - * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 - * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 - * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 - * の無保証規定を掲載すること. - * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 - * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ - * と. - * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 - * 作権表示,この利用条件および下記の無保証規定を掲載すること. - * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに - * 報告すること. - * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 - * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. - * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 - * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを - * 免責すること. - * - * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お - * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 - * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ - * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ - * の責任を負わない. - * - * $Id: sample1.h 2416 2012-09-07 08:06:20Z ertl-hiro $ - */ - -/* - * header file for the mros2 application - */ - -#include - -/* - * Priorities for TOPPERS tasks - */ - -#define MAIN_PRIORITY 5 - -#define HIGH_PRIORITY 9 -#define MID_PRIORITY 10 -#define LOW_PRIORITY 11 - -/* - * Constants that may depend on the target - */ - -#ifndef TASK_PORTID -#define TASK_PORTID 1 -#endif /* TASK_PORTID */ - -#ifndef STACK_SIZE -#define STACK_SIZE 4096 -#endif /* STACK_SIZE */ - -/* - * Declaration of prototyle functions - */ -#ifndef TOPPERS_MACRO_ONLY -#ifdef __cplusplus -extern "C" { -#endif -void main_task(void); -extern void led_cyclic_handler(intptr_t exinf); -#ifdef __cplusplus -} -#endif -void Error_Handler(); -#endif /* TOPPERS_MACRO_ONLY */ diff --git a/workspace/sub_string/config/autosar_os_ext_asp3_user_config.c b/workspace/sub_string/config/autosar_os_ext_asp3_user_config.c deleted file mode 100644 index 41ef1da..0000000 --- a/workspace/sub_string/config/autosar_os_ext_asp3_user_config.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "autosar_os_ext_asp3_user_config.h" - -const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM] = { - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtTcpTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthIfLinkTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtEthInputTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBPubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtHBSubTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtSPDPTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtWriterTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtReaderTask), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(AutosarOsExtMROS2Task), - AUTOSAR_OS_EXT_FLAG_MAP_ENTRY(MAIN_TASK), -}; - -const AutosarOsExtFlagMapEntryType* cmsis_get_flag_user_map(void) -{ - return autosar_os_ext_flag_user_map; -} - -int cmsis_get_flag_user_num(void) -{ - return AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM; -} diff --git a/workspace/sub_string/config/autosar_os_ext_asp3_user_config.h b/workspace/sub_string/config/autosar_os_ext_asp3_user_config.h deleted file mode 100644 index 7ad08bf..0000000 --- a/workspace/sub_string/config/autosar_os_ext_asp3_user_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ - -#include "cmsis_config_utl.h" - -#define AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM (10U) - -extern const AutosarOsExtFlagMapEntryType autosar_os_ext_flag_user_map[AUTOSAR_OS_EXT_ASP3_FLAG_USER_NUM]; - -#endif /* _AUTOSAR_OS_EXT_ASP3_USER_CONFIG_H_ */ diff --git a/workspace/sub_string/config/autosar_os_ext_user_config.c b/workspace/sub_string/config/autosar_os_ext_user_config.c deleted file mode 100644 index 940941b..0000000 --- a/workspace/sub_string/config/autosar_os_ext_user_config.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "cmsis_os.h" -#include "autosar_os_ext_user_config.h" - -extern void tcpip_thread(void *arg); -extern void ethernetif_set_link(void* argument); -extern void ethernetif_input(void* argument); -extern void callHbPubFunc(void *arg); -extern void callHbSubFunc(void *arg); -extern void StartDefaultTask(void * argument); -extern void callWriterThreadFunction(void *arg); -extern void callReaderThreadFunction(void *arg); -extern void callRunBroadcast(void *args); -extern void mros2_init(void *args); - - -UserThreadAutosarOsTaskMapEntryType user_thread_autosar_ostask_map[USER_THREAD_NUM] = { - { - .taskID = AutosarOsExtTcpTask, - .func = tcpip_thread, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthIfLinkTask, - .func = ethernetif_set_link, - .argument = NULL, - }, - { - .taskID = AutosarOsExtEthInputTask, - .func = ethernetif_input, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBPubTask, - .func = callHbPubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtHBSubTask, - .func = callHbSubFunc, - .argument = NULL, - }, - { - .taskID = AutosarOsExtSPDPTask, - .func = callRunBroadcast, - .argument = NULL, - }, - { - .taskID = AutosarOsExtWriterTask, - .func = callWriterThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtReaderTask, - .func = callReaderThreadFunction, - .argument = NULL, - }, - { - .taskID = AutosarOsExtMROS2Task, - .func = mros2_init, - .argument = NULL, - }, -}; - -UserThreadAutosarOsTaskMapEntryType* cmsis_get_user_thread_map(void) -{ - return user_thread_autosar_ostask_map; -} -int cmsis_get_app_heap_size(void) -{ - return APP_HEAP_SIZE; -} -int cmsis_get_user_thread_num(void) -{ - return USER_THREAD_NUM; -} diff --git a/workspace/sub_string/config/autosar_os_ext_user_config.h b/workspace/sub_string/config/autosar_os_ext_user_config.h deleted file mode 100644 index bab78d3..0000000 --- a/workspace/sub_string/config/autosar_os_ext_user_config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_USER_CONFIG_H_ -#define _AUTOSAR_OS_EXT_USER_CONFIG_H_ - -#include "cmsis_os.h" -#include "cmsis_config_utl.h" - -/*********************************************** - * - * MEMORY - * - ***********************************************/ -#define APP_HEAP_SIZE (16 * 1024) /* 16KB */ - - -/*********************************************** - * - * THREAD - * - ***********************************************/ -#define USER_THREAD_NUM 9U - -#endif /* _AUTOSAR_OS_EXT_USER_CONFIG_H_ */ diff --git a/workspace/sub_string/config/mros2_user_config.c b/workspace/sub_string/config/mros2_user_config.c deleted file mode 100644 index 7d2c110..0000000 --- a/workspace/sub_string/config/mros2_user_config.c +++ /dev/null @@ -1,10 +0,0 @@ - - -#define SUB_MSG_COUNT 10 - -int mros2_get_submsg_count(void) -{ - return SUB_MSG_COUNT; -} - - diff --git a/workspace/sub_string/config/task.cfg b/workspace/sub_string/config/task.cfg deleted file mode 100644 index f577110..0000000 --- a/workspace/sub_string/config/task.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#include "task_impl.h" - -CRE_TSK(AutosarOsExtTcpTask, { TA_NULL, 1, TASKNAME(AutosarOsExtTcpTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_TcpTask, NULL }); -CRE_TSK(AutosarOsExtEthIfLinkTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthIfLinkTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthIfLinkTask, NULL }); -CRE_TSK(AutosarOsExtEthInputTask, { TA_NULL, 1, TASKNAME(AutosarOsExtEthInputTask), MROS2_LOW_PRIORITY, MROS2_STACK_SIZE_EthInputTask, NULL }); -CRE_TSK(AutosarOsExtHBPubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBPubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBPubTask, NULL }); -CRE_TSK(AutosarOsExtHBSubTask, { TA_NULL, 1, TASKNAME(AutosarOsExtHBSubTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_HBSubTask, NULL }); -CRE_TSK(AutosarOsExtSPDPTask, { TA_NULL, 1, TASKNAME(AutosarOsExtSPDPTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_SPDPTask, NULL }); -CRE_TSK(AutosarOsExtWriterTask, { TA_NULL, 1, TASKNAME(AutosarOsExtWriterTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_WriterTask, NULL }); -CRE_TSK(AutosarOsExtReaderTask, { TA_NULL, 1, TASKNAME(AutosarOsExtReaderTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_ReaderTask, NULL }); -CRE_TSK(AutosarOsExtUserDefaultTask, { TA_NULL, 1, TASKNAME(AutosarOsExtUserDefaultTask), MROS2_HIGH_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); -CRE_TSK(AutosarOsExtMROS2Task, { TA_NULL, 1, TASKNAME(AutosarOsExtMROS2Task), MID_PRIORITY, MROS2_STACK_SIZE_UserDefaultTask, NULL }); - -CRE_FLG(AutosarOsExtTcpTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthIfLinkTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtEthInputTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBPubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtHBSubTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtSPDPTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtWriterTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtReaderTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtUserDefaultTask_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(AutosarOsExtMROS2Task_FLG, { TA_TPRI|TA_WMUL, 0 }); -CRE_FLG(MAIN_TASK_FLG, { TA_TPRI|TA_WMUL, 0 }); diff --git a/workspace/sub_string/task_impl.c b/workspace/sub_string/task_impl.c deleted file mode 100644 index afb9fca..0000000 --- a/workspace/sub_string/task_impl.c +++ /dev/null @@ -1,126 +0,0 @@ -#include "cmsis_os.h" -#include "cmsis_config_utl.h" -#include "task_impl.h" - -TASK(AutosarOsExtTcpTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthIfLinkTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} - -TASK(AutosarOsExtEthInputTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBPubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtHBSubTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtSPDPTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtWriterTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtReaderTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtUserDefaultTask) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} -TASK(AutosarOsExtMROS2Task) -{ - UserThreadAutosarOsTaskMapEntryType config; - StatusType ercd = AutosarOsTaskConfigGet(&config); - - if (ercd == E_OK) { - config.func(config.argument); - } - - (void)osThreadTerminate(NULL); - return; -} diff --git a/workspace/sub_string/task_impl.h b/workspace/sub_string/task_impl.h deleted file mode 100644 index 11e7a81..0000000 --- a/workspace/sub_string/task_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _AUTOSAR_OS_EXT_TEST_H_ -#define _AUTOSAR_OS_EXT_TEST_H_ - -#include "cmsis_config_utl.h" - -extern void TASKNAME(AutosarOsExtTcpTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthIfLinkTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtEthInputTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBPubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtHBSubTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtSPDPTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtWriterTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtReaderTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtUserDefaultTask) (intptr_t exinf); -extern void TASKNAME(AutosarOsExtMROS2Task) (intptr_t exinf); - -/* - * priorities of mROS 2 tasks for RTPS - * - * TODO: We assigned relatevely lower priorities for EthIfLinkTask and - * EthInputTask than the application. Check whether these are appropriate. - */ -#define MROS2_HIGH_PRIORITY MAIN_PRIORITY -#define MROS2_LOW_PRIORITY LOW_PRIORITY+1 - -/* - * experimental: stack size of mROS 2 tasks for RTPS - * Each comment refers the location of original definition - */ -// application/include/lwipopt.h -// #define TCPIP_THREAD_STACKSIZE 1024 -#define MROS2_STACK_SIZE_TcpTask 1024 -// application/src/lwip.c -// #define INTERFACE_THREAD_STACK_SIZE ( 1024 ) -#define MROS2_STACK_SIZE_EthIfLinkTask 1024 -// application/src/ethernet.c -// #define INTERFACE_THREAD_STACK_SIZE ( 350 ) -#define MROS2_STACK_SIZE_EthInputTask 350 -// embeddedRTPS/include/config.h -// const int HEARTBEAT_STACKSIZE = 1200; // byte -#define MROS2_STACK_SIZE_HBPubTask 1200 -#define MROS2_STACK_SIZE_HBSubTask 1200 -// const uint16_t SPDP_WRITER_STACKSIZE = 550; // byte -#define MROS2_STACK_SIZE_SPDPTask 550 -// const int THREAD_POOL_WRITER_STACKSIZE = 1100; // byte -#define MROS2_STACK_SIZE_WriterTask 1100 -// const int THREAD_POOL_READER_STACKSIZE = 1600; // byte -#define MROS2_STACK_SIZE_ReaderTask 1600 -// embeddedRTPS-STM32/stm32/Src/main.cpp -// osThreadDef(defaultTask, StartDefaultTask, osPriorityRealtime, 0, 250); -#define MROS2_STACK_SIZE_UserDefaultTask 250 - - -#endif /* _AUTOSAR_OS_EXT_TEST_H_ */ diff --git a/workspace/echoreply_uint16/Makefile.inc b/workspace/sub_uint16/Makefile.inc similarity index 100% rename from workspace/echoreply_uint16/Makefile.inc rename to workspace/sub_uint16/Makefile.inc diff --git a/workspace/echoreply_uint16/README.md b/workspace/sub_uint16/README.md similarity index 100% rename from workspace/echoreply_uint16/README.md rename to workspace/sub_uint16/README.md diff --git a/workspace/echoreply_uint16/app.cdl b/workspace/sub_uint16/app.cdl similarity index 100% rename from workspace/echoreply_uint16/app.cdl rename to workspace/sub_uint16/app.cdl diff --git a/workspace/echoreply_uint16/app.cfg b/workspace/sub_uint16/app.cfg similarity index 100% rename from workspace/echoreply_uint16/app.cfg rename to workspace/sub_uint16/app.cfg diff --git a/workspace/echoreply_uint16/app.cpp b/workspace/sub_uint16/app.cpp similarity index 76% rename from workspace/echoreply_uint16/app.cpp rename to workspace/sub_uint16/app.cpp index 35c9728..0e74ceb 100644 --- a/workspace/echoreply_uint16/app.cpp +++ b/workspace/sub_uint16/app.cpp @@ -5,13 +5,10 @@ #include "stm32f7xx_nucleo_144.h" mros2::Subscriber sub; -mros2::Publisher pub; void userCallback(std_msgs::msg::UInt16 *msg) { MROS2_INFO("subscribed msg: %u", msg->data); - MROS2_INFO("publishing msg: %u", msg->data); - pub.publish(*msg); } int main(int argc, char * argv[]) @@ -23,9 +20,7 @@ int main(int argc, char * argv[]) BSP_LED_Toggle(LED1); mros2::Node node = mros2::Node::create_node("mros2_node"); - pub = node.create_publisher("to_linux", 10); sub = node.create_subscription("to_stm", 10, userCallback); - std_msgs::msg::UInt16 msg; MROS2_INFO("ready to pub/sub message"); mros2::spin(); diff --git a/workspace/echoreply_uint16/app.h b/workspace/sub_uint16/app.h similarity index 100% rename from workspace/echoreply_uint16/app.h rename to workspace/sub_uint16/app.h diff --git a/workspace/echoreply_uint16/config/autosar_os_ext_asp3_user_config.c b/workspace/sub_uint16/config/autosar_os_ext_asp3_user_config.c similarity index 100% rename from workspace/echoreply_uint16/config/autosar_os_ext_asp3_user_config.c rename to workspace/sub_uint16/config/autosar_os_ext_asp3_user_config.c diff --git a/workspace/echoreply_uint16/config/autosar_os_ext_asp3_user_config.h b/workspace/sub_uint16/config/autosar_os_ext_asp3_user_config.h similarity index 100% rename from workspace/echoreply_uint16/config/autosar_os_ext_asp3_user_config.h rename to workspace/sub_uint16/config/autosar_os_ext_asp3_user_config.h diff --git a/workspace/echoreply_uint16/config/autosar_os_ext_user_config.c b/workspace/sub_uint16/config/autosar_os_ext_user_config.c similarity index 100% rename from workspace/echoreply_uint16/config/autosar_os_ext_user_config.c rename to workspace/sub_uint16/config/autosar_os_ext_user_config.c diff --git a/workspace/echoreply_uint16/config/autosar_os_ext_user_config.h b/workspace/sub_uint16/config/autosar_os_ext_user_config.h similarity index 100% rename from workspace/echoreply_uint16/config/autosar_os_ext_user_config.h rename to workspace/sub_uint16/config/autosar_os_ext_user_config.h diff --git a/workspace/echoreply_uint16/config/mros2_user_config.c b/workspace/sub_uint16/config/mros2_user_config.c similarity index 100% rename from workspace/echoreply_uint16/config/mros2_user_config.c rename to workspace/sub_uint16/config/mros2_user_config.c diff --git a/workspace/echoreply_uint16/config/task.cfg b/workspace/sub_uint16/config/task.cfg similarity index 100% rename from workspace/echoreply_uint16/config/task.cfg rename to workspace/sub_uint16/config/task.cfg diff --git a/workspace/echoreply_uint16/task_impl.c b/workspace/sub_uint16/task_impl.c similarity index 100% rename from workspace/echoreply_uint16/task_impl.c rename to workspace/sub_uint16/task_impl.c diff --git a/workspace/echoreply_uint16/task_impl.h b/workspace/sub_uint16/task_impl.h similarity index 100% rename from workspace/echoreply_uint16/task_impl.h rename to workspace/sub_uint16/task_impl.h diff --git a/workspace/sub_uint16/templates.hpp b/workspace/sub_uint16/templates.hpp new file mode 100644 index 0000000..1746667 --- /dev/null +++ b/workspace/sub_uint16/templates.hpp @@ -0,0 +1,8 @@ + +#include "std_msgs/msg/u_int16.hpp" + + + + +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::UInt16*)); +template void mros2::Subscriber::callback_handler(void *callee, const rtps::ReaderCacheChange &cacheChange); From ddfc7e3d59aa125a14bd484892e5dc45c02d46ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Mon, 14 Feb 2022 21:44:17 +0900 Subject: [PATCH 69/80] fix README.md of apps. --- workspace/echoreply_string/README.md | 5 +++++ workspace/pub_float32/README.md | 7 ++++++- workspace/pub_twist/README.md | 16 ++++++++++++++-- workspace/sub_pose/README.md | 15 +++++++++++++-- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/workspace/echoreply_string/README.md b/workspace/echoreply_string/README.md index dccd01c..f38207b 100644 --- a/workspace/echoreply_string/README.md +++ b/workspace/echoreply_string/README.md @@ -2,19 +2,24 @@ string型の通信の動作確認をするためのサンプルアプリです。 以下の手順で確認できます。 + This is a sample application for string-type communication. Please follow the steps below. 1.workspaceディレクトリにて、`make app=echoreply_string` によりアプリをビルドする。 + Execute `make app=echoreply_string` in workspace direcroty, then this app will be built. 2.Serial Console (picocomなど) を立ち上げて、初期化する。 + Open serial console (ex. picocom) and initialize your micro computer board. 3.通信するホストデバイス上で、mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) のmros2_echoback_stringアプリを起動する。 + On the host device to communicate with, run mros2_echoback_string app in mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) . 4.以下のようなログが確認できたら通信成功! + If you get logs below, which means success!! ``` diff --git a/workspace/pub_float32/README.md b/workspace/pub_float32/README.md index 24d6b7f..c2d8c35 100644 --- a/workspace/pub_float32/README.md +++ b/workspace/pub_float32/README.md @@ -2,19 +2,24 @@ float32型の通信の動作確認をするためのサンプルアプリです。 以下の手順で確認できます。 + This is a sample application for float32-type communication. Please follow the steps below. 1.workspaceディレクトリにて、`make app=pub_float32` によりアプリをビルドする。 + Execute `make app=pub_float32` in workspace direcroty, then this app will be built. -2.Serial Console (picocomなど) を立ち上げて、初期化 +2.Serial Console (picocomなど) を立ち上げて、初期化する。 + Open serial console (ex. picocom) and initialize your micro computer board. 3.通信するホストデバイス上で、mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) のmros2_sub_float32アプリを起動する。 + On the host device to communicate with, run mros2_sub_float32 app in mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) . 4.以下のようなログが確認できたら通信成功! + If you get logs below, which means success!! ``` publishing float msg!! diff --git a/workspace/pub_twist/README.md b/workspace/pub_twist/README.md index 90f071e..447475f 100644 --- a/workspace/pub_twist/README.md +++ b/workspace/pub_twist/README.md @@ -2,11 +2,13 @@ Twist型の通信の動作確認をするためのサンプルアプリです。 以下の手順で確認できます。 + This is a sample application for Twist-type communication. Please follow the steps below. 1.Twist型は基本型ではなく任意型なので、まずその定義ファイルを用意する。 ただし、Twist型はVector3型という任意型を含むので、その定義ファイルも用意する。 + Since Twist-type is not built-in type, you need to prepare the Twist-type definition file. Note that Twist-type has Vector3-type, which is also user-defined type, in it, so you need to prepare the Vector3-type definition file. @@ -24,39 +26,49 @@ Please follow the steps below. ``` 2.geometry_msgs/msgというディレクトリをcustom_msgsディレクトリ下に作成し、その下にこれらを配置する。 + Make geometry_msgs/msg dirctory under custom_msgs directory, then set these definition files. 3.geometry_msgsディレクトリ下にmsg_settings.jsonというファイルを作成する。 以下のように、pubsubMsgsをkeyとするvalueに、通信を実際に行う型の定義ファイルのパスを全て、 配列として記載する。ただし、今回は内部にVector3型を含む任意型であるTwist型による通信を行うが、 その際Vector3型のパスは記載しなくて良い。 + Make msg_settings.json under geometry_msgs directory. Then set all paths to each definition files used in this app at pubsubMsgs' value like below. Note that Twist-type message is to be sent now and Twist-type has Vector3-type, but you don't have to write path to Vector3-type definition file. -``` + ``` { "pubsubMsgs": [ "geometry_msgs/msg/Twist.msg" ] } + ``` + 4.workspaceディレクトリで、`make gen-msg msg=geometry_msgs`を実行する。 するとルートディレクトリに、mros2_msgs/geometry_msgs/msg/vector3.hppおよびmros2_msgs/geometry_msgs/msg/twist.hppが生成される。 + Execute `make gen-msg msg=geometry_msgs` in workspace direcroty, then vector3.hpp and twist.hpp will be generated in {root}/mros2_msgs/geometry_msgs/msg directory. 5.workspaceディレクトリにて、`make app=pub_twist` によりアプリをビルドする。 + Execute `make app=pub_twist` in workspace direcroty, then this app will be built. -6.Serial Console (picocomなど) を立ち上げて、初期化 +6.Serial Console (picocomなど) を立ち上げて、初期化する。 + Open serial console (ex. picocom) and initialize your micro computer board. 7.通信するホストデバイス上で、mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) のmros2_sub_twistアプリを起動する。 + On the host device to communicate with, run mros2_sub_twist app in mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) . 8.以下のようなログが確認できたら通信成功! + If you get logs below, which means success!! + ``` publishing float msg!! publishing float msg!! diff --git a/workspace/sub_pose/README.md b/workspace/sub_pose/README.md index 8fb777c..b4e4a40 100644 --- a/workspace/sub_pose/README.md +++ b/workspace/sub_pose/README.md @@ -2,11 +2,13 @@ Pose型の通信の動作確認をするためのサンプルアプリです。 以下の手順で確認できます。 + This is a sample application for Pose-type communication. Please follow the steps below. 1.Pose型は基本型ではなく任意型なので、まずその定義ファイルを用意する。 ただし、Pose型はPoint型,Quaternion型という任意型を含むので、その定義ファイルも用意する。 + Since Pose-type is not built-in type, you need to prepare the Pose-type definition file. Note that Pose-type has Point-type and Quaternion-type, which are also user-defined type, in it, so you need to prepare the Point-type and Quaternion-type definition file. @@ -32,39 +34,48 @@ Please follow the steps below. ``` 2.geometry_msgs/msgというディレクトリをcustom_msgsディレクトリ下に作成し、その下にこれらを配置する。 + Make geometry_msgs/msg dirctory under custom_msgs directory, then set these definition files. 3.geometry_msgsディレクトリ下にmsg_settings.jsonというファイルを作成する。 以下のように、pubsubMsgsをkeyとするvalueに、通信を実際に行う型の定義ファイルのパスを全て、 配列として記載する。ただし、今回は内部にPoint型,Quaternion型を含む任意型であるPose型による通信を行うが、 その際Point型,Quaternion型のパスは記載しなくて良い。 + Make msg_settings.json under geometry_msgs directory. Then set all paths to each definition files used in this app at pubsubMsgs' value like below. Note that Pose-type message is to be sent now and Pose-type has Point-type and Quaternion-type, but you don't have to write path to Point-type and Quaternion-type definition file. -``` + ``` { "pubsubMsgs": [ "geometry_msgs/msg/Pose.msg" ] } + ``` 4.workspaceディレクトリで、`make gen-msg msg=geometry_msgs`を実行する。 するとルートディレクトリに、mros2_msgs/geometry_msgs/msg/point.hpp, mros2_msgs/geometry_msgs/msg/quaternion.hpp およびmros2_msgs/geometry_msgs/msg/pose.hppが生成される。 + Execute `make gen-msg msg=geometry_msgs` in workspace direcroty, then point.hpp, quaternion.hpp and pose.hpp will be generated in {root}/mros2_msgs/geometry_msgs/msg directory. 5.workspaceディレクトリにて、`make app=sub_pose` によりアプリをビルドする。 + Execute `make app=sub_pose` in workspace direcroty, then this app will be built. -6.Serial Console (picocomなど) を立ち上げて、初期化 +6.Serial Console (picocomなど) を立ち上げて、初期化する。 + Open serial console (ex. picocom) and initialize your micro computer board. 7.通信するホストデバイス上で、mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) のmros2_pub_poseアプリを起動する。 + On the host device to communicate with, run mros2_pub_pose app in mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) . 8.以下のようなログが確認できたら通信成功! + If you get logs below, which means success!! + ``` publishing float msg!! publishing float msg!! From 5fd32ad45208cc78b8da1f572eb04866c4328944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Mon, 14 Feb 2022 21:50:20 +0900 Subject: [PATCH 70/80] fix README.md of apps. --- workspace/pub_twist/README.md | 8 ++++---- workspace/sub_pose/README.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/workspace/pub_twist/README.md b/workspace/pub_twist/README.md index 447475f..bd68886 100644 --- a/workspace/pub_twist/README.md +++ b/workspace/pub_twist/README.md @@ -27,7 +27,7 @@ Please follow the steps below. 2.geometry_msgs/msgというディレクトリをcustom_msgsディレクトリ下に作成し、その下にこれらを配置する。 - Make geometry_msgs/msg dirctory under custom_msgs directory, then set these definition files. + Make geometry_msgs/msg directory under custom_msgs directory, then set these definition files. 3.geometry_msgsディレクトリ下にmsg_settings.jsonというファイルを作成する。 以下のように、pubsubMsgsをkeyとするvalueに、通信を実際に行う型の定義ファイルのパスを全て、 @@ -36,7 +36,7 @@ Please follow the steps below. Make msg_settings.json under geometry_msgs directory. Then set all paths to each definition files used in this app at pubsubMsgs' value like below. - Note that Twist-type message is to be sent now and Twist-type has Vector3-type, but you don't have to write path to Vector3-type definition file. + Note that Twist-type message is to be sent now and Twist-type has Vector3-type, but you don't have to include path to Vector3-type definition file. ``` { @@ -70,8 +70,8 @@ Please follow the steps below. If you get logs below, which means success!! ``` -publishing float msg!! -publishing float msg!! +publishing Twist msg!! +publishing Twist msg!! ... ``` \ No newline at end of file diff --git a/workspace/sub_pose/README.md b/workspace/sub_pose/README.md index b4e4a40..e06e824 100644 --- a/workspace/sub_pose/README.md +++ b/workspace/sub_pose/README.md @@ -35,7 +35,7 @@ Please follow the steps below. 2.geometry_msgs/msgというディレクトリをcustom_msgsディレクトリ下に作成し、その下にこれらを配置する。 - Make geometry_msgs/msg dirctory under custom_msgs directory, then set these definition files. + Make geometry_msgs/msg directory under custom_msgs directory, then set these definition files. 3.geometry_msgsディレクトリ下にmsg_settings.jsonというファイルを作成する。 以下のように、pubsubMsgsをkeyとするvalueに、通信を実際に行う型の定義ファイルのパスを全て、 @@ -44,7 +44,7 @@ Please follow the steps below. Make msg_settings.json under geometry_msgs directory. Then set all paths to each definition files used in this app at pubsubMsgs' value like below. - Note that Pose-type message is to be sent now and Pose-type has Point-type and Quaternion-type, but you don't have to write path to Point-type and Quaternion-type definition file. + Note that Pose-type message is to be sent now and Pose-type has Point-type and Quaternion-type, but you don't have to include path to Point-type and Quaternion-type definition file. ``` { @@ -77,8 +77,8 @@ Please follow the steps below. If you get logs below, which means success!! ``` -publishing float msg!! -publishing float msg!! +subscribed Pose msg!! +subscribed Pose msg!! ... ``` \ No newline at end of file From 0c50d0597019b255317084dd7066377b8a6bde2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Mon, 14 Feb 2022 21:51:52 +0900 Subject: [PATCH 71/80] fix README.md of apps. --- workspace/custom_msgs/geometry_msgs/msg_settings.json | 1 - 1 file changed, 1 deletion(-) diff --git a/workspace/custom_msgs/geometry_msgs/msg_settings.json b/workspace/custom_msgs/geometry_msgs/msg_settings.json index 9ca81af..93dc76e 100644 --- a/workspace/custom_msgs/geometry_msgs/msg_settings.json +++ b/workspace/custom_msgs/geometry_msgs/msg_settings.json @@ -1,5 +1,4 @@ { "pubsubMsgs": [ - "geometry_msgs/msg/Twist.msg" ] } \ No newline at end of file From 1b5df2415e5e413768a6a72060d774e65e35f699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Mon, 14 Feb 2022 22:02:08 +0900 Subject: [PATCH 72/80] mros2 commit ID changed to latest --- mros2 | 2 +- workspace/echoreply_string/app.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mros2 b/mros2 index 83515de..c5faad8 160000 --- a/mros2 +++ b/mros2 @@ -1 +1 @@ -Subproject commit 83515de5bb9ec42348727873a3d3ace81636983d +Subproject commit c5faad80c7c8d1319ae0a3473dbbfd7e47cac94b diff --git a/workspace/echoreply_string/app.cpp b/workspace/echoreply_string/app.cpp index aee056f..0276424 100644 --- a/workspace/echoreply_string/app.cpp +++ b/workspace/echoreply_string/app.cpp @@ -9,8 +9,8 @@ mros2::Publisher pub; void userCallback(std_msgs::msg::String *msg) { - MROS2_INFO("Subscribed msg : Hello, world! %s", msg->data.c_str()); - MROS2_INFO("Publishing msg : Hello, world! %s", msg->data.c_str()); + MROS2_INFO("Subscribed msg : %s", msg->data.c_str()); + MROS2_INFO("Publishing msg : %s", msg->data.c_str()); pub.publish(*msg); } From 12351cceec39faa25d3b8b42e1f91b7237fe39d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 16 Feb 2022 11:16:09 +0900 Subject: [PATCH 73/80] README of echoreply_string app modified --- workspace/echoreply_string/README.md | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/workspace/echoreply_string/README.md b/workspace/echoreply_string/README.md index f38207b..8b16060 100644 --- a/workspace/echoreply_string/README.md +++ b/workspace/echoreply_string/README.md @@ -1,26 +1,15 @@ -### string型通信動作確認用アプリ - -string型の通信の動作確認をするためのサンプルアプリです。 -以下の手順で確認できます。 +### echoreply_string app This is a sample application for string-type communication. Please follow the steps below. -1.workspaceディレクトリにて、`make app=echoreply_string` によりアプリをビルドする。 - - Execute `make app=echoreply_string` in workspace direcroty, then this app will be built. - -2.Serial Console (picocomなど) を立ち上げて、初期化する。 - - Open serial console (ex. picocom) and initialize your micro computer board. - -3.通信するホストデバイス上で、mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) のmros2_echoback_stringアプリを起動する。 +1.Execute `make app=echoreply_string` in workspace direcroty, then this app will be built. - On the host device to communicate with, run mros2_echoback_string app in mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) . +2.Open serial console (ex. picocom) and initialize your micro computer board. -4.以下のようなログが確認できたら通信成功! +3.On the host device to communicate with, run mros2_echoback_string app in mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) . - If you get logs below, which means success!! +4.If you get logs below, which means success!! ``` Subscribed msg : Hello, world! 1 From 33ee96c4216e19f879c708f75f74ffe2b0a89482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 16 Feb 2022 11:23:13 +0900 Subject: [PATCH 74/80] README of echoreply_string app modified --- workspace/echoreply_string/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workspace/echoreply_string/README.md b/workspace/echoreply_string/README.md index 8b16060..1e475a4 100644 --- a/workspace/echoreply_string/README.md +++ b/workspace/echoreply_string/README.md @@ -1,13 +1,13 @@ -### echoreply_string app +# echoreply_string app -This is a sample application for string-type communication. +This is a sample application to communicate string messages. Please follow the steps below. 1.Execute `make app=echoreply_string` in workspace direcroty, then this app will be built. 2.Open serial console (ex. picocom) and initialize your micro computer board. -3.On the host device to communicate with, run mros2_echoback_string app in mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) . +3.On the host device to communicate with, run mros2_echoback_string app (https://github.com/mROS-base/mros2-host-examples) . 4.If you get logs below, which means success!! From ca1159d54c288a93f7556926e44d97c3c2eb33c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 16 Feb 2022 11:53:56 +0900 Subject: [PATCH 75/80] READMEs modified --- workspace/README.md | 46 ++++++++--------------- workspace/echoreply_string/README.md | 6 +-- workspace/pub_float32/README.md | 23 +++--------- workspace/pub_twist/README.md | 55 +++++++--------------------- workspace/sub_pose/README.md | 55 ++++++++-------------------- workspace/sub_uint16/README.md | 14 +++---- 6 files changed, 61 insertions(+), 138 deletions(-) diff --git a/workspace/README.md b/workspace/README.md index df8a5cc..f4cf955 100644 --- a/workspace/README.md +++ b/workspace/README.md @@ -16,50 +16,36 @@ Please also check [mROS-base/mros2-host-examples](https://github.com/mROS-base/m - `$ ros2 run mros2_echoback_string pub_node` - `$ ros2 run mros2_echoback_string sub_node` -## echoreply_uint16 +## sub_uint16 - Description: - The mROS 2 node on the embedded board subscribes `uint16` (`std_msgs::msg::UInt16`) message from `/to_stm` topic. - - And then publishes this `uint16` message as it is to `/to_linux` as the reply. -- Host operation: - - `$ ros2 launch mros2_echoback_uint16 launch.py` + - `$ ros2 launch mros2_pub_uint16 launch.py` - or, at two terminals: - - `$ ros2 run mros2_echoback_uint16 pub_node` - - `$ ros2 run mros2_echoback_uint16 sub_node` + - `$ ros2 run mros2_pub_uint16 pub_node` -## echoreply_float32 +## pub_float32 - Description: - - The mROS 2 node on the embedded board subscribes `float32` (`std_msgs::msg::Float32`) message from `/to_stm` topic. - - And then publishes this `float32` message as it is to `/to_linux` as the reply. - - Note that this application just print whether the value of message is between 5.0 and 10.0 or not, since TOPPERS/ASP3 kernel cannot print float value. + - The mROS 2 node on the embedded board publishes `float32` (`std_msgs::msg::Float32`) message to `/to_linux` topic. - Host operation: - - `$ ros2 launch mros2_echoback_float32 launch.py` + - `$ ros2 launch mros2_sub_float32 launch.py` - or, at two terminals: - - `$ ros2 run mros2_echoback_float32 pub_node` - - `$ ros2 run mros2_echoback_float32 sub_node` + - `$ ros2 run mros2_sub_float32 sub_node` -## echoreply_header +## sub_pose - Description: - - The mROS 2 node on the embedded board subscribes `header` (`std_msgs::msg::Header`) message from `/to_stm` topic. - - And then publishes this `header` message as it is to `/to_linux` as the reply. -- Host operation: - - `$ ros2 launch mros2_echoback_header launch.py` + - The mROS 2 node on the embedded board subscribes `Pose` (`geometry_msgs::msg::Pose`) message from `cmd_vel` topic. + - `$ ros2 launch mros2_pub_pose launch.py` - or, at two terminals: - - `$ ros2 run mros2_echoback_header pub_node` - - `$ ros2 run mros2_echoback_header sub_node` + - `$ ros2 run mros2_pub_pose pub_node` -## pub_string +## pub_twist - Description: - - The mROS 2 node on the embedded board says hello to `/to_linux` as the publication message of `string`. + - The mROS 2 node on the embedded board publishes `Twist` (`geometry_msgs::msg::Twist`) message to `cmd_vel` topic. - Host operation: - - `$ ros2 run mros2_echoback_string pub_node` - -## sub_string - -- Description: - - The mROS 2 node on the embedded board just subscribes `string` message from `/to_stm` topic. -- Host operation: - - `$ ros2 run mros2_echoback_string sub_node` + - `$ ros2 launch mros2_sub_twist launch.py` + - or, at two terminals: + - `$ ros2 run mros2_sub_twist sub_node` diff --git a/workspace/echoreply_string/README.md b/workspace/echoreply_string/README.md index 1e475a4..01c4988 100644 --- a/workspace/echoreply_string/README.md +++ b/workspace/echoreply_string/README.md @@ -1,13 +1,13 @@ # echoreply_string app -This is a sample application to communicate string messages. +This is a sample application to publish/subscribe `string` (`std_msgs::msg::String`) message. Please follow the steps below. -1.Execute `make app=echoreply_string` in workspace direcroty, then this app will be built. +1.Execute `make app=echoreply_string` in `workspace` direcroty, then this app will be built. 2.Open serial console (ex. picocom) and initialize your micro computer board. -3.On the host device to communicate with, run mros2_echoback_string app (https://github.com/mROS-base/mros2-host-examples) . +3.On the host device to communicate with, run `mros2_echoback_string` app (https://github.com/mROS-base/mros2-host-examples) . 4.If you get logs below, which means success!! diff --git a/workspace/pub_float32/README.md b/workspace/pub_float32/README.md index c2d8c35..2f066bb 100644 --- a/workspace/pub_float32/README.md +++ b/workspace/pub_float32/README.md @@ -1,26 +1,15 @@ -### float32型通信動作確認用アプリ +# pub_float32 -float32型の通信の動作確認をするためのサンプルアプリです。 -以下の手順で確認できます。 - -This is a sample application for float32-type communication. +This is a sample application to publish `float32` (`std_msgs::msg::Float32`) message. Please follow the steps below. -1.workspaceディレクトリにて、`make app=pub_float32` によりアプリをビルドする。 - - Execute `make app=pub_float32` in workspace direcroty, then this app will be built. - -2.Serial Console (picocomなど) を立ち上げて、初期化する。 - - Open serial console (ex. picocom) and initialize your micro computer board. - -3.通信するホストデバイス上で、mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) のmros2_sub_float32アプリを起動する。 +1.Execute `make app=pub_float32` in `workspace` direcroty, then this app will be built. - On the host device to communicate with, run mros2_sub_float32 app in mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) . +2.Open serial console (ex. picocom) and initialize your micro computer board. -4.以下のようなログが確認できたら通信成功! +3.On the host device to communicate with, run `mros2_sub_float32` app (https://github.com/mROS-base/mros2-host-examples) . - If you get logs below, which means success!! +4.If you get logs below, which means success!! ``` publishing float msg!! publishing float msg!! diff --git a/workspace/pub_twist/README.md b/workspace/pub_twist/README.md index bd68886..b37aaa8 100644 --- a/workspace/pub_twist/README.md +++ b/workspace/pub_twist/README.md @@ -1,42 +1,28 @@ -### Twist型通信動作確認用アプリ +# pub_twist -Twist型の通信の動作確認をするためのサンプルアプリです。 -以下の手順で確認できます。 - -This is a sample application for Twist-type communication. +This is a sample application to publish `Twist` (`geometry_msgs::msg::Twist`) message. Please follow the steps below. -1.Twist型は基本型ではなく任意型なので、まずその定義ファイルを用意する。 - ただし、Twist型はVector3型という任意型を含むので、その定義ファイルも用意する。 - - Since Twist-type is not built-in type, you need to prepare the Twist-type definition file. - Note that Twist-type has Vector3-type, which is also user-defined type, in it, so you need to prepare the Vector3-type definition file. +1.Since `Twist` type is not built-in type, you need to prepare the `Twist` type definition file. Note that `Twist` typw has `Vector3` (`geometry_msgs::msg::Vector3`) type in it, which is not built-in type, so you need to prepare the `Vector3` type definition file as well. - Vector3.msg + `Vector3.msg` ``` float64 x float64 y float64 z ``` - Twist.msg + `Twist.msg` ``` geometry_msgs/msg/Vector3 linear geometry_msgs/msg/Vector3 angular ``` -2.geometry_msgs/msgというディレクトリをcustom_msgsディレクトリ下に作成し、その下にこれらを配置する。 - - Make geometry_msgs/msg directory under custom_msgs directory, then set these definition files. +2.Make `geometry_msgs/msg` directory under `custom_msgs` directory, then set these definition files. -3.geometry_msgsディレクトリ下にmsg_settings.jsonというファイルを作成する。 - 以下のように、pubsubMsgsをkeyとするvalueに、通信を実際に行う型の定義ファイルのパスを全て、 - 配列として記載する。ただし、今回は内部にVector3型を含む任意型であるTwist型による通信を行うが、 - その際Vector3型のパスは記載しなくて良い。 - - Make msg_settings.json under geometry_msgs directory. - Then set all paths to each definition files used in this app at pubsubMsgs' value like below. - Note that Twist-type message is to be sent now and Twist-type has Vector3-type, but you don't have to include path to Vector3-type definition file. +3.Make `msg_settings.json` under `geometry_msgs` directory. + Then set all paths to each definition files you use in this app at `pubsubMsgs`'s value shown as below. + Note that `Twist` message is to be published and `Twist` type has `Vector3` type, but you don't have to include path to `Vector3` definition file. ``` { @@ -46,28 +32,15 @@ Please follow the steps below. } ``` - - -4.workspaceディレクトリで、`make gen-msg msg=geometry_msgs`を実行する。 - するとルートディレクトリに、mros2_msgs/geometry_msgs/msg/vector3.hppおよびmros2_msgs/geometry_msgs/msg/twist.hppが生成される。 +4.Execute `make gen-msg msg=geometry_msgs` in `workspace` direcroty, then `vector3.hpp` and `twist.hpp` will be generated in `{root}/mros2_msgs/geometry_msgs/msg` directory. - Execute `make gen-msg msg=geometry_msgs` in workspace direcroty, then vector3.hpp and twist.hpp will be generated in {root}/mros2_msgs/geometry_msgs/msg directory. - -5.workspaceディレクトリにて、`make app=pub_twist` によりアプリをビルドする。 - - Execute `make app=pub_twist` in workspace direcroty, then this app will be built. +5.Execute `make app=pub_twist` in `workspace` direcroty, then this app will be built. -6.Serial Console (picocomなど) を立ち上げて、初期化する。 - - Open serial console (ex. picocom) and initialize your micro computer board. - -7.通信するホストデバイス上で、mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) のmros2_sub_twistアプリを起動する。 - - On the host device to communicate with, run mros2_sub_twist app in mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) . +6.Open serial console (ex. picocom) and initialize your micro computer board. -8.以下のようなログが確認できたら通信成功! +7.On the host device to communicate with, run `mros2_sub_twist` app (https://github.com/mROS-base/mros2-host-examples) . - If you get logs below, which means success!! +8.If you get logs below, which means success!! ``` publishing Twist msg!! diff --git a/workspace/sub_pose/README.md b/workspace/sub_pose/README.md index e06e824..c0eed6f 100644 --- a/workspace/sub_pose/README.md +++ b/workspace/sub_pose/README.md @@ -1,25 +1,18 @@ -### Pose型通信動作確認用アプリ +# sub_pose -Pose型の通信の動作確認をするためのサンプルアプリです。 -以下の手順で確認できます。 - -This is a sample application for Pose-type communication. +This is a sample application to subscribe `Pose` (`geometry_msgs::msg::Pose`) message. Please follow the steps below. -1.Pose型は基本型ではなく任意型なので、まずその定義ファイルを用意する。 - ただし、Pose型はPoint型,Quaternion型という任意型を含むので、その定義ファイルも用意する。 - - Since Pose-type is not built-in type, you need to prepare the Pose-type definition file. - Note that Pose-type has Point-type and Quaternion-type, which are also user-defined type, in it, so you need to prepare the Point-type and Quaternion-type definition file. +1.Since `Pose` type is not built-in type, you need to prepare the `Pose` type definition file. Note that `Pose` type has `Point` type and `Quaternion` type in it, which are not built-in type, so you need to prepare the `Point` type and `Quaternion` type definition file. - Point.msg + `Point.msg` ``` float64 x float64 y float64 z ``` - Quaternion.msg + `Quaternion.msg` ``` float64 x float64 y @@ -27,24 +20,17 @@ Please follow the steps below. float64 w ``` - Pose.msg + `Pose.msg` ``` geometry_msgs/msg/Point position geometry_msgs/msg/Quaternion orientation ``` -2.geometry_msgs/msgというディレクトリをcustom_msgsディレクトリ下に作成し、その下にこれらを配置する。 - - Make geometry_msgs/msg directory under custom_msgs directory, then set these definition files. +2.Make `geometry_msgs/msg` directory under `custom_msgs` directory, then set these definition files. -3.geometry_msgsディレクトリ下にmsg_settings.jsonというファイルを作成する。 - 以下のように、pubsubMsgsをkeyとするvalueに、通信を実際に行う型の定義ファイルのパスを全て、 - 配列として記載する。ただし、今回は内部にPoint型,Quaternion型を含む任意型であるPose型による通信を行うが、 - その際Point型,Quaternion型のパスは記載しなくて良い。 - - Make msg_settings.json under geometry_msgs directory. - Then set all paths to each definition files used in this app at pubsubMsgs' value like below. - Note that Pose-type message is to be sent now and Pose-type has Point-type and Quaternion-type, but you don't have to include path to Point-type and Quaternion-type definition file. +3.Make `msg_settings.json` under `geometry_msgs` directory. + Then set all paths to each definition files you use in this app at `pubsubMsgs`'s value shown as below. + Note that `Pose` message is to be published and `Pose` type has `Point` type and `Quaternion` type, but you don't have to include path to ``Point` and `Quaternion` definition file. ``` { @@ -55,26 +41,15 @@ Please follow the steps below. ``` -4.workspaceディレクトリで、`make gen-msg msg=geometry_msgs`を実行する。 - するとルートディレクトリに、mros2_msgs/geometry_msgs/msg/point.hpp, mros2_msgs/geometry_msgs/msg/quaternion.hpp およびmros2_msgs/geometry_msgs/msg/pose.hppが生成される。 - - Execute `make gen-msg msg=geometry_msgs` in workspace direcroty, then point.hpp, quaternion.hpp and pose.hpp will be generated in {root}/mros2_msgs/geometry_msgs/msg directory. +4.Execute `make gen-msg msg=geometry_msgs` in `workspace` direcroty, then `point.hpp`, `quaternion.hpp` and `pose.hpp` will be generated in `{root}/mros2_msgs/geometry_msgs/msg` directory. -5.workspaceディレクトリにて、`make app=sub_pose` によりアプリをビルドする。 - - Execute `make app=sub_pose` in workspace direcroty, then this app will be built. +5.Execute `make app=sub_pose` in `workspace` direcroty, then this app will be built. -6.Serial Console (picocomなど) を立ち上げて、初期化する。 - - Open serial console (ex. picocom) and initialize your micro computer board. - -7.通信するホストデバイス上で、mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) のmros2_pub_poseアプリを起動する。 - - On the host device to communicate with, run mros2_pub_pose app in mros2-host-examples (https://github.com/mROS-base/mros2-host-examples) . +6.Open serial console (ex. picocom) and initialize your micro computer board. -8.以下のようなログが確認できたら通信成功! +7.On the host device to communicate with, run mros2_pub_pose app (https://github.com/mROS-base/mros2-host-examples) . - If you get logs below, which means success!! +8.If you get logs below, which means success!! ``` subscribed Pose msg!! diff --git a/workspace/sub_uint16/README.md b/workspace/sub_uint16/README.md index 48267f4..52471e9 100644 --- a/workspace/sub_uint16/README.md +++ b/workspace/sub_uint16/README.md @@ -1,15 +1,15 @@ -### uint16型通信動作確認用アプリ +# sub_uint16 -uint16型の通信の動作確認をするためのサンプルアプリです。 -以下の手順で確認できます。 +This is a sample application to subscribe `uint16` (`std_msgs::msg::Uint16`) message. +Please follow the steps below. -1.workspaceディレクトリにて、`make app=echoreply_uint16` によりアプリをビルド +1.Execute `make app=sub_uint16` in `workspace` direcroty, then this app will be built. -2.Serial Console (picocomなど) を立ち上げて、初期化 +2.Open serial console (ex. picocom) and initialize your micro computer board. -3.hostのros2アプリからuint16型のmessageを送信 +3.On the host device to communicate with, run `mros2_pub_uint16` app (https://github.com/mROS-base/mros2-host-examples) . -4.messageを受信、これを再びhostのros2アプリに向かって送信 (以下) +4.If you get logs below, which means success!! ``` Subscribed msg : 1 From 8fae1f199e186465c7ec71f98a024301620e83fe Mon Sep 17 00:00:00 2001 From: takasehideki Date: Sun, 20 Feb 2022 18:48:13 +0900 Subject: [PATCH 76/80] fix option to check whether file exists and add echo message --- workspace/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/workspace/Makefile b/workspace/Makefile index ce3e203..57ca06f 100644 --- a/workspace/Makefile +++ b/workspace/Makefile @@ -37,6 +37,7 @@ clean: rm -f asp.* && rm -f .asp* gen-msg: - @if [ -a $(MSGDIR)/msg_settings.json ]; then \ + @if [ -f $(MSGDIR)/msg_settings.json ]; then \ python $(HEADERGEN_FILE) $(MROS2DIR) $(MSGDIR); \ + echo "msg file for ${msg} generated in ${MSGDIR}"; \ fi From 8c702c41de1ccbd516b8fedaf2b411d0ae2ef00f Mon Sep 17 00:00:00 2001 From: takasehideki Date: Sun, 20 Feb 2022 18:54:16 +0900 Subject: [PATCH 77/80] ignore generated header files of custom msgs --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c2dd437..268e92d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,7 @@ gen/ .cproject .project .settings/ -*.launch \ No newline at end of file +*.launch + +# generated header files of custom msgs +mros2_msgs/ \ No newline at end of file From 56a360996ebe7e2f9ecdf146e3d1ded33d9bc1f3 Mon Sep 17 00:00:00 2001 From: takasehideki Date: Sun, 20 Feb 2022 18:56:24 +0900 Subject: [PATCH 78/80] add -B in python not to generate pyc file --- workspace/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/Makefile b/workspace/Makefile index 57ca06f..418d1c8 100644 --- a/workspace/Makefile +++ b/workspace/Makefile @@ -38,6 +38,6 @@ clean: gen-msg: @if [ -f $(MSGDIR)/msg_settings.json ]; then \ - python $(HEADERGEN_FILE) $(MROS2DIR) $(MSGDIR); \ + python -B $(HEADERGEN_FILE) $(MROS2DIR) $(MSGDIR); \ echo "msg file for ${msg} generated in ${MSGDIR}"; \ fi From 62542dcc27083fc34ae946785f40a1401e0c48e2 Mon Sep 17 00:00:00 2001 From: takasehideki Date: Sun, 20 Feb 2022 19:30:00 +0900 Subject: [PATCH 79/80] bump mros2 to be resoloved version --- mros2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2 b/mros2 index c5faad8..af35a19 160000 --- a/mros2 +++ b/mros2 @@ -1 +1 @@ -Subproject commit c5faad80c7c8d1319ae0a3473dbbfd7e47cac94b +Subproject commit af35a19ac0e5a888e6c1c6d11d9c41119067bb2d From dce537c20af15c501aa98d29b6a686734817f3f7 Mon Sep 17 00:00:00 2001 From: takasehideki Date: Sun, 20 Feb 2022 19:55:36 +0900 Subject: [PATCH 80/80] Bump to v0.3.0 --- mros2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2 b/mros2 index af35a19..af19fe8 160000 --- a/mros2 +++ b/mros2 @@ -1 +1 @@ -Subproject commit af35a19ac0e5a888e6c1c6d11d9c41119067bb2d +Subproject commit af19fe82d2a376a4d84bc7280766844115033424