Skip to content

navy-to-haijun/micro-ROS-rtthread-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

micro-ROS-package-for-RTThread

This package has been tested in RT-Thread v4.1.1 with STMH750-ART-Pi.

Dependencies

This component needs colcon scons and other Python 3 packages in order to build micro-ROS packages:

pip3 install catkin_pkg lark-parser empy colcon-common-extensions

Usage1

Supported board

RT-Thread v4.1.1 with STMH750-ART-Pi

Creating micro-ROS firmware

ros2 run micro_ros_setup create_firmware_ws.sh rtthread art-pi

Configuring micro-ROS firmware

ros2 run micro_ros_setup configure_firmware.sh [app name] [options]

Available apps:

  • micro_ros_pub_int32.c
  • micro_ros_sub_int32.c
  • micro_ros_pub_sub_int32.c
  • micro_ros_ping_pong.c
  • micro_ros_addtwoints_server.c
  • icro_ros_addtwoints_client.c

available options:

  • -d device

  • -i IP -p port

for example:

# serial
ros2 run micro_ros_setup configure_firmware.sh  micro_ros_pub_int32.c -d vcom
# UDP
ros2 run micro_ros_setup configure_firmware.sh micro_ros_pub_int32.c -i 192.168.31.130 -p 9999

Building micro-ROS

ros2 run micro_ros_setup build_firmware.sh

Flashing micro-ROS

ros2 run micro_ros_setup flash_firmware.sh

agent

# serial
docker run -it --rm -v /dev:/dev --privileged --net=host microros/micro-ros-agent:galactic serial -D [DEVICE] -v6
# UDP
docker run -it --rm -v /dev:/dev --privileged --net=host microros/micro-ros-agent:galactic udp4 --port [PORT] -v6

Usage2

Supported platforms

BSP with rtthread

  1. Clone rtthread rpeo:
git clone -b v4.1.1 https://github.com/RT-Thread/rt-thread.git
  1. Select BSP. For example: using BSP of stm32h750-artpi
cd  bsp/stm32/stm32h750-artpi
  1. Clone this rpeo
git clone https://github.com/navy-to-haijun/micro-ROS-rtthread-app
  1. Configure the driver code for UART or UDP by myself.
  2. Rtthread supports cmake:
scons --target=cmake

Modify the CMakeLists.txt to include the following code before the build the project:

# build micro-ROS : make build_microros
add_custom_target(build_microros
	WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/micro-ROS-rtthread-app/microros"
	COMMAND sh generate_microros_library.sh ${CMAKE_C_COMPILER} ${CMAKE_CXX_COMPILER} ${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}
	COMMENT "build micro-ROS..."
)

# head files
INCLUDE_DIRECTORIES(micro-ROS-rtthread-app/microros/build/include)
INCLUDE_DIRECTORIES(micro-ROS-rtthread-app/transports)

#  teansport: serial(optional)
add_definitions(-DMICROROS_SERIAL)
add_definitions(-DMICROROS_DEVIVE="vcom")
list(APPEND PROJECT_SOURCES micro-ROS-rtthread-app/transports/rtt_serial_transports.c)

#  teansport: UDP(optional)
# add_definitions(-DMICROROS_UDP)
# add_definitions(-DMICROROS_IP="192.168.31.130")
# add_definitions(-DMICROROS_PORT=9999)
# list(APPEND PROJECT_SOURCES micro-ROS-rtthread-app/transports/rtt_udp_transport.c.c)

# example 
# pub_int32 (optional)
add_definitions(-DMICROS_EXAMPLE_PUB_INT32)
list(APPEND PROJECT_SOURCES micro-ROS-rtthread-app/examples/micro_ros_pub_int32.c)

link_directories(${CMAKE_SOURCE_DIR}/micro-ROS-rtthread-app/microros/build)
LINK_LIBRARIES(microros)
  1. Execute
cd build
cmake ..
# generate microROS static library
make build_microros
# build all project
make

About

micro ros test for rtthread

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published