ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
4

IMU and rosserial

asked 2014-03-25 03:44:11 -0600

Maya gravatar image

updated 2014-03-25 04:10:56 -0600

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.

edit retag flag offensive close merge delete

Comments

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?

colidar gravatar image colidar  ( 2019-06-17 04:03:35 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-03-25 04:40:50 -0600

Wolf gravatar image

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

edit flag offensive delete link more

Comments

1

Thanks a lot that was exactly what I was searching for !

Maya gravatar image Maya  ( 2014-03-25 16:58:51 -0600 )edit
0

answered 2016-04-21 08:53:57 -0600

Dias gravatar image

So did you solve the problem? If yes can you please answer me)

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2014-03-25 03:44:11 -0600

Seen: 3,123 times

Last updated: Apr 21 '16