# Get Volume of Graphics Object

I would like to know if there is any way to get the volume of an object, even something easy as a box.
That is, say I want to randomly create boxes of different sizes and then sort them by size. I would like to use some sort of volume sensor for this.
I've been searching for a smart component that can get the sides of a box but with no sucess.
Tagged:

• So measure it not calculate in code?
• You could make use of the line sensor since it will give you the point where the sensed object is. The setup for such a solution could be done in various ways. You could make us of a squaring table to slide the component to a known position using two sensors to measure the sides of boxes, then a third sensor either on a fixed position over the box or on the robot measuring the height of the cube. If the cycle time isn't that critical you could simply use a single sensor on the robot sliding it over the top of the cube to detect the edges and calculate the volume based on the positions of the edges. This will give both the position and volume of the cube and depending on the number of points you measure you could also get the rotation of the cube.

If you don't really need to simulate any measuring you could simply save the measurements used when generating the boxes and calculate the volume based on the values for each box.
• dnilsson said:
You could make use of the line sensor since it will give you the point where the sensed object is. The setup for such a solution could be done in various ways. You could make us of a squaring table to slide the component to a known position using two sensors to measure the sides of boxes, then a third sensor either on a fixed position over the box or on the robot measuring the height of the cube. If the cycle time isn't that critical you could simply use a single sensor on the robot sliding it over the top of the cube to detect the edges and calculate the volume based on the positions of the edges. This will give both the position and volume of the cube and depending on the number of points you measure you could also get the rotation of the cube.

If you don't really need to simulate any measuring you could simply save the measurements used when generating the boxes and calculate the volume based on the values for each box.
I had an idea of making a postal service station which could differentiate between how large the objects were and sort them depending on size.
To simulate a real world scenario I would want do dump all packages in a pile, then singulate them through conveyers and then sort them depending on volume.

My current idea is to measure the time the object takes to pass the sensor, multiply it with the speed to get the distance. Then make the robot grab the package in the middle of this distance. Do you know if there is a way to make the robot track an arbitrary packages speed?

I made a fast setup to show you the idea. 