0
$\begingroup$

Rosanswers logo

Hello

Im using the IMU data for some orientation platform purpose. Im able to use the IMU in a ROS massagesses in the Callback like these

void imuCallback(const sensor_msgs::ImuConstPtr& msg)
{
  tf::quaternionMsgToTF(msg->orientation, quat);
  tf::Matrix3x3(quat).getRPY(r,p,y); 

But I would like to check when for example some turn of the platforms occur if its exactly by that yaw and pitch.

For example I wonted to record the start time when my platform is start going up/down the ramp , like this condition

if(fabs(p-initial_pitch) >= ramp_ang)
    {
        ramp_pitch = fabs(p-initial_pitch)*57.3;    
        
    }

So I wont to check the IMU data if that is ok.

Any help? Thanks


Originally posted by Astronaut on ROS Answers with karma: 330 on 2013-07-25

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I am not sure I completely understand your question, but I don't think this will work if you want to check if there was a change by any exact amount. If you look at the IMU data you are streaming right now you will almost certainly see some noise even when the IMU is motionless. As a consequence you are unlikely to ever find that the orientation is exactly some angle; you would have to check that the angle was between some range.


Originally posted by MD_MD with karma: 31 on 2013-07-25

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Astronaut on 2013-07-25:
Ok. And how to check that the angle was between some range? I wont to check when my platform go up the ramp ( at some pitch angle let we say 3 deg) really occurs at that pitch (more less). Is it more clear now?

Comment by MD_MD on 2013-07-25:
I would do something like

if(pitch>2.5 && pitch<3.5){ do_something; }

Comment by Astronaut on 2013-07-25:
No. I dont wont to change the code. I just wont to plot my pitch angle getting from IMU data.

Comment by MD_MD on 2013-07-25:
You wil have to change your code in some way if you want it to behave differently. If you are asking about how to get the data from the IMU I would use an IMU filter like imu_filter_madgwick which will calculate the orientation for you.

Comment by Astronaut on 2013-07-25:
Ok. But can I get the orientation without IMU filter like imu_filter_madgwick? I mean using the orientation data like x: 0.00555401947349 y: 0.00845728162676 z: 0.4551037848 w: 0.89038091898 Is it possible?

Comment by MD_MD on 2013-07-25:
Yes, but for the most part IMUs don't give you the orientation directly. They give information like acceleration and momentum which you then have to process into orientation. You would have to subscribe to the topic /imu_data or /imu_data_raw and use that.

Comment by Astronaut on 2013-07-25:
I already subscribe. So with tf::quaternionMsgToTF(msg->orientation, quat); tf::Matrix3x3(quat).getRPY(r,p,y); Im able to get the roll , pitch and yaw. But Dont know how to use the orientation raw IMU data. Understand?So how to get the pitch and yzw from the raw IMU orientation x,y,z and w?

Comment by MD_MD on 2013-07-25:
I see what you mean now. I don't know how to do those calculations myself, I use the IMU filter I previously mentioned to do that for me. If you insist on not using that package you could look at their source code and implement what they did in your own node.

Comment by Astronaut on 2013-07-25:
And if I use their package. How to do that? How did you used the IMU filter? Cause the documentation is not so good.

Comment by MD_MD on 2013-07-25:
Follow the instructions on the imu_tools page to install and once you have done that rosrun imu_tools imu_filter_madgwick after your have started your IMU. It will publish a topic called /imu/data and this will contain orientation.

Comment by Astronaut on 2013-07-25:
Strange . I installed and compile it with rosmake imu_tools. When I tried to rosrun imu_tools imu_filter_madgwick i got error massage stack/package imu_tools not found. Whats wrong??

Comment by Astronaut on 2013-07-25:
rosmake imu_tools works good and compiled without errors. I have this. Built 54 packages with 0 failures. So why rosrun imu_tools imu_filter_madgwick is not working?

Comment by MD_MD on 2013-07-25:
I misremembered the name of the node, although it is in thier documentation if you look. It should be rosrun imu_filter_madgwick imu_filter_node. Let us know if that worked.

Comment by Astronaut on 2013-07-25:
Ok. Now its works. But strange. I got this massage INFO] [1374818078.308309568]: Starting ImuFilter [ INFO] [1374818078.313142482]: Using dt computed from message headers [ INFO] [1374818078.313186901]: Imu filter gain set to 0.100000 [ INFO] [1374818078.313201876]: Gyro drift bias set to 0.000000

Comment by Astronaut on 2013-07-25:
Whats wrong?

Comment by MD_MD on 2013-07-25:
I don't see anything wrong, those message are normal. Did you try rostopic echo /imu/data? That should show you calculated orientations form the /imu/data_raw channel. You can use the orientations there to get pitch/yaw/roll.

Comment by Astronaut on 2013-07-25:
I tried.. Not working ..I got rostopic echo /imu/data WARNING: no messages received and simulated time is active. Is /clock being published?

Comment by Astronaut on 2013-07-25:
Do I need to remap??Cause my Im topic in bag file is called /raw_imu_throttle

Comment by MD_MD on 2013-07-25:
I am not familiar with the /raw_imu_throttle topic or its message, so I can't say if it will work for you to remap it. I thought you were working from a "regular" imu that published /imu/data_raw. It might work if you remap the topic you have to /imu/data_raw, but I'm not sure

Comment by Astronaut on 2013-07-25:
I tried to remap but not working

Comment by MD_MD on 2013-07-26:
Straight remapping may not work if the message formats are different. I am not sure how to help you beyond this because I am not familiar with /raw_imu_throttle messages.

$\endgroup$

Your Answer

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