Lukas Chen - s2276294
Alex Sykes - s2337768
This solution uses the ndcurves library.
Can be found in the videos/ folder.
Related file(s): inverse_geometry.py
computeqgrasppose() was implemented to compute a valid grasping configuration for a given cube pose.heuristic() computes pose difference between two end effector frames and two target poses and the joint limit penalty returned by jointlimitscost(). We then used the fmin_bfgs() function from scipy.optimize to compute a solution configuration by minimizing the returned cost of heuristic(). Finally we verified the configuration distanceToObstacle() and collision() to make sure it is valid.
Related file(s): path.py, rrt.py
For path planning, we implemented a variation of RRT-connect (bi-directional RRT). Each node stores both a cube pose and the interpolated grasp trajectory from its parent. Samples that fall too close to existing nodes are collapsed, reusing the nearest node instead of creating a new one. When expanding, if a new node successfully connects to the start tree, its actual cube pose replaces the original random sample in later trying to make a connection with the end-tree. Nodes are rejected if IK fails or the robot gets too close to obstacles (will explain in next part). When both trees grow by 1 thats when a possible connection is found. The final path is constructed by concatenating the paths from the connecting node to start (in reverse order) and from the connecting node to end.
Related file(s): trajectory.py
create_trajectory_from_path() smooths the discrete path produce by computepath() by constructing a Bézier curve in joint space. It computes how much the joints move between successive configurations and uses the total joint-space path length to decide how many control points the curve should have and how long the motion should take. It then builds a Bézier curve that interpolates the joint configurations over this time interval and analytically computes smooth velocity and acceleration profiles.
To avoid collisions, we make sure the generated path maintains a minimum distance from obstacles. During RRT expansion, we check the interpolated grasp trajectory between nodes using distanceToObstacle(). If any configuration in the trajectory is too close to obstacles, the new node is rejected. Although this does not fully guarantee collision-free path, it significantly reduces the chance of collision after smoothing. We have tried to implement optimisation with non-linear constrains, but it was painfully slow, you can check this in the code commented out in trajectory.py
Related file(s): control.py
The control law we implemented was:
Related files: config.py
We decided to introduce additional configurable params in the config.py file.
| Param | Defult values | Description |
|---|---|---|
CHEST_FRAME_NAME |
"CHEST_JOINT0" | Name of the chest frame. |
RRT_SAMPLE_XYZ_UPPER_LIMIT |
[0.7, 0.6, 0.8] | Maximum XYZ radius from CHEST_JOINT0 to generate pose sample for RRT. |
RRT_SAMPLE_XYZ_LOWER_LIMIT |
[0.2, -0.6, -0.8] | Minimum XYZ radius from CHEST_JOINT0 to generate pose sample for RRT. |
RRT_SAMPLE_LIMIT_RPY |
False | Whether to limit generate pose sample with different orientation. This will be overridden into False if CUBE_PLACEMENT and CUBE_PLACEMENT_TARGET have different orientation. |
RRT_SAMPLE_RPY_RANGE |
[0.1, 0.2, 0.3] | The range of rotation from orientation of CUBE_PLACEMENT allowed while generating sample, unit is CUBE_PLACEMENT and CUBE_PLACEMENT_TARGET have different orientation. |
RRT_MAX_SAMPLE_SIZE |
5000 | Maximum sample allowed in RRT. |
RRT_MAX_NODE_DISPLACEMENT |
0.20 | Maximum displacement of sample allowed from the closest node in the tree. |
RRT_MIN_NODE_DISPLACEMENT |
0.15 | Minimum displacement of sample allowed from the closest node in the tree. If a sample is under the minimum, they will collapse into a same node. |
RRT_STEER_PER_STEP |
0.05 | The maximum steer per joint between 2 interpolation check (grasp sequences) between nodes |
RRT_ROOT_TO_NODE_DISCOUNT |
0.92 | The discount of displacement if the connection is between a root node and a sample node |
RRT_MIN_DISTANCE_TO_OBS |
0.01 | The minimum distance to obstacle for all configurations in grasp configuration sequences between 2 nodes. If one of the node is a root node, the value will be overridden into the smaller of the given value or the value compute with the init/end config. |
| Param | Defult values | Description |
|---|---|---|
CONTROL_POINT_PER_UNIT |
10 | The distance of the generated path is calculated (sum of configouration norm), this decide how many control points will be use per unit in the final trajectory |
TIME_PER_CONTROL_POINT |
0.05 | The time between each control points, use to calculate how long the trajectory will take. |
| Param | Defult values |
|---|---|
DEBUG |
False |
CACHE_PATH |
False |
CACHE_DIR |
'cached_path' |
USE_CACHE_PATH |
False |
CACHED_FILE_NAME |
'path_10_11_17_57.npy' |