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

bja's profile - activity

2021-02-19 22:53:44 -0500 received badge  Great Question (source)
2016-05-26 07:56:54 -0500 received badge  Good Question (source)
2015-10-05 08:54:06 -0500 received badge  Nice Question (source)
2015-03-18 14:31:26 -0500 received badge  Student (source)
2013-10-10 05:45:21 -0500 asked a question Confusion on Quaternion Normalize

I see from the tf::Quaternion documentation, that the "normalize()" function "Normalizes the quaternion Such that x^2+y^2+z^2+w^2=1".

However, I am not seeing this in practice. I have an existing transform t2, whose quaternion I am grabbing and setting to q1. Then I normalize q1:

tf::Quaternion q1=t2.getRotation();
q1.normalize();

Next, I print out the contents of t2's Quaternion, and q1. q1 should be normalized, but as seen below it is not. Here is how I print out the values:

std::cout<<"t1 quat: " << t1.getRotation().getAxis().getX() << ' ' << t1.getRotation().getAxis().getY() << ' '<<t1.getRotation().getAxis().getZ()<< ' ' <<t1.getRotation().getW()  << std::endl;


std::cout<<"q1 quat: " << q1.getAxis().getX() << ' ' << q1.getAxis().getY() << ' '<<q1.getAxis().getZ()<< ' ' <<q1.getW()  << std::endl;

And here is what I get back (after q1 has been normalized):

t1 quat: -0.0385956 0.973826 -0.224049 0.999447
q1 quat: -0.0385951 0.973814 -0.224046 0.999447

Nothing changed, even though t1's quaternion was not normalized and hence q1 should be. I know I'm missing something here and would appreciate clarity.

2013-08-23 09:56:14 -0500 received badge  Famous Question (source)
2013-07-16 01:26:23 -0500 received badge  Notable Question (source)
2013-07-15 08:29:16 -0500 commented answer Subscriber callback not being called in C++

That was exactly my problem, I wasn't declaring "ekf_sub" in my header file and it was thus going out of scope. My callback function is now reached; thank you very much!

2013-07-15 08:28:21 -0500 received badge  Scholar (source)
2013-07-15 08:01:35 -0500 received badge  Popular Question (source)
2013-07-15 06:55:15 -0500 commented question Subscriber callback not being called in C++

I am using a launch file and output is already set to "screen". I verified again that by doing "rostopic echo /ardrone/predictedPose" the topic is publishing messages (I also observe this in rqt, that rostopic is subscribed to the topic).

2013-07-15 05:53:06 -0500 commented question Subscriber callback not being called in C++

Yes that was a typo, I changed it in my description, thanks. And yes within the node code, after the "VisualOdometry" object is created, "ros::spin()" is executed.

2013-07-15 05:49:04 -0500 received badge  Editor (source)
2013-07-15 05:33:06 -0500 commented question Subscriber callback not being called in C++

The class "VisualOdometry" is being run as a node, and is currently subscribing to rgb and depth images from a Kinect. I'm trying to make it also subscribe to the above topic.

2013-07-15 05:11:52 -0500 asked a question Subscriber callback not being called in C++

I am trying to subscribe to a topic and trigger a callback function. Following the wikipage on subscribers, I wrote the following lines (since I am dealing with C++ namespaces):

ros::Subscriber ekf_sub = nh_.subscribe("/ardrone/predictedPose", queue_size_, &VisualOdometry::ekf_callback, this);

void VisualOdometry::ekf_callback(const tum_ardrone::filter_state::ConstPtr& ekf_msg){
std::cout<<"EKF callback function reached "<<std::endl;}

I have used "rostopic list" and rqt to verify the topic "/ardrone/predictedPose" is being published while my program is running. I have used "rostopic info" to verify that the topic is of type "tum_ardrone/filter_state".

In my subscriber constructor, "nh_" is a public nodehandle that is successfully used in the class ("VisualOdometry") for other subscribers. "queue_size_" is simply an int set to 5, and "this" is the pointer to the instance of the class "VisualOdometry" (since that's where the code is located).

I have further verified that the subscriber constructor line is executed, but my callback function is never called. Any help or tips on how to debug is much appreciated since I'm unsure of what to do. I am using ROS Groovy.

2013-05-13 10:06:10 -0500 received badge  Supporter (source)