Filling up Point Cloud in ROS Python
I looked at this: http://answers.ros.org/question/20707...
And tried the following:
Point cloud
h = std_msgs.msg.Header()
h.stamp = rospy.Time.now()
pcl = PointCloud()
pcl.header = h
pcl.points = self.Npop_particles
pcl.channels = 3
point = Point()
print pcl.points
for i in range(0, self.Npop_particles):
point.x = 0
point.y = 0
point.z = 0
pcl.points[i].x = point.x
pcl.points[i].y = point.y
pcl.points[i].z = point.z
But I get an error saying pcl.points[i] is an integer:
print pcl.points[i].x TypeError: 'int' object has no attribute '__getitem__'