Is the rrt exploration working with noetic?

asked 2022-01-09 06:19:05 -0500

sincoy gravatar image

Hey ROS developers,

I am working with the rrt exploration in ROS noetic for my mobile robot. In the beginning the robot was not moving, although every installing for using rrt exploration was done. Therefore I was searching for the issue in source codes (global_detector.cpp, local_detector.cpp, filter.py and assigner.py)

I figured out that something with the while loop was not correct in the filter.py:

old filter.py:

 while z < len(centroids):
          cond = False
          temppoint.point.x = centroids[z][0]
          temppoint.point.y = centroids[z][1]

          for i in range(0, n_robots):

              transformedPoint = tfLisn.transformPoint(
                  globalmaps[i].header.frame_id, temppoint)
              x = array([transformedPoint.point.x, transformedPoint.point.y])
              cond = (gridValue(globalmaps[i], x) > threshold) or cond
          if (cond or (informationGain(mapData, [centroids[z][0], centroids[z][1]], info_radius*0.5)) < 0.2):
              centroids = delete(centroids, (z), axis=0)
              z = z-1
          z += 1
# -------------------------------------------------------------------------
# publishing
      arraypoints.points = []
      for i in centroids:
          tempPoint.x = i[0]
          tempPoint.y = i[1]
          arraypoints.points.append(copy(tempPoint))
      filterpub.publish(arraypoints)
      pp = []
      for q in range(0, len(frontiers)):
          p.x = frontiers[q][0]
          p.y = frontiers[q][1]
          pp.append(copy(p))
      points.points = pp
      pp = []
      for q in range(0, len(centroids)):
          p.x = centroids[q][0]
          p.y = centroids[q][1]
          pp.append(copy(p))
      points_clust.points = pp
      pub.publish(points)
      pub2.publish(points_clust)
      rate.sleep()

new filter.py:

  while z < len(centroids):
                cond = False
                temppoint.point.x = centroids[z][0]
                temppoint.point.y = centroids[z][1]

            for i in range(0, n_robots):

                transformedPoint = tfLisn.transformPoint(
                    globalmaps[i].header.frame_id, temppoint)
                x = array([transformedPoint.point.x, transformedPoint.point.y])
                cond = (gridValue(globalmaps[i], x) > threshold) or cond
            if (cond or (informationGain(mapData, [centroids[z][0], centroids[z][1]], info_radius*0.5)) < 0.2):
                centroids = delete(centroids, (z), axis=0)
                z = z-1
            z += 1
# -------------------------------------------------------------------------
# publishing
              arraypoints.points = []
              for i in centroids:
                  tempPoint.x = i[0]
                  tempPoint.y = i[1]
                  arraypoints.points.append(copy(tempPoint))
              filterpub.publish(arraypoints)
              pp = []
              for q in range(0, len(frontiers)):
                  p.x = frontiers[q][0]
                  p.y = frontiers[q][1]
                  pp.append(copy(p))
              points.points = pp
              pp = []
              for q in range(0, len(centroids)):
                  p.x = centroids[q][0]
                  p.y = centroids[q][1]
                  pp.append(copy(p))
              points_clust.points = pp
              pub.publish(points)
              pub2.publish(points_clust)
              rate.sleep()

Finally the problem was that the publishing code do not get any centroid data after the while loop. Therefore the assigner could not send any move action to the mobile robot. Could somebody verify my solved problem to move my robot? Is my solution correct?

My problem is now that the robot is moving but the rrt algortihm is not working very well. Maybe the parameters in filter and assigner are not correct. Could somebody give me some advice?

Thanks a lot! I appreciate your help!

edit retag flag offensive close merge delete