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

Neato LDS intensity data

asked 2018-07-03 22:03:37 -0500

DrBot gravatar image

The Neato LDS scanner returns the angle, range, intensity, and an error code. The neato_driver.py from the XV-11 node does not look at the intensity. I want to use the intensity data to help detect 'bright' obstacles marked by reflective tape. How can the driver by modified to return intensity data. My Python skills are non-existant. my first attempt failed. Can I do a pull request still on the Git repository. (Fergy and Ralph probably have better things to do with their time.

???? Code ????? def getScanRanges(self):

    """ Read values of a scan -- call requestScan first! """
    ranges = list()
    intense = list()
    angle = 0

    if not self.readTo("AngleInDegrees"):
        self.flush()
        return []

    last=False
    while not last: #angle < 360:
        try:
            vals,last = self.getResponse()
        except Exception as ex:
            rospy.logerr("Exception Reading Neato lidar: " + str(ex))
            last=True
            vals=[]

        vals = vals.split(",")

        if ((not last) and ord(vals[0][0])>=48 and ord(vals[0][0])<=57 ):
            #print angle, vals, intense
            try:
                a = int(vals[0])
                r = int(vals[1])
 #                   i = int(vals[2])
                e = int(vals[3])

                while (angle < a):
                    ranges.append(0)
  #                        intense.append(0)
                    angle +=1

                if(e==0):
                    ranges.append(r/1000.0)
  #                       intense.append(i/1000.0)
                else:
                    ranges.append(0)
 #                       intense.append(0) 
            except:
                ranges.append(0)
 #                    intense.append(0)
            angle += 1
   if len(ranges) <> 360:
    rospy.loginfo( "Missing laser scans: got %d points" %len(ranges))

 #        return ranges, intense
     return ranges

The following code with comments(#) removed does not abort, but rostopic echo /scan shows intensities[ ]

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-07-04 01:08:09 -0500

mgruhler gravatar image

(assuming reading the intensity the way you do is correct...) If this is the only file you touched, this obviously does not work. You only return the intensities, but you also have to write it into the sensor_msgs/LaserScan message that is published.

Add it in the respective driver node here. The line should then read:

scan.ranges, scan.intensities = self.robot.getScanRanges()

You can obviously send a PR, they will probably have some feedback or change requests. But just go ahead (if there are contribution guidelines in the repo, make sure to follow them)

P.S. Next time, please add a link to the repo you are modifying. I first only found one ROS driver written in C++.

edit flag offensive delete link more

Comments

Thank you, your answer was correct! by adding scan.intensities to the neato_node/neato.py file, I am able to get both ranges and intensities.

DrBot gravatar image DrBot  ( 2018-07-04 11:42:01 -0500 )edit

Great that it works @DrBot. If the answer is correct, please klick the checkmark next to the question to mark this as solved.

mgruhler gravatar image mgruhler  ( 2018-07-05 00:53:25 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-07-03 22:03:37 -0500

Seen: 229 times

Last updated: Jul 04 '18