compiler issue platformio
Working on Teensy 4.1 project under Ubuntu 22.04.1 to communicate to a ROS2 "network". The Teensy will be the low-level I/O control node utilizing microROS and micro_ros_platformio
I'm having an issue with compiling the below code. I'm attempting to get a service node up and running and using the addTwoInts service from microROS arduino as a starting point
I have resolved all dependency issues and the code now almost compiles.
There is just seeming a single issue I can NOT resolve.
When compiling / building the entire project following the documentation with the PlatformIO workflow it gets stuck at step 2.
1. pio lib install # Install dependencies
2. pio run # Build the firmware
3. pio run --target upload # Flash the firmware
This is the entire source code:
//#include <micro_ros_arduino.h>
#include <Arduino.h>
#include <micro_ros_platformio.h>
#include <example_interfaces/srv/add_two_ints.h>
#include <stdio.h>
#include <rcl/error_handling.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>
#include <std_msgs/msg/int64.h>
rcl_node_t node;
rclc_support_t support;
rcl_allocator_t allocator;
rclc_executor_t executor;
rcl_service_t service;
rcl_wait_set_t wait_set;
example_interfaces__srv__AddTwoInts_Response res;
example_interfaces__srv__AddTwoInts_Request req;
#define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){while(1){};}}
#define RCSOFTCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){}}
void service_callback(const void * req, void * res){
example_interfaces__srv__AddTwoInts_Request * req_in = (example_interfaces__srv__AddTwoInts_Request *) req;
example_interfaces__srv__AddTwoInts_Response * res_in = (example_interfaces__srv__AddTwoInts_Response *) res;
//printf("Service request value: %d + %d.\n", (int) req_in->a, (int) req_in->b);
res_in->sum = req_in->a + req_in->b;
}
void setup() {
//set_microros_transports();
Serial.begin(115200);
set_microros_serial_transports(Serial);
delay(1000);
allocator = rcl_get_default_allocator();
// create init_options
RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));
// create node
RCCHECK(rclc_node_init_default(&node, "add_twoints_client_rclc", "", &support));
// create service
RCCHECK(rclc_service_init_default(&service, &node, ROSIDL_GET_SRV_TYPE_SUPPORT(example_interfaces, srv, AddTwoInts), "/addtwoints"));
// create executor
RCCHECK(rclc_executor_init(&executor, &support.context, 1, &allocator));
RCCHECK(rclc_executor_add_service(&executor, &service, &req, &res, service_callback));
}
void loop() {
delay(100);
RCSOFTCHECK(rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100)));
}
Here is the compiler output:
administrator@dev01:~/Documents/gitclones/AutoBot_uros$ pio run
Processing teensy41 (platform: teensy; board: teensy41; framework: arduino)
----------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.17.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
- framework-arduinoteensy @ 1.157.220801 (1.57)
- tool-teensy @ 1.157.0 (1.57)
- toolchain-gccarmnoneeabi @ 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> https://bit(dot)ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Installing pyyaml with pip at PlatformIO environment
/usr/bin/python3 -m pip install pyyaml
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (5.4.1)
Installing markupsafe==2.0.1 with pip at PlatformIO environment
/usr/bin/python3 -m pip install markupsafe==2.0.1
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: markupsafe==2.0.1 in /usr/lib/python3/dist-packages (2.0.1)
Configuring teensy41 with transport serial
micro-ROS already built
Found 93 compatible libraries
Scanning dependencies...
Dependency Graph
|-- micro_ros_platformio @ 0.0.1+sha.22cf9b6
Building in release mode
Compiling .pio ...
This question may be related to #q407573 and #q407563
An actual reply would be of more help
@ROS_Aotearoa If you think that rudeness like this is going to encourage us to help you, you are mistaken.
@Mike Scheutzow You're absolutely right. Don't know what I was thinking. I'm just so frustrated that I haven't made any progress in 3 weeks. Maybe it's a bit much migrating from ROS to ROS 2, using microROS, and a not as widely used platform... My entire design is based on the Teensy. Got the PCB's made everything is wired up. Just to ending up tossing it in the bin. It's taken me 4 months to get to a point where the hardware is done.
I am planning on porting the examples back into the github repo, so it can be of use for others, but I do need some assistance along the way.