From 04188adc94ea2c658f2602691ec600ae0e71c0f0 Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Fri, 13 Mar 2020 11:31:15 +0100 Subject: [PATCH 1/2] New external transport approach --- .../freertos/crazyflie21/client-colcon.meta | 2 +- .../config/freertos/crazyflie21/configure.sh | 5 +++-- .../olimex-stm32-e407/client-colcon.meta | 2 +- .../freertos/olimex-stm32-e407/configure.sh | 22 ++++++++++++++++--- .../config/zephyr/generic/configure.sh | 6 +++-- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/micro_ros_setup/config/freertos/crazyflie21/client-colcon.meta b/micro_ros_setup/config/freertos/crazyflie21/client-colcon.meta index b724a3ef..cb7215bb 100644 --- a/micro_ros_setup/config/freertos/crazyflie21/client-colcon.meta +++ b/micro_ros_setup/config/freertos/crazyflie21/client-colcon.meta @@ -14,7 +14,7 @@ }, "rmw_microxrcedds":{ "cmake-args":[ - "-DRMW_UXRCE_TRANSPORT=custom" + "-DRMW_UXRCE_TRANSPORT=custom_serial" ] } } diff --git a/micro_ros_setup/config/freertos/crazyflie21/configure.sh b/micro_ros_setup/config/freertos/crazyflie21/configure.sh index 0c2c213e..d8014956 100755 --- a/micro_ros_setup/config/freertos/crazyflie21/configure.sh +++ b/micro_ros_setup/config/freertos/crazyflie21/configure.sh @@ -5,5 +5,6 @@ EXTENSIONS_DIR=$FW_TARGETDIR/freertos_apps/microros_crazyflie21_extensions echo $CONFIG_NAME > $FW_TARGETDIR/APP -update_meta "microxrcedds_client" "EXTERNAL_TRANSPORT_HEADER="$EXTENSIONS_DIR"/src/crazyflie_transport.h" -update_meta "microxrcedds_client" "EXTERNAL_TRANSPORT_SRC="$EXTENSIONS_DIR"/src/crazyflie_transport.c" +cp -f $EXTENSIONS_DIR/src/crazyflie_transport.c $FW_TARGETDIR/mcu_ws/eProsima/Micro-XRCE-DDS-Client/src/c/profile/transport/serial/serial_transport_external.c +cp -f $EXTENSIONS_DIR/src/crazyflie_transport.h $FW_TARGETDIR/mcu_ws/eProsima/Micro-XRCE-DDS-Client/include/uxr/client/profile/transport/serial/serial_transport_external.h +update_meta "microxrcedds_client" "UCLIENT_EXTERNAL_SERIAL=ON" \ No newline at end of file diff --git a/micro_ros_setup/config/freertos/olimex-stm32-e407/client-colcon.meta b/micro_ros_setup/config/freertos/olimex-stm32-e407/client-colcon.meta index 35e5ba79..229bc111 100644 --- a/micro_ros_setup/config/freertos/olimex-stm32-e407/client-colcon.meta +++ b/micro_ros_setup/config/freertos/olimex-stm32-e407/client-colcon.meta @@ -17,7 +17,7 @@ "rmw_microxrcedds": { "cmake-args": [ "-DRMW_UXRCE_XML_BUFFER_LENGTH=400", - "-DRMW_UXRCE_TRANSPORT=custom", + "-DRMW_UXRCE_TRANSPORT=custom_serial", "-DRMW_UXRCE_DEFAULT_SERIAL_DEVICE=3" ] } diff --git a/micro_ros_setup/config/freertos/olimex-stm32-e407/configure.sh b/micro_ros_setup/config/freertos/olimex-stm32-e407/configure.sh index 374a19b8..7d83d44a 100755 --- a/micro_ros_setup/config/freertos/olimex-stm32-e407/configure.sh +++ b/micro_ros_setup/config/freertos/olimex-stm32-e407/configure.sh @@ -5,7 +5,7 @@ EXTENSIONS_DIR=$FW_TARGETDIR/freertos_apps/microros_olimex_e407_extensions function help { echo "Configure script need an argument." - echo " --transport -t udp, tcp, serial or serialusb" + echo " --transport -t udp, tcp, serial or serial-usb" echo " --dev -d agent string descriptor in a serial-like transport" echo " --ip -i agent IP in a network-like transport" echo " --port -p agent port in a network-like transport" @@ -28,15 +28,31 @@ if [ "$UROS_TRANSPORT" == "udp" ] || [ "$UROS_TRANSPORT" == "tcp" ]; then elif [ "$UROS_TRANSPORT" == "serial" ]; then echo "Using serial device USART$UROS_AGENT_DEVICE." + cp -f $EXTENSIONS_DIR/Src/olimex_e407_serial_transport.c $FW_TARGETDIR/mcu_ws/eProsima/Micro-XRCE-DDS-Client/src/c/profile/transport/serial/serial_transport_external.c + cp -f $EXTENSIONS_DIR/Inc/olimex_e407_serial_transport.h $FW_TARGETDIR/mcu_ws/eProsima/Micro-XRCE-DDS-Client/include/uxr/client/profile/transport/serial/serial_transport_external.h + update_meta "microxrcedds_client" "UCLIENT_EXTERNAL_SERIAL=ON" + update_meta "rmw_microxrcedds" "RMW_UXRCE_TRANSPORT=custom" update_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_SERIAL_DEVICE="$UROS_AGENT_DEVICE - update_meta "microxrcedds_client" "EXTERNAL_TRANSPORT_HEADER_SERIAL="$EXTENSIONS_DIR"/Inc/olimex_e407_serial_transport.h" - update_meta "microxrcedds_client" "EXTERNAL_TRANSPORT_SRC_SERIAL="$EXTENSIONS_DIR"/Src/olimex_e407_serial_transport.c" remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_IP" remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_PORT" echo "Configured $UROS_TRANSPORT mode with agent at USART$UROS_AGENT_DEVICE" + +elif [ "$UROS_TRANSPORT" == "serial-usb" ]; then + echo "Using serial USB device. EXPERIMENTAL." + + cp -f $EXTENSIONS_DIR/Src/olimex_e407_usb_transport.c $FW_TARGETDIR/mcu_ws/eProsima/Micro-XRCE-DDS-Client/src/c/profile/transport/serial/serial_transport_external.c + cp -f $EXTENSIONS_DIR/Inc/olimex_e407_usb_transport.h $FW_TARGETDIR/mcu_ws/eProsima/Micro-XRCE-DDS-Client/include/uxr/client/profile/transport/serial/serial_transport_external.h + update_meta "microxrcedds_client" "UCLIENT_EXTERNAL_SERIAL=ON" + + update_meta "rmw_microxrcedds" "RMW_UXRCE_TRANSPORT=custom" + + remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_IP" + remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_PORT" + + echo "Configured $UROS_TRANSPORT mode with agent" else help fi diff --git a/micro_ros_setup/config/zephyr/generic/configure.sh b/micro_ros_setup/config/zephyr/generic/configure.sh index c9996219..fa6bd584 100755 --- a/micro_ros_setup/config/zephyr/generic/configure.sh +++ b/micro_ros_setup/config/zephyr/generic/configure.sh @@ -27,9 +27,11 @@ elif [ "$UROS_TRANSPORT" == "serial" ]; then elif [ "$UROS_TRANSPORT" == "serial-usb" ]; then echo "Using USB serial device." + cp -f $EXTENSIONS_DIR/microros_extensions/zephyr_usb_serial_transport.c $FW_TARGETDIR/mcu_ws/eProsima/Micro-XRCE-DDS-Client/src/c/profile/transport/serial/serial_transport_external.c + cp -f $EXTENSIONS_DIR/microros_extensions/zephyr_usb_serial_transport.h $FW_TARGETDIR/mcu_ws/eProsima/Micro-XRCE-DDS-Client/include/uxr/client/profile/transport/serial/serial_transport_external.h + update_meta "microxrcedds_client" "UCLIENT_EXTERNAL_SERIAL=ON" + update_meta "rmw_microxrcedds" "RMW_UXRCE_TRANSPORT=custom" - update_meta "microxrcedds_client" "EXTERNAL_TRANSPORT_HEADER="$EXTENSIONS_DIR"/microros_extensions/zephyr_usb_serial_transport.h" - update_meta "microxrcedds_client" "EXTERNAL_TRANSPORT_SRC="$EXTENSIONS_DIR"/microros_extensions/zephyr_usb_serial_transport.c" remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_IP" remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_PORT" From 0a19902b22f5cc4d8a1a538c3eec6a15c1e5b236 Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Fri, 13 Mar 2020 13:05:58 +0100 Subject: [PATCH 2/2] Updated custom serial transport selections --- micro_ros_setup/config/freertos/olimex-stm32-e407/configure.sh | 2 +- micro_ros_setup/config/zephyr/generic/configure.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/micro_ros_setup/config/freertos/olimex-stm32-e407/configure.sh b/micro_ros_setup/config/freertos/olimex-stm32-e407/configure.sh index 7d83d44a..de71a7b6 100755 --- a/micro_ros_setup/config/freertos/olimex-stm32-e407/configure.sh +++ b/micro_ros_setup/config/freertos/olimex-stm32-e407/configure.sh @@ -47,7 +47,7 @@ elif [ "$UROS_TRANSPORT" == "serial-usb" ]; then cp -f $EXTENSIONS_DIR/Inc/olimex_e407_usb_transport.h $FW_TARGETDIR/mcu_ws/eProsima/Micro-XRCE-DDS-Client/include/uxr/client/profile/transport/serial/serial_transport_external.h update_meta "microxrcedds_client" "UCLIENT_EXTERNAL_SERIAL=ON" - update_meta "rmw_microxrcedds" "RMW_UXRCE_TRANSPORT=custom" + update_meta "rmw_microxrcedds" "RMW_UXRCE_TRANSPORT=custom_serial" remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_IP" remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_PORT" diff --git a/micro_ros_setup/config/zephyr/generic/configure.sh b/micro_ros_setup/config/zephyr/generic/configure.sh index fa6bd584..1e0e8b06 100755 --- a/micro_ros_setup/config/zephyr/generic/configure.sh +++ b/micro_ros_setup/config/zephyr/generic/configure.sh @@ -31,7 +31,7 @@ elif [ "$UROS_TRANSPORT" == "serial-usb" ]; then cp -f $EXTENSIONS_DIR/microros_extensions/zephyr_usb_serial_transport.h $FW_TARGETDIR/mcu_ws/eProsima/Micro-XRCE-DDS-Client/include/uxr/client/profile/transport/serial/serial_transport_external.h update_meta "microxrcedds_client" "UCLIENT_EXTERNAL_SERIAL=ON" - update_meta "rmw_microxrcedds" "RMW_UXRCE_TRANSPORT=custom" + update_meta "rmw_microxrcedds" "RMW_UXRCE_TRANSPORT=custom_serial" remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_IP" remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_PORT"