IMU and rosserial
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.
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?