tip_tilt_2_axes.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:pi_gcs 作者: lbusoni 项目源码 文件源码
def startModulation(self,
                        radiusInMilliRad,
                        frequencyInHz,
                        centerInMilliRad):
        self._origTargetPosition= centerInMilliRad
        self.stopModulation()

        periodInSec= 1./ frequencyInHz
        assert np.ptp(self._ctrl.getWaveGeneratorTableRate()) == 0, \
            "wave generator table rate must be the same for every table"
        wgtr= self._ctrl.getWaveGeneratorTableRate()[0]
        timestep= self._ctrl.getServoUpdateTimeInSeconds() * wgtr

        lengthInPoints= periodInSec/ timestep
        peakOfTheSineCurve= self._milliRadToGcsUnits(
            self.getTargetPosition() + radiusInMilliRad)
        offsetOfTheSineCurve= self._milliRadToGcsUnits(
            self.getTargetPosition() - radiusInMilliRad)
        amplitudeOfTheSineCurve= peakOfTheSineCurve - offsetOfTheSineCurve
        wavelengthOfTheSineCurveInPoints= periodInSec/ timestep
        startPoint= np.array([0, 0.25])* wavelengthOfTheSineCurveInPoints
        curveCenterPoint= 0.5* wavelengthOfTheSineCurveInPoints

        self._ctrl.clearWaveTableData([1, 2, 3])
        self._ctrl.setSinusoidalWaveform(
            1, WaveformGenerator.CLEAR, lengthInPoints,
            amplitudeOfTheSineCurve[0], offsetOfTheSineCurve[0],
            wavelengthOfTheSineCurveInPoints, startPoint[0], curveCenterPoint)
        self._ctrl.setSinusoidalWaveform(
            2, WaveformGenerator.CLEAR, lengthInPoints,
            amplitudeOfTheSineCurve[1], offsetOfTheSineCurve[1],
            wavelengthOfTheSineCurveInPoints, startPoint[1], curveCenterPoint)
        self._ctrl.setConnectionOfWaveTableToWaveGenerator([1, 2], [1, 2])
        self._ctrl.setWaveGeneratorStartStopMode([1, 1, 0])
        self._modulationEnabled= True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号