Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MicroROS on Espressif #9955

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.o
*.a
!atmel-samd/asf/**/*.a
!ports/espressif/microros-ext/**/*.a
*.elf
*.bin
!*.toml.bin
Expand Down
59 changes: 59 additions & 0 deletions ports/espressif/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,55 @@ CFLAGS += -isystem esp-camera/driver/include
CFLAGS += -isystem esp-camera/conversions/include
endif

ifneq ($(CIRCUITPY_MICROROS),0)
CFLAGS += -isystem microros-ext/include
CFLAGS += -isystem microros-ext/include/rcl
CFLAGS += -isystem microros-ext/include/statistics_msgs
CFLAGS += -isystem microros-ext/include/composition_interfaces
CFLAGS += -isystem microros-ext/include/example_interfaces
CFLAGS += -isystem microros-ext/include/rmw_microxrcedds_c
CFLAGS += -isystem microros-ext/include/test_msgs
CFLAGS += -isystem microros-ext/include/std_msgs
CFLAGS += -isystem microros-ext/include/rcutils
CFLAGS += -isystem microros-ext/include/lifecycle_msgs
CFLAGS += -isystem microros-ext/include/rosidl_typesupport_interface
CFLAGS += -isystem microros-ext/include/service_msgs
CFLAGS += -isystem microros-ext/include/visualization_msgs
CFLAGS += -isystem microros-ext/include/rosidl_dynamic_typesupport
CFLAGS += -isystem microros-ext/include/stereo_msgs
CFLAGS += -isystem microros-ext/include/ucdr
CFLAGS += -isystem microros-ext/include/rosidl_typesupport_c
CFLAGS += -isystem microros-ext/include/std_srvs
CFLAGS += -isystem microros-ext/include/rcl_lifecycle
CFLAGS += -isystem microros-ext/include/action_msgs
CFLAGS += -isystem microros-ext/include/micro_ros_utilities
CFLAGS += -isystem microros-ext/include/rcl_action
CFLAGS += -isystem microros-ext/include/rcl_logging_interface
CFLAGS += -isystem microros-ext/include/type_description_interfaces
CFLAGS += -isystem microros-ext/include/nav_msgs
CFLAGS += -isystem microros-ext/include/actionlib_msgs
CFLAGS += -isystem microros-ext/include/rmw
CFLAGS += -isystem microros-ext/include/rclc_parameter
CFLAGS += -isystem microros-ext/include/geometry_msgs
CFLAGS += -isystem microros-ext/include/sensor_msgs
CFLAGS += -isystem microros-ext/include/trajectory_msgs
CFLAGS += -isystem microros-ext/include/shape_msgs
CFLAGS += -isystem microros-ext/include/rosidl_runtime_c
CFLAGS += -isystem microros-ext/include/rclc
CFLAGS += -isystem microros-ext/include/rosgraph_msgs
CFLAGS += -isystem microros-ext/include/rclc_lifecycle
CFLAGS += -isystem microros-ext/include/rcl_interfaces
CFLAGS += -isystem microros-ext/include/diagnostic_msgs
CFLAGS += -isystem microros-ext/include/micro_ros_msgs
CFLAGS += -isystem microros-ext/include/rosidl_typesupport_introspection_c
CFLAGS += -isystem microros-ext/include/uxr
CFLAGS += -isystem microros-ext/include/unique_identifier_msgs
CFLAGS += -isystem microros-ext/include/rosidl_typesupport_microxrcedds_c
CFLAGS += -isystem microros-ext/include/builtin_interfaces
CFLAGS += -isystem microros-ext/include/tracetools
CFLAGS += -isystem microros-ext/include/rmw_microros
endif

