From 4ec13d5895d721bc857d06ed3f52632893000623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3n=20Casas?= Date: Mon, 26 May 2025 08:55:11 +0000 Subject: [PATCH 1/2] Instructions for building the ROS messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Antón Casas --- idf/taskboard/README.md | 67 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/idf/taskboard/README.md b/idf/taskboard/README.md index ddbcf8c..6c6abc3 100644 --- a/idf/taskboard/README.md +++ b/idf/taskboard/README.md @@ -96,6 +96,73 @@ To run `idf.py` from any additional terminal attached to the Docker, the followi source /opt/esp/idf/export.sh ``` +## Build ROS 2 messages + +In case that the ROS 2 messages are modified, they need to be built from a ROS 2 environment. + +This is only necessary when the compiler shows an error similar to this: + +```bash +/robotlearningblock/idf/taskboard/main/microros/MicroROSTypes.hpp:217:27: error: 'robothon_taskboard_msgs__msg__TaskStatus' {aka 'struct robothon_taskboard_msgs__msg__TaskStatus'} has no member named 'score' +``` + +To build the ROS 2 messages run `colcon build` in the `extra_ros_packages` directory. + +```bash +# Navigate to the messages directory +cd extra_ros_packages + +# Build the messages +colcon build + +# Source the ROS 2 workspace +source install/local_setup.bash +``` + +If the above commands are not available in your current environment, it is possible to start a ROS 2 Jazzy Docker container to read and modify the files in the host filesystem via a shared volume. + +```bash +# Go to the taskboard directory in your host filesystem +cd robotlearningblock/idf/taskboard + +# Run the Jazzy Docker container with a volume pointing to the current directory +docker run -it --rm --privileged --net=host -v $(pwd):/robotlearningblock/idf/taskboard ros:jazzy + +# Navigate to the messages directory +cd /robotlearningblock/idf/taskboard/extra_ros_packages + +# Build the messages +colcon build + +# Source the ROS 2 workspace +source install/local_setup.bash +``` + +After building the messages, go back to the espressif environment, clean the project and build it again: + +```bash +# Clean and build the project +idf.py clean +idf.py build +``` + +If you used the ROS 2 Jazzy Docker approach, to point to the already existing project in your host filesystem, you can also use the Docker volume option with the ESP-IDF container: + +```bash +# Go to the repository root +cd robotlearningblock + +# Run the ESP-IDF Docker container with a volume pointing to the current directory +docker run -it --rm -v /dev:/dev -v $(pwd):/robotlearningblock --privileged espressif/idf:release-v5.3 + +# Navigate to the taskboard directory inside the Docker container +cd /robotlearningblock/idf/taskboard + +# Clean and build the project +idf.py clean +idf.py build +``` + ## Data Model Overview The Robothon Task Board Firmware is built around a hierarchical data model where **Tasks** is the main component. From 81d8197e671d396d880e1a18058cf7f8bdc78e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3n=20Casas?= Date: Mon, 26 May 2025 08:55:36 +0000 Subject: [PATCH 2/2] Unique KAA_URI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Antón Casas --- idf/taskboard/main/network/KaaHandler.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/idf/taskboard/main/network/KaaHandler.hpp b/idf/taskboard/main/network/KaaHandler.hpp index b3ab764..e853e6b 100644 --- a/idf/taskboard/main/network/KaaHandler.hpp +++ b/idf/taskboard/main/network/KaaHandler.hpp @@ -7,6 +7,7 @@ #include #include +#include #include /** @@ -18,8 +19,6 @@ struct KaaHandler { const char* TAG = "KaaHandler"; ///< Logging tag - const char* KAA_URI = "http://cloud.kaaiot.com/kpc/kp1/c1v9jqmgul2l1s47m6bg-v0/dcx/task_board_dev/json"; - /** * @brief Constructs a new KaaHandler object * @@ -29,6 +28,13 @@ struct KaaHandler const TaskBoardDriver& task_board_driver) : task_board_driver_(task_board_driver) { + uint8_t mac[6]; + esp_read_mac(mac, ESP_MAC_WIFI_STA); + + char KAA_URI[80]; + + sprintf(KAA_URI, "http://cloud.kaaiot.com/kpc/kp1/c1v9jqmgul2l1s47m6bg-v0/dcx/task_board_%01X%02X/json", (mac[4] & 0x0F), mac[5]); + // Make HTTP request to get latest release esp_http_client_config_t config = {}; config.url = KAA_URI;