36 lines
1.2 KiB
Plaintext
36 lines
1.2 KiB
Plaintext
@using Microsoft.AspNetCore.Components
|
|
|
|
<!-- Robot pose visualization component. SVG trong MapLocalization dùng viewBox (met), scaleY(-1); x, y, r đơn vị mét. -->
|
|
<g transform="@Transform">
|
|
<!-- Robot image (width: 1.106m, height: 0.606m) -->
|
|
<image href="images/AS_AGV SLAM V3-CK 02.png"
|
|
width="1.106"
|
|
height="0.606"
|
|
transform="translate(-0.553, -0.303)" />
|
|
</g>
|
|
|
|
@code {
|
|
private double _currentX = -1000;
|
|
private double _currentY = -1000;
|
|
private double _yaw = 0;
|
|
|
|
/// <summary>
|
|
/// Transform string for SVG group element
|
|
/// </summary>
|
|
private string Transform => $"translate({_currentX:F6},{_currentY:F6}) rotate({_yaw * 180.0 / Math.PI:F2})";
|
|
|
|
/// <summary>
|
|
/// Update robot pose với vị trí và góc quay
|
|
/// </summary>
|
|
/// <param name="x">X position trong world coordinates</param>
|
|
/// <param name="y">Y position trong world coordinates</param>
|
|
/// <param name="yaw">Yaw angle trong radians</param>
|
|
public void UpdatePose(double x, double y, double yaw)
|
|
{
|
|
_currentX = x;
|
|
_currentY = y;
|
|
_yaw = yaw;
|
|
StateHasChanged();
|
|
}
|
|
}
|