ifneq ($(CIRCUITPY_ESPIDF),0)
SRC_ESPIDF := \
$(wildcard common-hal/espidf/*.c) \
Expand Down Expand Up @@ -664,6 +713,16 @@ ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/esp-camera/libesp-camera
#$(error $(ESP_IDF_COMPONENTS_EXPANDED))
endif

ifeq ($(CIRCUITPY_MICROROS),1)
ifeq ($(IDF_TARGET),esp32)
BINARY_BLOBS += microros-ext/esp32/libmicroros.a
else ifeq ($(IDF_TARGET),esp32s2)
BINARY_BLOBS+= microros-ext/esp32s2/libmicroros.a
else ifeq ($(IDF_TARGET),esp32s3)
BINARY_BLOBS += microros-ext/esp32s3/libmicroros.a
endif
endif

ifneq ($(VALID_BOARD),)
# From esp-idf/components/bootloader/Kconfig.projbuild
# BOOTLOADER_OFFSET is determined by chip type, based on the ROM bootloader, and is not changeable.
Expand Down
21 changes: 21 additions & 0 deletions ports/espressif/boards/m5stack_cardputer/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
#include "py/ringbuf.h"
#include "shared/runtime/interrupt_char.h"

// ROS TESTING
// #include <uros_network_interfaces.h>
#include <rcl/rcl/rcl.h>
#include <rcl/rcl/error_handling.h>
#include <std_msgs/msg/int32.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>
// END ROS TESTING



#define DELAY 0x80

Expand All @@ -42,6 +52,17 @@ uint8_t display_init_sequence[] = {

// Overrides the weakly linked function from supervisor/shared/board.c
void board_init(void) {

// ROS TESTING
rcl_allocator_t allocator = rcl_get_default_allocator();
rcl_init_options_t init_options = rcl_get_zero_initialized_init_options();
rcl_ret_t temp_rc = rcl_init_options_init(&init_options, allocator);
if ((temp_rc != RCL_RET_OK)) {
common_hal_board_create_spi(0);
}
// END ROS TESTING


busio_spi_obj_t *spi = common_hal_board_create_spi(0);
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
bus->base.type = &fourwire_fourwire_type;
Expand Down
1 change: 1 addition & 0 deletions ports/espressif/boards/m5stack_cardputer/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CIRCUITPY_ESP_FLASH_MODE = qio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 8MB
CIRCUITPY_ESPCAMERA = 0
CIRCUITPY_MICROROS = 1

CIRCUITPY_GIFIO = 1
CIRCUITPY_MAX3421E = 0
Expand Down
Binary file added ports/espressif/microros-ext/esp32/libmicroros.a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
// generated from rosidl_generator_c/resource/idl__description.c.em
// with input from action_msgs:msg/GoalInfo.idl
// generated code does not contain a copyright notice

#include "action_msgs/msg/detail/goal_info__functions.h"

ROSIDL_GENERATOR_C_PUBLIC_action_msgs
const rosidl_type_hash_t *
action_msgs__msg__GoalInfo__get_type_hash(
const rosidl_message_type_support_t * type_support)
{
(void)type_support;
static rosidl_type_hash_t hash = {1, {
0x63, 0x98, 0xfe, 0x76, 0x31, 0x54, 0x55, 0x43,
0x53, 0x93, 0x07, 0x16, 0xb2, 0x25, 0x94, 0x7f,
0x93, 0xb6, 0x72, 0xf0, 0xfb, 0x2e, 0x49, 0xfd,
0xd0, 0x1b, 0xb7, 0xa7, 0xe3, 0x79, 0x33, 0xe9,
}};
return &hash;
}

#include <assert.h>
#include <string.h>

// Include directives for referenced types
#include "unique_identifier_msgs/msg/detail/uuid__functions.h"
#include "builtin_interfaces/msg/detail/time__functions.h"

// Hashes for external referenced types
#ifndef NDEBUG
static const rosidl_type_hash_t builtin_interfaces__msg__Time__EXPECTED_HASH = {1, {
0xb1, 0x06, 0x23, 0x5e, 0x25, 0xa4, 0xc5, 0xed,
0x35, 0x09, 0x8a, 0xa0, 0xa6, 0x1a, 0x3e, 0xe9,
0xc9, 0xb1, 0x8d, 0x19, 0x7f, 0x39, 0x8b, 0x0e,
0x42, 0x06, 0xce, 0xa9, 0xac, 0xf9, 0xc1, 0x97,
}};
static const rosidl_type_hash_t unique_identifier_msgs__msg__UUID__EXPECTED_HASH = {1, {
0x1b, 0x8e, 0x8a, 0xca, 0x95, 0x8c, 0xbe, 0xa2,
0x8f, 0xe6, 0xef, 0x60, 0xbf, 0x6c, 0x19, 0xb6,
0x83, 0xc9, 0x7a, 0x9e, 0xf6, 0x0b, 0xb3, 0x47,
0x52, 0x06, 0x7d, 0x0f, 0x2f, 0x7a, 0xb4, 0x37,
}};
#endif

static char action_msgs__msg__GoalInfo__TYPE_NAME[] = "action_msgs/msg/GoalInfo";
static char builtin_interfaces__msg__Time__TYPE_NAME[] = "builtin_interfaces/msg/Time";
static char unique_identifier_msgs__msg__UUID__TYPE_NAME[] = "unique_identifier_msgs/msg/UUID";

// Define type names, field names, and default values
static char action_msgs__msg__GoalInfo__FIELD_NAME__goal_id[] = "goal_id";
static char action_msgs__msg__GoalInfo__FIELD_NAME__stamp[] = "stamp";

static rosidl_runtime_c__type_description__Field action_msgs__msg__GoalInfo__FIELDS[] = {
{
{action_msgs__msg__GoalInfo__FIELD_NAME__goal_id, 7, 7},
{
rosidl_runtime_c__type_description__FieldType__FIELD_TYPE_NESTED_TYPE,
0,
0,
{unique_identifier_msgs__msg__UUID__TYPE_NAME, 31, 31},
},
{NULL, 0, 0},
},
{
{action_msgs__msg__GoalInfo__FIELD_NAME__stamp, 5, 5},
{
rosidl_runtime_c__type_description__FieldType__FIELD_TYPE_NESTED_TYPE,
0,
0,
{builtin_interfaces__msg__Time__TYPE_NAME, 27, 27},
},
{NULL, 0, 0},
},
};

static rosidl_runtime_c__type_description__IndividualTypeDescription action_msgs__msg__GoalInfo__REFERENCED_TYPE_DESCRIPTIONS[] = {
{
{builtin_interfaces__msg__Time__TYPE_NAME, 27, 27},
{NULL, 0, 0},
},
{
{unique_identifier_msgs__msg__UUID__TYPE_NAME, 31, 31},
{NULL, 0, 0},
},
};

const rosidl_runtime_c__type_description__TypeDescription *
action_msgs__msg__GoalInfo__get_type_description(
const rosidl_message_type_support_t * type_support)
{
(void)type_support;
static bool constructed = false;
static const rosidl_runtime_c__type_description__TypeDescription description = {
{
{action_msgs__msg__GoalInfo__TYPE_NAME, 24, 24},
{action_msgs__msg__GoalInfo__FIELDS, 2, 2},
},
{action_msgs__msg__GoalInfo__REFERENCED_TYPE_DESCRIPTIONS, 2, 2},
};
if (!constructed) {
assert(0 == memcmp(&builtin_interfaces__msg__Time__EXPECTED_HASH, builtin_interfaces__msg__Time__get_type_hash(NULL), sizeof(rosidl_type_hash_t)));
description.referenced_type_descriptions.data[0].fields = builtin_interfaces__msg__Time__get_type_description(NULL)->type_description.fields;
assert(0 == memcmp(&unique_identifier_msgs__msg__UUID__EXPECTED_HASH, unique_identifier_msgs__msg__UUID__get_type_hash(NULL), sizeof(rosidl_type_hash_t)));
description.referenced_type_descriptions.data[1].fields = unique_identifier_msgs__msg__UUID__get_type_description(NULL)->type_description.fields;
constructed = true;
}
return &description;
}

static char toplevel_type_raw_source[] =
"# Goal ID\n"
"unique_identifier_msgs/UUID goal_id\n"
"\n"
"# Time when the goal was accepted\n"
"builtin_interfaces/Time stamp";

static char msg_encoding[] = "msg";

// Define all individual source functions

const rosidl_runtime_c__type_description__TypeSource *
action_msgs__msg__GoalInfo__get_individual_type_description_source(
const rosidl_message_type_support_t * type_support)
{
(void)type_support;
static const rosidl_runtime_c__type_description__TypeSource source = {
{action_msgs__msg__GoalInfo__TYPE_NAME, 24, 24},
{msg_encoding, 3, 3},
{toplevel_type_raw_source, 111, 111},
};
return &source;
}

const rosidl_runtime_c__type_description__TypeSource__Sequence *
action_msgs__msg__GoalInfo__get_type_description_sources(
const rosidl_message_type_support_t * type_support)
{
(void)type_support;
static rosidl_runtime_c__type_description__TypeSource sources[3];
static const rosidl_runtime_c__type_description__TypeSource__Sequence source_sequence = {sources, 3, 3};
static bool constructed = false;
if (!constructed) {
sources[0] = *action_msgs__msg__GoalInfo__get_individual_type_description_source(NULL),
sources[1] = *builtin_interfaces__msg__Time__get_individual_type_description_source(NULL);
sources[2] = *unique_identifier_msgs__msg__UUID__get_individual_type_description_source(NULL);
constructed = true;
}
return &source_sequence;
}
Loading
Loading