ros-drivers / rosserial

A ROS client library for small, embedded devices, such as Arduino. See: http://wiki.ros.org/rosserial
508 stars 527 forks source link

ROS Noetic + Ubuntu 20.04 + Arduino Mega 2560 #588

Closed mtlazaro closed 2 years ago

mtlazaro commented 2 years ago

Hi all,

I'm new in the use of Arduino. I have an updated setup of Ubuntu 20.04 + ROS Noetic + Arduino Mega 2560. I'm trying to make the HelloWorld example from rosserial_arduino work without success. I have installed Arduino IDE, ros-noetic-rosserial, ros-noetic-rosserial-arduino, ros-noetic-rosserial-python, ros-noetic-msgs and ros-noetic-rosserial-server. Then I'm able to run rosrun rosserial_arduino make_libraries.py . on my sketchbook folder. I have also checked that my user belongs to dialout group. Then, on Arduino IDE I select the HelloWorld example and the following error appears when I try to compile.

Could someone help? It seems noetic-devel branch is not being maintained since 1 year ago. Thanks.

In file included from /home/mtlazaro/sketchbook/libraries/ros_lib/ros/node_handle.h:43:0,
                 from /home/mtlazaro/sketchbook/libraries/ros_lib/ros.h:38,
                 from HelloWorld.pde:6:
/home/mtlazaro/sketchbook/libraries/ros_lib/rosserial_msgs/RequestParam.h: En el constructor ‘rosserial_msgs::RequestParamResponse::RequestParamResponse()’:
/home/mtlazaro/sketchbook/libraries/ros_lib/rosserial_msgs/RequestParam.h:72:39: error: ‘nullptr’ no se declaró en este ámbito
       ints_length(0), st_ints(), ints(nullptr),
                                       ^
In file included from /home/mtlazaro/sketchbook/libraries/ros_lib/ros.h:38:0,
                 from HelloWorld.pde:6:
/home/mtlazaro/sketchbook/libraries/ros_lib/ros/node_handle.h: En el ámbito global:
/home/mtlazaro/sketchbook/libraries/ros_lib/ros/node_handle.h:121:45: error: ‘nullptr’ no se declaró en este ámbito
   Publisher * publishers[MAX_PUBLISHERS] = {nullptr};
                                             ^
/home/mtlazaro/sketchbook/libraries/ros_lib/ros/node_handle.h:122:47: error: ‘nullptr’ no se declaró en este ámbito
   Subscriber_ * subscribers[MAX_SUBSCRIBERS] {nullptr};
                                               ^
romainreignier commented 2 years ago

If nullptr is not defined it might be because your compiler does not support the C++11 standard or you need to enable it (--std=c++11).

mtlazaro commented 2 years ago

Hi, I realized that the HelloWorld example was only working on my setup up to commit #04ddab73643e617910cbfdfe6dcf60476385bffe

Finally I've installed a newer version of the Arduino IDE from the web (and not using sudo apt install arduino).

Now ros_lib for Arduino works without compilation issues with the installation of rosserial from the Noetic distribution.