GithubHelp home page GithubHelp logo

grindingtrajectoryplanning's Introduction

GrindingTrajectoryPlanning

All the code should be run under matlab console.

addpath ./utils/ ./pose/ ./traj/ ./collision_detection/
mex ./utils/generatePointsCloud.cpp % -largeArrayDims % This make mxSize size_t
mex ./utils/myTraverser.cpp

1. Get the target from *.stl

Run the following scripts, this will return v, f, n. readSTLModel function have a parameter func, which is a function handle used for preprocessing, the default is preprocessStlVFN, you can do some other preprocess by change the function.

[v, f, n] = readStlModel("/Users/junr/Documents/Works/graduation-project/code/planning/123.stl");

2. Get the robot arm in SerielLink model.

The following code will return robot as robot arm model.

robot, q0, speed_limit, qlimit = getRobotModel();

3. Planning: get the path.

3.1 Divide the whole stl model into individual faces.

Divide into small faces will need less memory space, but also make the path not global-optimal. So, the path will be generated according to different faces.

clusters = divideIntoFaces(v, f ,n); % clusters have shape [1, #clusters]

3.2 For each face cluster generate path.

[pointsPath, pointsPathIdx] = generatePathFromClusters(clusters, v, f, n, 0.5, 0);

The function generatePath will run following code:

[pointsCloud, pointsCloudFaceIdx] = generatePointsCloud(clusters{cluIdx}, v, f, n, gap);
[orderedPointsCloud, orderedPointsCloudIdx] = myTraverser(pointsCloud, pointsCloudFaceIdx, method);

which use graph traverse algorithm, see myTraverser.cpp for detail.

4. Planning: get the pose along the path.

4.1 Modify NormalVec.

Normal vectors generate before are path normal vectors. As for points, we need add some smoothness between different points in different faces. And you can add more modification to make it fit your project, your robot by changing the function.

normalVecsM = modifyNormalVec(normalVecs);

4.2 Get pose based on normal vectors.

The connectPaths function transfer points and normal vectors into homogeneous transformation matrix. TODO: according to their clustersIdx, add transition path.

Ts = connectPaths(pointsPath, normalVecsM, clustersIdx);

4.3 Get joint space qs.

The Ts2q function transfer homogeneous transformation matrix into joint space coordinates, qs, which is angle of six axis of the robot.

qs = Ts2q(myRobot, q0, 2, Ts);

4.4 Save result.

Save result, name it.

array2txt(qs, '2018-5-16_t1');

grindingtrajectoryplanning's People

Contributors

junrq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

grindingtrajectoryplanning's Issues

关于stlRead文件

你好,当我运行[v, f, n] = readStlModel("/Users/junr/Documents/Works/graduation-project/code/planning/123.stl");
会报如下错误:

找不到 'stlRead' 的完全匹配项(区分大小写)。

最接近的匹配项为: stlread(在 D:\Matlab2018b\toolbox\matlab\polyfun\stlread.m 中)


出错 readStlModel (line 17)
[v, f, n, name] = stlRead(path);

当我把stlRead改成stlread时,又会报

未定义与 'triangulation' 类型的输入参数相对应的运算符 '+'。

出错 preprocessStlVFN (line 11)
v = v + [-300,0,0];

出错 readStlModel (line 18)
[v, f, n] = func(v, f, n);

我不知道您是否对这个项目还有印象,如果还有印象的话,能不能麻烦您指教一下

有几个变量找不到定义

你好,我在运行这个项目时,发现有几个变量找不到定义

 [pointsCloud, pointsCloudFaceIdx] = generatePointsCloud(clusters{cluIdx}, v, f, n, gap);
[orderedPointsCloud, orderedPointsCloudIdx] = myTraverser(pointsCloud, pointsCloudFaceIdx, method);
未定义函数或变量 'cluIdx'。
 
>> normalVecsM = modifyNormalVec(normalVecs);
未定义函数或变量 'normalVecs'。

mex报错

你好,我在尝试使用你的项目时发生mex报错如下:

使用 'Microsoft Visual C++ 2019' 编译。
错误使用 mex
generatePointsCloud.cpp
D:\GrindingTrajectoryPlanning-master\GrindingTrajectoryPlanning-master\utils\generatePointsCloud.cpp(39): warning C4267:
“=”: 从“size_t”转换到“int”,可能丢失数据
D:\GrindingTrajectoryPlanning-master\GrindingTrajectoryPlanning-master\utils\generatePointsCloud.cpp(43): warning C4267:
“初始化”: 从“size_t”转换到“int”,可能丢失数据
D:\GrindingTrajectoryPlanning-master\GrindingTrajectoryPlanning-master\utils\generatePointsCloud.cpp(47): warning C4267:
“=”: 从“size_t”转换到“int”,可能丢失数据
D:\GrindingTrajectoryPlanning-master\GrindingTrajectoryPlanning-master\utils\generatePointsCloud.cpp(58): error C2131: 表
达式的计算结果不是常数
D:\GrindingTrajectoryPlanning-master\GrindingTrajectoryPlanning-master\utils\generatePointsCloud.cpp(58): note: 因读取超过
生命周期的变量而失败
D:\GrindingTrajectoryPlanning-master\GrindingTrajectoryPlanning-master\utils\generatePointsCloud.cpp(58): note: 请参
见“face_num”的用法
D:\GrindingTrajectoryPlanning-master\GrindingTrajectoryPlanning-master\utils\generatePointsCloud.cpp(61): error C3863: 不
可指定数组类型“int [face_num]”
D:\GrindingTrajectoryPlanning-master\GrindingTrajectoryPlanning-master\utils\generatePointsCloud.cpp(64): warning C4244:
“初始化”: 从“double”转换到“int”,可能丢失数据
D:\GrindingTrajectoryPlanning-master\GrindingTrajectoryPlanning-master\utils\generatePointsCloud.cpp(65): warning C4244:
“初始化”: 从“double”转换到“int”,可能丢失数据
D:\GrindingTrajectoryPlanning-master\GrindingTrajectoryPlanning-master\utils\generatePointsCloud.cpp(66): warning C4244:
“初始化”: 从“double”转换到“int”,可能丢失数据
D:\GrindingTrajectoryPlanning-master\GrindingTrajectoryPlanning-master\utils\generatePointsCloud.cpp(76): warning C4267:
“+=”: 从“size_t”转换到“int”,可能丢失数据

不知道是编译器的原因还是什么,能不能您麻烦指教一下

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.