コード例 #1
0
    def projectPosition(self,bgeCar):

        fun = '[projectPosition]'

        idx_inf = bgeCar.racingLinePointInf
        idx_sup = bgeCar.racingLinePointSup
        fact = 0.4
        speed = bgeCar.getSpeed()
        dist = speed * fact
        
##        self.logger.info(fun + 'expected distance: ' + str(dist))
        
        #we project car object position orthogonally on the spline
        carobj_position_orth = tools3d.projectOrth(bgeCar.getPosition(),
                                                   self.getCoord(idx_inf),
                                                   self.getCoord(idx_sup))
        
##        self.logger.info(fun + 'distance to orth pos: ' + str((bgeCar.getPosition()-carobj_position_orth).length))

        #then we project forward on the spline
        final_position = self.projectPointToDistance(carobj_position_orth,idx_sup,dist)
        
##        self.logger.info(fun + 'actual distance: ' + str((bgeCar.getPosition()-final_position).length))
##        self.logger.info(fun + 'difference: ' + str((bgeCar.getPosition()-final_position).length-dist))
        
        return final_position
コード例 #2
0
 def getOrthPosition(self):
     return tools3d.projectOrth(self.getPosition(),
                                self.racingLine.getCoord(self.racingLinePointInf),
                                self.racingLine.getCoord(self.racingLinePointSup))