Skip to content

This example demonstrates the utilization of ROS actions within micro-ROS on an ESP32 equipped with ESP-IDF and FreeRTOS, communicate with the agent via USB/UART.

License

Notifications You must be signed in to change notification settings

PrwTsrt/micro_ros_action_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

micro_ros_action_server

This example demonstrates the utilization of ROS actions within micro-ROS on an ESP32 equipped with ESP-IDF and FreeRTOS, communicate with the agent via USB/UART.

Modify microros configuration

The default microros configuration only supports 1 node, 2 publishers, 2 subscribers, 1 service, 1 client, and 1 history record. You need to modify the colcon.meta file in the micro_ros_espidf_component directory. Locate the rmw_microxrcedds section and adjust the settings according to your requirements. Since the action server requires 3 service servers and 2 publishers, I will set the number of publishers, subscribers, servers, clients, and history records all to 3. To enable communication via USB/UART, set the transport mode to 'custom'.

cd ~/esp/Samples/extra_components/micro_ros_espidf_component
nano colcon.meta
"rmw_microxrcedds": {
            "cmake-args": [
                "-DRMW_UXRCE_XML_BUFFER_LENGTH=400",
                "-DRMW_UXRCE_TRANSPORT=custom",
                "-DRMW_UXRCE_MAX_NODES=1",
                "-DRMW_UXRCE_MAX_PUBLISHERS=3",
                "-DRMW_UXRCE_MAX_SUBSCRIPTIONS=3",
                "-DRMW_UXRCE_MAX_SERVICES=3",
                "-DRMW_UXRCE_MAX_CLIENTS=3",
                "-DRMW_UXRCE_MAX_HISTORY=3"
            ]
        },

Show the result

This example assumes that you have already installed the micro-ROS agent. To proceed, run the micro-ROS agent with these commands.

source /opt/ros/humble/setup.bash
source ~/uros_ws/install/local_setup.sh
ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyUSB0 -b 115200 -v4

Open a new terminal and execute the following command to call the action server.

source /opt/ros/humble/setup.bash
ros2 action send_goal /fibonacci example_interfaces/action/Fibonacci "{order: 10}"

You will receive the following result:

Waiting for an action server to become available...
Sending goal:
     order: 10

Goal accepted with ID: 5858233249f140ed812258268567f210

Result:
    sequence:
- 0
- 1
- 1
- 2
- 3
- 5
- 8
- 13
- 21
- 34

Goal finished with status: SUCCEEDED

To view the action's topics, execute this command:

ros2 topic list --include-hidden-topics 

You will receive the following result:

/fibonacci/_action/feedback
/fibonacci/_action/status
/parameter_events
/rosout

About

This example demonstrates the utilization of ROS actions within micro-ROS on an ESP32 equipped with ESP-IDF and FreeRTOS, communicate with the agent via USB/UART.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published