6.2.3. 在 DrRobotIMUGPSDCM.dll 內的 DCM 功能
DrRobotIMUGPSDCM.cs 檔案中描述了 DrRobotIMUGPSDCM.dll 中提供的所有函數。請注意,我們現在是使用機載控制器來做機器人方位估算。你可以用自己的演算法,依據 IMU 原始數據和 GPS 感測器數據來做方位的估算。以下是清單:
/// </summary>
/// <param name="dir">left motor direction, if left motor go forward, encoder value is increasing, dir = 1, otherwise, dir = ‐1</param>
/// <param name="wheelCnt">wheel spin one circle, encoder count number</param>
/// <param name="wheelR">wheel Radius</param>
/// <param name="wheelDis"> distance between left/right wheel</param>
/// <returns></returns>
[DllImport("DrRobotIMUGPSDCM.dll", SetLastError = true)]
static extern int SetEncoderParameter(int dir, int wheelCnt, double wheelR, double wheelDis);/// <summary>
/// this function is for GPS sensor data update
/// </summary>
/// <param name="cog">cog ‐‐ course over ground, radian, ‐pI ~ PI</param>
/// <param name="vog">vog ‐‐ velocity over ground, unit: m/s</param>
[DllImport("DrRobotIMUGPSDCM.dll", SetLastError = true)]
static extern void UpdateGPS(double cog, double vog);/// <summary>
/// this function will estimate position based on latest encoder information
/// </summary>
/// <param name="leftEncoder">current left encoder reading</param>
/// <param name="rightEncoder">current right encoder reading</param>
/// <param name="estPos">pointer to current position estimation, estPos[0] ‐‐ E, estPos[1] ‐‐ N, estPos[2] ‐‐ Orientation(Yaw)</param>
/// <returns></returns>
[DllImport("DrRobotIMUGPSDCM.dll", SetLastError = true)]
static unsafe extern int EncoderEstimate(int leftEncoder, int rightEncoder, double* estPos);Last updated
Was this helpful?