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

How to subscribe sensor_msg/Imu via rosserial_arduino

asked 2022-03-05 12:49:21 -0600

zyb1777 gravatar image

I am very new to ROS, please help. My system is ubuntu 18.04 and using ROS melodic. I am using D435i camera which have inbuilt IMU sensor and i am able to using imu_filter_madgwick to publish imu/data. i want to use ESP32 to subscribe the IMU orientation data via rosserial_ardiuno to do some servo controlling here is my code for subscriber

void imuOrientation( const sensor_msgs::Imu::_orientation_type& imu_orientation_msgs){

   imu_quaternion[0]=imu_orientation_msgs.x;
   imu_quaternion[1]=imu_orientation_msgs.y;
   imu_quaternion[2]=imu_orientation_msgs.z;
   imu_quaternion[3]=imu_orientation_msgs.w;


}

however when i run rosserial arduino. it show error

[ERROR] [1646505584.044049475]: Client [/serial_node] wants topic /imu/data to have datatype/md5sum [geometry_msgs/Quaternion/a779879fadf0160734f906b8c19c7004], but our version has [sensor_msgs/Imu/6a62c6daae103f4ff57a132d6f95cec2]. Dropping connection.

i cannot subscribe any value and nh.connect may down. what should i change?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-03-13 03:35:12 -0600

miura gravatar image

The message type seems to be different.

Perhaps the following will solve the problem?

void imuOrientation( const sensor_msgs::Imu& imu_msgs){

   imu_quaternion[0]=imu_msgs.orientation.x;
   imu_quaternion[1]=imu_msgs.orientation.y;
   imu_quaternion[2]=imu_msgs.orientation.z;
   imu_quaternion[3]=imu_msgs.orientation.w;


}
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2022-03-05 12:49:21 -0600

Seen: 230 times

Last updated: Mar 13 '22