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

Can we split laser scan data into sections and publish as multiple topics

asked 2021-12-29 03:38:11 -0500

akash12124234 gravatar image

I was trying to split the laser scan range data into subcategories and like to publish each category into different laser topics.

to specify more, the script should get one topic as an input - /scan and the script should publish three topics as follow = scan1 , scan2 , scan3

is there an way to split the laser scan and publish back and look them on rviz

i tried the following

def callback(laser):
    current_time = rospy.Time.now()
    regions["l_f_fork"] = laser.ranges[0:288]
    regions["l_f_s"] = laser.ranges[289:576]
    regions["stand"] = laser.ranges[576:864]
    l.header.stamp = current_time
    l.header.frame_id = 'laser'
    l.angle_min = 0
    l.angle_max = 1.57
    l.angle_increment =0
    l.time_increment = 0
    l.range_min = 0.0
    l.range_max = 100.0
    l.ranges = regions["l_f_fork"]
    l.intensities = [0]

    left_fork.publish(l)

    # l.ranges = regions["l_f_s"]
    # left_side.publish(l)

    # l.ranges = regions["stand"]
    # left_side.publish(l)

    rospy.loginfo("publishing new info")

i can see the different topics on rviz, but they are lie on the same line,

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-12-30 10:16:15 -0500

Mike Scheutzow gravatar image

You need to assign angle_min and angle_max the correct values in each LaserScan message. Some subscribers will also require that angle_increment is set correctly.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-12-29 03:38:11 -0500

Seen: 101 times

Last updated: Dec 30 '21