From 51ad430f8fac347922330bc1d32775953b12e562 Mon Sep 17 00:00:00 2001 From: takasehideki Date: Tue, 22 Feb 2022 19:05:19 +0900 Subject: [PATCH 1/4] move config.h from mros2/embeddedRTPS/include/rtps/ This file can set the configuration of RTPS. See also: https://github.com/mROS-base/embeddedRTPS/pull/8#issuecomment-1047622769 --- CMakeLists.txt | 7 ++++ include/rtps/config.h | 83 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 include/rtps/config.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 762c814..6fc37bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,13 @@ execute_process(COMMAND git submodule update --init --recursive add_library(mros2 INTERFACE) add_subdirectory(mros2) +set(RTPS_CONFIG_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include") + +target_include_directories( + mros2-mbed + PRIVATE ${RTPS_CONFIG_INCLUDE_DIR} +) + mbed_set_post_build(${APP_TARGET}) option(VERBOSE_BUILD "Have a verbose build process") diff --git a/include/rtps/config.h b/include/rtps/config.h new file mode 100644 index 0000000..cabda2e --- /dev/null +++ b/include/rtps/config.h @@ -0,0 +1,83 @@ +/* +The MIT License +Copyright (c) 2019 Lehrstuhl Informatik 11 - RWTH Aachen University +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE + +This file is part of embeddedRTPS. + +Author: i11 - Embedded Software, RWTH Aachen University +*/ + +#ifndef RTPS_CONFIG_H +#define RTPS_CONFIG_H + +#include "rtps/common/types.h" + +namespace rtps { + +#define IS_LITTLE_ENDIAN 1 + + + namespace Config { + const VendorId_t VENDOR_ID = {13, 37}; + const std::array IP_ADDRESS = {192,168,11,2}; // Needs to be set in Src/lwip.c too. + const GuidPrefix_t BASE_GUID_PREFIX{1,2,3,4,5,6,7,8,9,10,12}; + + const uint8_t DOMAIN_ID = 0; // 230 possible with UDP + const uint8_t NUM_STATELESS_WRITERS = 2; + const uint8_t NUM_STATELESS_READERS = 2; + const uint8_t NUM_STATEFUL_READERS = 8; + const uint8_t NUM_STATEFUL_WRITERS = 8; + const uint8_t MAX_NUM_PARTICIPANTS = 1; + const uint8_t NUM_WRITERS_PER_PARTICIPANT = 16; + const uint8_t NUM_READERS_PER_PARTICIPANT = 16; + const uint8_t NUM_WRITER_PROXIES_PER_READER = 3; + const uint8_t NUM_READER_PROXIES_PER_WRITER = 3; + + const uint8_t HISTORY_SIZE = 10; + + const uint8_t MAX_TYPENAME_LENGTH = 40; + const uint8_t MAX_TOPICNAME_LENGTH = 40; + + const int HEARTBEAT_STACKSIZE = 4096; // byte + const int THREAD_POOL_WRITER_STACKSIZE = 4096; // byte + const int THREAD_POOL_READER_STACKSIZE = 4096; // byte + const uint16_t SPDP_WRITER_STACKSIZE = 4096; // byte + + const uint16_t SF_WRITER_HB_PERIOD_MS = 4000; + const uint16_t SPDP_RESEND_PERIOD_MS = 10000; + const uint8_t SPDP_WRITER_PRIO = 24; + const uint8_t SPDP_MAX_NUMBER_FOUND_PARTICIPANTS = 5; + const uint8_t SPDP_MAX_NUM_LOCATORS = 5; + const Duration_t SPDP_LEASE_DURATION = {100, 0}; + + const int MAX_NUM_UDP_CONNECTIONS = 10; + + const int THREAD_POOL_NUM_WRITERS = 1; + const int THREAD_POOL_NUM_READERS = 1; + const int THREAD_POOL_WRITER_PRIO = 24; + const int THREAD_POOL_READER_PRIO = 24; + const int THREAD_POOL_WORKLOAD_QUEUE_LENGTH = 20; + + constexpr int OVERALL_HEAP_SIZE = THREAD_POOL_NUM_WRITERS * THREAD_POOL_WRITER_STACKSIZE + + THREAD_POOL_NUM_READERS * THREAD_POOL_READER_STACKSIZE + + MAX_NUM_PARTICIPANTS * SPDP_WRITER_STACKSIZE + + NUM_STATEFUL_WRITERS * HEARTBEAT_STACKSIZE; + } +} + +#endif //RTPS_CONFIG_H From c14ed1a65cf08977c993de625eb622644febee93 Mon Sep 17 00:00:00 2001 From: takasehideki Date: Tue, 22 Feb 2022 22:12:08 +0900 Subject: [PATCH 2/4] remove a blank line --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 0a02081..96cc399 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ Please also check [mros2 repository](https://github.com/mROS-base/mros2) for mor For now, these boards below are confirmed to run the example on them. - [STM32 NUCLEO-F429ZI](https://www.st.com/en/evaluation-tools/nucleo-f429zi.html) - [STM32 NUCLEO-F767ZI](https://www.st.com/en/evaluation-tools/nucleo-f767zi.html) - - Kernel: [Mbed OS 6](https://github.com/ARMmbed/mbed-os) - Host environment - [ROS 2 Foxy Fitzroy](https://docs.ros.org/en/foxy/index.html) on Ubuntu 20.04 LTS From bef6a1fb38075492752c2433e903976ed8015ade Mon Sep 17 00:00:00 2001 From: takasehideki Date: Wed, 23 Feb 2022 09:51:40 +0900 Subject: [PATCH 3/4] bump mros2 to v0.2.3.1 https://github.com/mROS-base/mros2/releases/tag/v0.2.3.1 --- mros2.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2.lib b/mros2.lib index 3b8fbe8..38e28d3 100644 --- a/mros2.lib +++ b/mros2.lib @@ -1 +1 @@ -https://github.com/mROS-base/mros2#v0.2.3 +https://github.com/mROS-base/mros2#v0.2.3.1 From 56ee137696137821adee87651cbcda28c7e16621 Mon Sep 17 00:00:00 2001 From: smorita_emb Date: Wed, 23 Feb 2022 14:05:55 +0900 Subject: [PATCH 4/4] Added a new supported target board(Arch Max V1.1) to the README.md. --- README.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 96cc399..1ec52ce 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Please also check [mros2 repository](https://github.com/mROS-base/mros2) for mor For now, these boards below are confirmed to run the example on them. - [STM32 NUCLEO-F429ZI](https://www.st.com/en/evaluation-tools/nucleo-f429zi.html) - [STM32 NUCLEO-F767ZI](https://www.st.com/en/evaluation-tools/nucleo-f767zi.html) + - [Seeed Arch Max V1.1](https://wiki.seeedstudio.com/Arch_Max_v1.1/) - Kernel: [Mbed OS 6](https://github.com/ARMmbed/mbed-os) - Host environment - [ROS 2 Foxy Fitzroy](https://docs.ros.org/en/foxy/index.html) on Ubuntu 20.04 LTS @@ -24,22 +25,29 @@ Please also check [mros2 repository](https://github.com/mROS-base/mros2) for mor - PC having an Ethernet port whose IP address is 192.168.11.x(x is not 2) and a docker environment. - Mbed board having an Ethernet port(listed above). 2. Build Mbed executable binary using Mbed CLI2. -(Please replace F429ZI with F767ZI if you use F767ZI) ``` git clone https://github.com/mROS-base/mros2-mbed cd mros2-mbed +#(Please replace the [TARGET] with the ones as below.) +# +-------------------+---------------+ +# | Your target board | [TARGET] | +# +-------------------+---------------+ +# | NUCLEO-F429ZI | NUCLEO_F429ZI | +# | NUCLEO-F767ZI | NUCLEO_F767ZI | +# | Arch Max v1.1 | ARCH_MAX | +# +-------------------+---------------+ docker run --rm -it --mount=type=bind,source="$(pwd)",destination=/var/mbed -w /var/mbed \ ghcr.io/armmbed/mbed-os-env \ - /bin/bash -c "mbed-tools deploy && mbed-tools compile -m NUCLEO_F429ZI -t GCC_ARM" + /bin/bash -c "mbed-tools deploy && mbed-tools compile -m [TARGET] -t GCC_ARM" ``` After that, you will find an executable binary is created in the path below. ``` -cmake_build/NUCLEO_F429ZI/develop/GCC_ARM/mros2-mbed.bin +cmake_build/[TARGET]/develop/GCC_ARM/mros2-mbed.bin ``` 3. Connect the PC and Mbed Board with USB and LAN cables. 4. Open Serial Console of the Mbed board. (115200bps) 5. Copy the executable binary above to the Mbed Board. - (you may find it in the Nautilus file manager as NODE_F429ZI or F767ZI). + (you may find it in the Nautilus file manager as NODE_F429ZI, F767ZI or DAPLINK.) ``` mbed mros2 start! [MROS2LIB] mros2_init task start