Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions idf/taskboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 8 additions & 2 deletions idf/taskboard/main/network/KaaHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <network/JSONHandler.hpp>
#include <hal/TaskBoardDriver.hpp>

#include <esp_mac.h>
#include <esp_log.h>

/**
Expand All @@ -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
*
Expand All @@ -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;
Expand Down