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

Hi all!

I managed to get the edge coordinates. Here is the solution:

            float x1 = box.pose.position.x + box.scale.x/2;
            float x2 = box.pose.position.x - box.scale.x/2;
            float y1 = box.pose.position.y + box.scale.y/2;
            float y2 = box.pose.position.y - box.scale.y/2;
            float z1 = box.pose.position.z + box.scale.z/2;
            float z2 = box.pose.position.z - box.scale.z/2;

            float x_coordinate [2] = {x1, x2};
            float y_coordinate [2] = {y1, y2};
            float z_coordinate [2] = {z1, z2};

            vector<geometry_msgs::PointStamped> box_corner_coordinates;
            for (int i = 0; i < 2; i++) {
                for (int j = 0; j < 2; j++) {
                    for (int k = 0; k < 2; k++) {
                        geometry_msgs::PointStamped Point;

                        Point.point.x = x_coordinate[i];
                        Point.point.y = y_coordinate[i];
                        Point.point.z = z_coordinate[i];
                        box_corner_coordinates.push_back(Point);
                    }
                }
            }

Hope it helps!