0
$\begingroup$

Rosanswers logo

Hello,

I'm using the arduino with rosserial and my code is the simplest one possible :

#include <ros.h>
#include <ros/time.h>
#include <sensor_msgs/Imu.h>

ros::NodeHandle  nh;

sensor_msgs::Imu imu_msg;
ros::Publisher pub_imu( "/imu", &imu_msg);
char frameid[] = "/imu";

void setup() {  
Serial.begin(57600);

nh.initNode();
nh.advertise(pub_imu);
imu_msg.header.frame_id =  frameid;
imu_msg.header.stamp=nh.now();
}


void loop() {

 pub_imu.publish(&imu_msg);
 nh.spinOnce();
}

And when I run it, I have that kind of error :

[INFO] [WallTime: 1395754919.360506] ROS Serial Python Node
[INFO] [WallTime: 1395754919.372573] Connecting to /dev/ttyUSB0 at 57600 baud
[INFO] [WallTime: 1395754921.671875] Note: publish buffer size is 280 bytes
[INFO] [WallTime: 1395754921.672177] Setup publisher on /imu [sensor_msgs/Imu]
[ERROR] [WallTime: 1395754921.673737] Message from device dropped: message larger than buffer.

So I can see that the message is considered too big by the PythonNode but it's empty and I'm using the standard IMU message. I'm using the Arduino duemilanove. How can I reduce the size of the message ?

[EDIT]

After some test, it mostly come from the fact that it's an IMU message. If I use a range type for example, it works. Is it just impossible to send IMU message type through libserial ? Should I use 3 Publisher to transport the message and create a node that send a Imu_msgs type after ?

Thanks a lot.


Originally posted by Maya on ROS Answers with karma: 1172 on 2014-03-25

Post score: 4


Original comments

Comment by colidar on 2019-06-17:
Thanks for sharing your code! Which imu are you using? I want to use my MPU9250 with arduino uno with rosserial but i dont geht any imu values when i check rostopic echo /imu. Do you know why?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Did you consider increasing buffer size? See this question & answer http://answers.ros.org/question/73627/how-to-increase-rosserial-buffer-size/


Originally posted by Wolf with karma: 7555 on 2014-03-25

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Maya on 2014-03-25:
Thanks a lot that was exactly what I was searching for !

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.