- Problem Def
- The reason why I've been investigating 3D, dynamic convex hull is to calculate and visualize it with working excavator, for safety control.
- The concept is similar with the objective of proximity sensor mounted in vehicle, which allows safety stop of a vehicle by detecting obstacles before crashing.
- So far, we're developing simulator of it focusing on excavator, where safety control of excavator is much complex due to it's kinematic characteristic.
- Same problem in 2D space is simpler and we already have a result.
- As you may notice, the area is predicted using angular velocity of the cabin so it is became wider along its rotation heading.
- It stops when detecting an obstacle in "danger area".
- The prediction of actual danger area is much complicated and emergency stop algorithm considers many variables. It will be studied by other research group. And is not included in video clip.
- What I have done is calculate and visualize 2D danger area by 2D convex hull algorithm using series of offset points of cabin where the movement of it is simply predicted from linear extrapolation.
- In this new series of posts, I will study the method to calculate and visualize 3D danger area in real-time rate. In 3D, all movement of its components(cabin, boom, arm and bucket) will be precisely reflected in danger area.
- Preparation
- First step I did for 3D is reducing the number of points for convex hull calculation. The target source model of mine has 26,805 points(vertices).
- As you may seen in previous post regarding my implementation of 3D convex hull using QuickHull method, it is hard to achieve real-time rate(let our first, ambitious target number as 30Hz, around 30ms)with that much point input. It results 280ms to calculate 3D convex hull in MeshLab.
- We don't need all these points in runtime. We only need the points that has a possibility to contribute in result convex hull.
- As a preprocessing, convex hull of each component(cabin, boom, arm and bucket) mesh with 1 unit(=meter in application) offset has been made and recorded the information of point(actually, index of vertices).
- In runtime, only those points are considered for convex hull calculation.
- As a result, 1,750 point set is a minimum number of input point when excavator doesn't move.
Example of arm mesh preprocessing. With 1 unit offset, convex hull was calculated with 233 out of 2,687 points, so we can filter out rest points in run time calculation. |
Convex hull of all components. 1,750 out of 26,805 points contributes to result convex hull. |
- First development
- Unfortunately, we have to deal with up to 35,000 points in runtime.
- Since danger area should be "predictive", number of points are larger than 1,750. For example, we set the prediction interval as 100 ms and prediction time up to 2000 ms. Therefore up to 1,750 x (2000/100) = 35,000 number of points are became input for each frame.
- The first version of application is implemented with features below
- Simple excavator manipulation using keyboard
- Component movement prediction using linear extrapolation and several global-local coordinate conversion between orientation of components
- Some debug & logging modules for further performance test
- Of course, 3D convex hull calculation using points from 2.
- To prevent convex hull calculation affects rendering-related executions, 4. was implemented as a separated thread.
- Result video clip is here.
- Without movement, calculation from 1,750 point input can be done around 80~90ms.
- When there is a movement, so prediction starts, (you may see the predictive danger area covers ahead from current position of components) around 20,000 points are passed as an input so calculation takes around 250ms.
- Therefore for 30ms calculation, about 10 times faster calculation is required.
- Next
- I'm considering to develop parallelized calculation for convex hull.
- There is a PAPER studied Quickhull algorithm with CUDA(named CudaHull), but I'm not sure it may fit to our application. GPU-CPU data transfer takes time and if we follow the method of CudaHull, the transfer should happened in every single frame.