|
发表于 2013-10-29 12:36:00
|
显示全部楼层
huanger 发表于 2013-10-28 20:57
楼上一定是一位高人了,能在一个通宵做成前瞻,一定是一等一的高人了,可惜我只能用几年时间才能完成这前 ...
前瞻看起来高深莫测,无非就是计算拐点的最大速度, 然后线段合并成准直线, 有时候可能还需要逆推,确确实实就是那几个函数;
当然看你是什么前瞻,如果是在线在运动控制卡中前瞻的话还是比较难的,考虑到嵌入式系统的内存确实比较够呛,但是离线的方式就那么几个函数就搞定了;这是我的前瞻算法的类声明
正正有点技术含量的就三个函数
double GetMaxSpeed(UnitPoint P0, UnitPoint P1, UnitPoint P2);
void CombineSemiLines(vector<SemiLine> &semiLines,SemiLine line);
void FindSemiLines(const UnitPoint* pPoints, int count);
class CLookAhead
{
public:
double m_dbMaxSpeed;
double m_dbMinSpeed;
double m_dbAccSpeed;
double m_dbMaxPerSpeed;
CLookAhead(double startSpeed,double highSpeed,double accSpeed,double maxSingleSpeed);
~CLookAhead(void);
double GetLength(UnitPoint P0, UnitPoint P1);
double GetMinEndSpeed(double l,double startSpeed,double accSpeed);
double GetMaxEndSpeed(double l,double startSpeed,double accSpeed);
double GetSemiLineHighSpeed(double l,double startSpeed,double endSpeed,double accSpeed);
double GetMaxSpeed(UnitPoint P0, UnitPoint P1, UnitPoint P2);
void CombineSemiLines(vector<SemiLine> &semiLines,SemiLine line);
void FindSemiLines(const UnitPoint* pPoints, int count);
}; |
|