Initial commit
This commit is contained in:
39
srcs/RobotNet10/Shared/RobotNet10.Shared/Geometry/Accel.cs
Normal file
39
srcs/RobotNet10/Shared/RobotNet10.Shared/Geometry/Accel.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using RobotNet10.Shared.Numbers;
|
||||
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// Accel message (geometry_msgs/Accel)
|
||||
/// Expresses acceleration in free space broken into its linear and angular parts
|
||||
/// </summary>
|
||||
public struct Accel
|
||||
{
|
||||
/// <summary>
|
||||
/// Linear acceleration (Vector3)
|
||||
/// </summary>
|
||||
public Vector3 Linear { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Angular acceleration (Vector3)
|
||||
/// </summary>
|
||||
public Vector3 Angular { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public Accel()
|
||||
{
|
||||
Linear = new Vector3();
|
||||
Angular = new Vector3();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public Accel(Vector3 linear, Vector3 angular)
|
||||
{
|
||||
Linear = linear;
|
||||
Angular = angular;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// AccelStamped message (geometry_msgs/AccelStamped)
|
||||
/// An Accel with reference coordinate frame and timestamp
|
||||
/// </summary>
|
||||
public struct AccelStamped
|
||||
{
|
||||
/// <summary>
|
||||
/// Header with timestamp and frame ID
|
||||
/// </summary>
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Acceleration
|
||||
/// </summary>
|
||||
public Accel Accel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public AccelStamped()
|
||||
{
|
||||
Header = new Header();
|
||||
Accel = new Accel();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public AccelStamped(Header header, Accel accel)
|
||||
{
|
||||
Header = header;
|
||||
Accel = accel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// AccelWithCovariance message (geometry_msgs/AccelWithCovariance)
|
||||
/// An Accel with associated covariance matrix
|
||||
/// </summary>
|
||||
public struct AccelWithCovariance
|
||||
{
|
||||
/// <summary>
|
||||
/// Acceleration
|
||||
/// </summary>
|
||||
public Accel Accel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Covariance matrix (row-major order)
|
||||
/// The orientation parameters use a fixed-axis representation.
|
||||
/// In order, the parameters are:
|
||||
/// (ax, ay, az, wx, wy, wz)
|
||||
/// </summary>
|
||||
public double[] Covariance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Size of covariance matrix (6x6 = 36 elements)
|
||||
/// </summary>
|
||||
public const int CovarianceSize = 36;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public AccelWithCovariance()
|
||||
{
|
||||
Accel = new Accel();
|
||||
Covariance = new double[CovarianceSize];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public AccelWithCovariance(Accel accel, double[] covariance)
|
||||
{
|
||||
Accel = accel;
|
||||
if (covariance == null || covariance.Length != CovarianceSize)
|
||||
{
|
||||
throw new ArgumentException($"Covariance array must have {CovarianceSize} elements", nameof(covariance));
|
||||
}
|
||||
Covariance = covariance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// AccelWithCovarianceStamped message (geometry_msgs/AccelWithCovarianceStamped)
|
||||
/// An AccelWithCovariance with reference coordinate frame and timestamp
|
||||
/// </summary>
|
||||
public struct AccelWithCovarianceStamped
|
||||
{
|
||||
/// <summary>
|
||||
/// Header with timestamp and frame ID
|
||||
/// </summary>
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Acceleration with covariance
|
||||
/// </summary>
|
||||
public AccelWithCovariance Accel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public AccelWithCovarianceStamped()
|
||||
{
|
||||
Header = new Header();
|
||||
Accel = new AccelWithCovariance();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public AccelWithCovarianceStamped(Header header, AccelWithCovariance accel)
|
||||
{
|
||||
Header = header;
|
||||
Accel = accel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using RobotNet10.Shared.Numbers;
|
||||
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
public static class GeometryExtensions
|
||||
{
|
||||
extension(Quaternion q)
|
||||
{
|
||||
public double ToYawRadian()
|
||||
{
|
||||
var sinYaw = 2.0 * (q.W * q.Z + q.X * q.Y);
|
||||
var cosYaw = 1.0 - 2.0 * (q.Y * q.Y + q.Z * q.Z);
|
||||
return Math.Atan2(sinYaw, cosYaw);
|
||||
}
|
||||
|
||||
public double ToYawDegrees() => q.ToYawRadian() * 180 / Math.PI;
|
||||
}
|
||||
}
|
||||
44
srcs/RobotNet10/Shared/RobotNet10.Shared/Geometry/Point.cs
Normal file
44
srcs/RobotNet10/Shared/RobotNet10.Shared/Geometry/Point.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// Point message (geometry_msgs/Point)
|
||||
/// Represents a point in free space with x, y, z coordinates
|
||||
/// </summary>
|
||||
public struct Point
|
||||
{
|
||||
/// <summary>
|
||||
/// X coordinate
|
||||
/// </summary>
|
||||
public double X { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Y coordinate
|
||||
/// </summary>
|
||||
public double Y { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Z coordinate
|
||||
/// </summary>
|
||||
public double Z { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public Point()
|
||||
{
|
||||
X = 0.0;
|
||||
Y = 0.0;
|
||||
Z = 0.0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public Point(double x, double y, double z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using RobotNet10.Shared.Numbers;
|
||||
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// PointStamped message (geometry_msgs/PointStamped)
|
||||
/// A Point with reference coordinate frame and timestamp
|
||||
/// </summary>
|
||||
public struct PointStamped
|
||||
{
|
||||
/// <summary>
|
||||
/// Header with timestamp and frame ID
|
||||
/// </summary>
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Point
|
||||
/// </summary>
|
||||
public Vector3 Point { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public PointStamped()
|
||||
{
|
||||
Header = new Header();
|
||||
Point = new Vector3();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public PointStamped(Header header, Vector3 point)
|
||||
{
|
||||
Header = header;
|
||||
Point = point;
|
||||
}
|
||||
}
|
||||
|
||||
32
srcs/RobotNet10/Shared/RobotNet10.Shared/Geometry/Polygon.cs
Normal file
32
srcs/RobotNet10/Shared/RobotNet10.Shared/Geometry/Polygon.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using RobotNet10.Shared.Numbers;
|
||||
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// Polygon message (geometry_msgs/Polygon)
|
||||
/// A specification of a polygon where the first and last points are assumed to be connected
|
||||
/// </summary>
|
||||
public struct Polygon
|
||||
{
|
||||
/// <summary>
|
||||
/// Array of points defining the polygon
|
||||
/// </summary>
|
||||
public Vector3[] Points { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public Polygon()
|
||||
{
|
||||
Points = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public Polygon(Vector3[] points)
|
||||
{
|
||||
Points = points;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// PolygonStamped message (geometry_msgs/PolygonStamped)
|
||||
/// A Polygon with reference coordinate frame and timestamp
|
||||
/// </summary>
|
||||
public struct PolygonStamped
|
||||
{
|
||||
/// <summary>
|
||||
/// Header with timestamp and frame ID
|
||||
/// </summary>
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Polygon
|
||||
/// </summary>
|
||||
public Polygon Polygon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public PolygonStamped()
|
||||
{
|
||||
Header = new Header();
|
||||
Polygon = new Polygon();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public PolygonStamped(Header header, Polygon polygon)
|
||||
{
|
||||
Header = header;
|
||||
Polygon = polygon;
|
||||
}
|
||||
}
|
||||
|
||||
37
srcs/RobotNet10/Shared/RobotNet10.Shared/Geometry/Pose.cs
Normal file
37
srcs/RobotNet10/Shared/RobotNet10.Shared/Geometry/Pose.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// Pose message (geometry_msgs/Pose)
|
||||
/// Represents a pose in free space, composed of position and orientation
|
||||
/// </summary>
|
||||
public struct Pose
|
||||
{
|
||||
/// <summary>
|
||||
/// Position (Point)
|
||||
/// </summary>
|
||||
public Point Position { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Orientation (Quaternion)
|
||||
/// </summary>
|
||||
public Quaternion Orientation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public Pose()
|
||||
{
|
||||
Position = new Point();
|
||||
Orientation = new Quaternion();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public Pose(Point position, Quaternion orientation)
|
||||
{
|
||||
Position = position;
|
||||
Orientation = orientation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// PoseStamped message (geometry_msgs/PoseStamped)
|
||||
/// A Pose with reference coordinate frame and timestamp
|
||||
/// </summary>
|
||||
public struct PoseStamped
|
||||
{
|
||||
/// <summary>
|
||||
/// Header with timestamp and frame ID
|
||||
/// </summary>
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Pose
|
||||
/// </summary>
|
||||
public Pose Pose { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public PoseStamped()
|
||||
{
|
||||
Header = new Header();
|
||||
Pose = new Pose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public PoseStamped(Header header, Pose pose)
|
||||
{
|
||||
Header = header;
|
||||
Pose = pose;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// PoseWithCovariance message (geometry_msgs/PoseWithCovariance)
|
||||
/// A Pose with associated covariance matrix
|
||||
/// </summary>
|
||||
public struct PoseWithCovariance
|
||||
{
|
||||
/// <summary>
|
||||
/// Pose
|
||||
/// </summary>
|
||||
public Pose Pose { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Covariance matrix (row-major order)
|
||||
/// The orientation parameters use a fixed-axis representation.
|
||||
/// In order, the parameters are:
|
||||
/// (x, y, z, rotation about X axis, rotation about Y axis, rotation about Z axis)
|
||||
/// </summary>
|
||||
public double[] Covariance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Size of covariance matrix (6x6 = 36 elements)
|
||||
/// </summary>
|
||||
public const int CovarianceSize = 36;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public PoseWithCovariance()
|
||||
{
|
||||
Pose = new Pose();
|
||||
Covariance = new double[CovarianceSize];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public PoseWithCovariance(Pose pose, double[] covariance)
|
||||
{
|
||||
Pose = pose;
|
||||
if (covariance == null || covariance.Length != CovarianceSize)
|
||||
{
|
||||
throw new ArgumentException($"Covariance array must have {CovarianceSize} elements", nameof(covariance));
|
||||
}
|
||||
Covariance = covariance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// PoseWithCovarianceStamped message (geometry_msgs/PoseWithCovarianceStamped)
|
||||
/// A PoseWithCovariance with reference coordinate frame and timestamp
|
||||
/// </summary>
|
||||
public struct PoseWithCovarianceStamped
|
||||
{
|
||||
/// <summary>
|
||||
/// Header with timestamp and frame ID
|
||||
/// </summary>
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Pose with covariance
|
||||
/// </summary>
|
||||
public PoseWithCovariance Pose { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public PoseWithCovarianceStamped()
|
||||
{
|
||||
Header = new Header();
|
||||
Pose = new PoseWithCovariance();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public PoseWithCovarianceStamped(Header header, PoseWithCovariance pose)
|
||||
{
|
||||
Header = header;
|
||||
Pose = pose;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// Quaternion message (geometry_msgs/Quaternion)
|
||||
/// Represents a rotation in free space in quaternion form
|
||||
/// </summary>
|
||||
public struct Quaternion
|
||||
{
|
||||
/// <summary>
|
||||
/// X component
|
||||
/// </summary>
|
||||
public double X { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Y component
|
||||
/// </summary>
|
||||
public double Y { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Z component
|
||||
/// </summary>
|
||||
public double Z { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// W component (scalar part)
|
||||
/// </summary>
|
||||
public double W { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public Quaternion()
|
||||
{
|
||||
X = 0.0;
|
||||
Y = 0.0;
|
||||
Z = 0.0;
|
||||
W = 1.0; // Identity quaternion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public Quaternion(double x, double y, double z, double w)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
W = w;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using RobotNet10.Shared.Numbers;
|
||||
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// QuaternionStamped message (geometry_msgs/QuaternionStamped)
|
||||
/// A Quaternion with reference coordinate frame and timestamp
|
||||
/// </summary>
|
||||
public struct QuaternionStamped
|
||||
{
|
||||
/// <summary>
|
||||
/// Header with timestamp and frame ID
|
||||
/// </summary>
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Quaternion
|
||||
/// </summary>
|
||||
public Quaternion Quaternion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public QuaternionStamped()
|
||||
{
|
||||
Header = new Header();
|
||||
Quaternion = new Quaternion();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public QuaternionStamped(Header header, Quaternion quaternion)
|
||||
{
|
||||
Header = header;
|
||||
Quaternion = quaternion;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using RobotNet10.Shared.Numbers;
|
||||
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// Transform message (geometry_msgs/Transform)
|
||||
/// Represents a transform between two coordinate frames in free space
|
||||
/// </summary>
|
||||
public struct Transform
|
||||
{
|
||||
/// <summary>
|
||||
/// Translation (Vector3)
|
||||
/// </summary>
|
||||
public Vector3 Translation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Rotation (Quaternion)
|
||||
/// </summary>
|
||||
public Quaternion Rotation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public Transform()
|
||||
{
|
||||
Translation = new Vector3();
|
||||
Rotation = new Quaternion();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public Transform(Vector3 translation, Quaternion rotation)
|
||||
{
|
||||
Translation = translation;
|
||||
Rotation = rotation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// TransformStamped message (geometry_msgs/TransformStamped)
|
||||
/// A Transform with reference coordinate frame and timestamp
|
||||
/// </summary>
|
||||
public struct TransformStamped
|
||||
{
|
||||
/// <summary>
|
||||
/// Header with timestamp and frame ID (child_frame_id is stored in frame_id)
|
||||
/// </summary>
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Child frame ID (the frame being transformed to)
|
||||
/// </summary>
|
||||
public string ChildFrameId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Transform
|
||||
/// </summary>
|
||||
public Transform Transform { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public TransformStamped()
|
||||
{
|
||||
Header = new Header();
|
||||
ChildFrameId = string.Empty;
|
||||
Transform = new Transform();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public TransformStamped(Header header, string childFrameId, Transform transform)
|
||||
{
|
||||
Header = header;
|
||||
ChildFrameId = childFrameId;
|
||||
Transform = transform;
|
||||
}
|
||||
}
|
||||
|
||||
39
srcs/RobotNet10/Shared/RobotNet10.Shared/Geometry/Twist.cs
Normal file
39
srcs/RobotNet10/Shared/RobotNet10.Shared/Geometry/Twist.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using RobotNet10.Shared.Numbers;
|
||||
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// Twist message (geometry_msgs/Twist)
|
||||
/// Expresses velocity in free space broken into its linear and angular parts
|
||||
/// </summary>
|
||||
public struct Twist
|
||||
{
|
||||
/// <summary>
|
||||
/// Linear velocity (Vector3)
|
||||
/// </summary>
|
||||
public Vector3 Linear { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Angular velocity (Vector3)
|
||||
/// </summary>
|
||||
public Vector3 Angular { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public Twist()
|
||||
{
|
||||
Linear = new Vector3();
|
||||
Angular = new Vector3();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public Twist(Vector3 linear, Vector3 angular)
|
||||
{
|
||||
Linear = linear;
|
||||
Angular = angular;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// TwistStamped message (geometry_msgs/TwistStamped)
|
||||
/// A Twist with reference coordinate frame and timestamp
|
||||
/// </summary>
|
||||
public struct TwistStamped
|
||||
{
|
||||
/// <summary>
|
||||
/// Header with timestamp and frame ID
|
||||
/// </summary>
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Twist
|
||||
/// </summary>
|
||||
public Twist Twist { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public TwistStamped()
|
||||
{
|
||||
Header = new Header();
|
||||
Twist = new Twist();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public TwistStamped(Header header, Twist twist)
|
||||
{
|
||||
Header = header;
|
||||
Twist = twist;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// TwistWithCovariance message (geometry_msgs/TwistWithCovariance)
|
||||
/// A Twist with associated covariance matrix
|
||||
/// </summary>
|
||||
public struct TwistWithCovariance
|
||||
{
|
||||
/// <summary>
|
||||
/// Twist
|
||||
/// </summary>
|
||||
public Twist Twist { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Covariance matrix (row-major order)
|
||||
/// The orientation parameters use a fixed-axis representation.
|
||||
/// In order, the parameters are:
|
||||
/// (vx, vy, vz, wx, wy, wz)
|
||||
/// </summary>
|
||||
public double[] Covariance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Size of covariance matrix (6x6 = 36 elements)
|
||||
/// </summary>
|
||||
public const int CovarianceSize = 36;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public TwistWithCovariance()
|
||||
{
|
||||
Twist = new Twist();
|
||||
Covariance = new double[CovarianceSize];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public TwistWithCovariance(Twist twist, double[] covariance)
|
||||
{
|
||||
Twist = twist;
|
||||
if (covariance == null || covariance.Length != CovarianceSize)
|
||||
{
|
||||
throw new ArgumentException($"Covariance array must have {CovarianceSize} elements", nameof(covariance));
|
||||
}
|
||||
Covariance = covariance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// TwistWithCovarianceStamped message (geometry_msgs/TwistWithCovarianceStamped)
|
||||
/// A TwistWithCovariance with reference coordinate frame and timestamp
|
||||
/// </summary>
|
||||
public struct TwistWithCovarianceStamped
|
||||
{
|
||||
/// <summary>
|
||||
/// Header with timestamp and frame ID
|
||||
/// </summary>
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Twist with covariance
|
||||
/// </summary>
|
||||
public TwistWithCovariance Twist { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public TwistWithCovarianceStamped()
|
||||
{
|
||||
Header = new Header();
|
||||
Twist = new TwistWithCovariance();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public TwistWithCovarianceStamped(Header header, TwistWithCovariance twist)
|
||||
{
|
||||
Header = header;
|
||||
Twist = twist;
|
||||
}
|
||||
}
|
||||
|
||||
44
srcs/RobotNet10/Shared/RobotNet10.Shared/Geometry/Vector3.cs
Normal file
44
srcs/RobotNet10/Shared/RobotNet10.Shared/Geometry/Vector3.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// Vector3 message (geometry_msgs/Vector3)
|
||||
/// Represents a vector in free space
|
||||
/// </summary>
|
||||
public struct Vector3
|
||||
{
|
||||
/// <summary>
|
||||
/// X component
|
||||
/// </summary>
|
||||
public double X { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Y component
|
||||
/// </summary>
|
||||
public double Y { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Z component
|
||||
/// </summary>
|
||||
public double Z { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public Vector3()
|
||||
{
|
||||
X = 0.0;
|
||||
Y = 0.0;
|
||||
Z = 0.0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public Vector3(double x, double y, double z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using RobotNet10.Shared.Numbers;
|
||||
|
||||
namespace RobotNet10.Shared.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// Vector3Stamped message (geometry_msgs/Vector3Stamped)
|
||||
/// A Vector3 with reference coordinate frame and timestamp
|
||||
/// </summary>
|
||||
public struct Vector3Stamped
|
||||
{
|
||||
/// <summary>
|
||||
/// Header with timestamp and frame ID
|
||||
/// </summary>
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Vector3
|
||||
/// </summary>
|
||||
public Vector3 Vector { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public Vector3Stamped()
|
||||
{
|
||||
Header = new Header();
|
||||
Vector = new Vector3();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with parameters
|
||||
/// </summary>
|
||||
public Vector3Stamped(Header header, Vector3 vector)
|
||||
{
|
||||
Header = header;
|
||||
Vector = vector;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user