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

Revision history [back]

click to hide/show revision 1
initial version

Got it to work with the following loop

for(;iter_xx != iter_xx.end(); ++iter_xx, ++iter_yy)
    {
        point_dist = hypot(*iter_xx, *iter_yy);
        if (point_dist <= cut_off_dist)
        {
            //todo fill in data
           auto test=  &pointcloud_in->data[counter1 * pointcloud_in->point_step + pointcloud_in->fields[0].offset];
           auto t=  &pointcloud_out.data[counter2 * pointcloud_out.point_step + pointcloud_out.fields[0].offset];

            memcpy (&pointcloud_out.data[counter2 * pointcloud_out.point_step + pointcloud_out.fields[0].offset],
                    &pointcloud_in->data[counter1 * pointcloud_in->point_step + pointcloud_in->fields[0].offset], sizeof (float));
            memcpy (&pointcloud_out.data[counter2 * pointcloud_out.point_step + pointcloud_out.fields[1].offset],
                    &pointcloud_in->data[counter1 * pointcloud_in->point_step + pointcloud_in->fields[1].offset], sizeof (float));
            memcpy (&pointcloud_out.data[counter2 * pointcloud_out.point_step + pointcloud_out.fields[2].offset],
                    &pointcloud_in->data[counter1 * pointcloud_in->point_step + pointcloud_in->fields[2].offset], sizeof (float));
            counter2++;
        }
        counter1++;
    }

Got it to work with the following loop

for(;iter_xx != iter_xx.end(); ++iter_xx, ++iter_yy)
    {
        point_dist = hypot(*iter_xx, *iter_yy);
        if (point_dist <= cut_off_dist)
        {
            //todo fill in data
           auto test=  &pointcloud_in->data[counter1 * pointcloud_in->point_step + pointcloud_in->fields[0].offset];
           auto t=  &pointcloud_out.data[counter2 * pointcloud_out.point_step + pointcloud_out.fields[0].offset];

            memcpy (&pointcloud_out.data[counter2 * pointcloud_out.point_step + pointcloud_out.fields[0].offset],
                    &pointcloud_in->data[counter1 * pointcloud_in->point_step + pointcloud_in->fields[0].offset], sizeof (float));
            memcpy (&pointcloud_out.data[counter2 * pointcloud_out.point_step + pointcloud_out.fields[1].offset],
                    &pointcloud_in->data[counter1 * pointcloud_in->point_step + pointcloud_in->fields[1].offset], sizeof (float));
            memcpy (&pointcloud_out.data[counter2 * pointcloud_out.point_step + pointcloud_out.fields[2].offset],
                    &pointcloud_in->data[counter1 * pointcloud_in->point_step + pointcloud_in->fields[2].offset], sizeof (float));
            counter2++;
        }
        counter1++;
    }