[ros-users] cvMat -> ros message

Forside
Vedhæftede filer:
Indlæg som e-mail
+ (text/plain)
Slet denne besked
Besvar denne besked
Skribent: Dan Lazewatsky
Dato:  
Til: ros-users
CC: Todd Anderson
Emne: [ros-users] cvMat -> ros message
Hi all -
I have a cvMat that I'm trying to send out in a ROS message, but I'm
having some issues getting it to work right.

My message definition is: float64[9] mat
I'm loading data into the message as follows:
myMessage h_m;
for(int j=0; j<3;++j){
     for(int k=0; k<3; ++k){
         h_m.mat[j+k*3] = cvmGet(&_h, j, k);
     }
}


No errors here, but when I look at the data from a subscriber (or using
rostopic echo), but numbers are wrong. Numbers that should be in the
range of 0-10 end up in 10^6-10^-5. I've tried creating a
std_msgs::Float64 and casting to a Float64 first, neither of which
worked. I'm at a bit of a loss as to what's going on. Any help would be
appreciated.

Thanks,
-Dan