Ask Your Question
0

Laser scan message publishing error

asked 2012-02-03 00:46:32 -0500

alfa_80 gravatar image

I have a problem regarding publishing laser scan message. It is publishing but, rather, it works differently. The laser scan keeps on rotating pretty fast and it's normally shouldn't move so fast as the scan message doesn't have any other information like position and orientation. I'm willing to use only 90 degree of the middle region of the laser scan view/mirror. Perhaps, I've overlooked something that somebody could figure out. The laser scan data resides in a dataset file in which it starts from column of 10 to 1080.

            while (n.ok() && (t < num_row))
            {
                scan.header.frame_id = "laser";

                scan.angle_min = -45 * M_PI / 180; // -45 degree
                scan.angle_max = 45 * M_PI / 180;   // 45 degree

                scan.angle_increment = 0.25 * M_PI/180.0;

                scan.time_increment = (1 / laser_frequency) / (int)(90/0.25); 

                scan.range_min = 0.0;
                scan.range_max = 30.0;

                scan.ranges.resize((int)(90/0.25));

                for(int i = 0; i < 360; ++i)
                {
                     scan.ranges[i] = data_set[t][i+9+360] / 1000.0;
                }

                scan.header.stamp = ros::Time::now();

                scan_pub.publish(scan);

            }

Thanks in advance.

edit retag flag offensive close merge delete

Comments

Why are you adding 360 to the index of data_set? What is the native maximum angle of your scan?
DimitriProsser gravatar image DimitriProsser  ( 2012-02-03 00:50:01 -0500 )edit
Maximum angle is 270 deg with 1080 points per scan line.
alfa_80 gravatar image alfa_80  ( 2012-02-03 01:02:50 -0500 )edit
I've set 360 as such, because it's the lower bound by which it corresponds to 90(starts from left or right) deg of the scanning.
alfa_80 gravatar image alfa_80  ( 2012-02-03 01:10:12 -0500 )edit
Could you also be more descriptive of your error?
DimitriProsser gravatar image DimitriProsser  ( 2012-02-03 01:21:29 -0500 )edit
alfa_80 gravatar image alfa_80  ( 2012-02-05 01:40:45 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-02-03 02:25:18 -0500

alfa_80 gravatar image

I've just solved it. Actually the culprit is because of the wrongly assigned number of column variable.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-02-03 00:46:32 -0500

Seen: 324 times

Last updated: Feb 03 '12