Initial commit
This commit is contained in:
95
srcs/RobotNet10/Shared/RobotNet10.Shared/Sensor/Joy.cs
Normal file
95
srcs/RobotNet10/Shared/RobotNet10.Shared/Sensor/Joy.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
namespace RobotNet10.Shared.Sensor;
|
||||
|
||||
/// <summary>
|
||||
/// Joy message (sensor_msgs/Joy)
|
||||
/// Reports the state of a joystick's axes and buttons
|
||||
/// </summary>
|
||||
public struct Joy
|
||||
{
|
||||
/// <summary>
|
||||
/// Header with timestamp and frame ID
|
||||
/// </summary>
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The axes measurements from a joystick
|
||||
/// </summary>
|
||||
public double[] Axes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The buttons measurements from a joystick
|
||||
/// </summary>
|
||||
public int[] Buttons { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public Joy()
|
||||
{
|
||||
Header = new Header();
|
||||
Axes = [];
|
||||
Buttons = [];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JoyFeedback message (sensor_msgs/JoyFeedback)
|
||||
/// Reports the state of a joystick's axes and buttons
|
||||
/// </summary>
|
||||
public struct JoyFeedback
|
||||
{
|
||||
/// <summary>
|
||||
/// Type constants
|
||||
/// </summary>
|
||||
public const byte TypeLed = 0;
|
||||
public const byte TypeRumble = 1;
|
||||
public const byte TypeBuzzer = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Type of feedback (Type constants)
|
||||
/// </summary>
|
||||
public byte Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This will hold an id number for each type of each feedback.
|
||||
/// Example, the first led would be id=0, the second would be id=1
|
||||
/// </summary>
|
||||
public byte Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Intensity of the feedback, from 0.0 to 1.0, inclusive. If device is
|
||||
/// actually binary, driver should treat 0<=x<0.5 as off, 0.5<=x<=1.0 as on.
|
||||
/// </summary>
|
||||
public double Intensity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public JoyFeedback()
|
||||
{
|
||||
Type = TypeLed;
|
||||
Id = 0;
|
||||
Intensity = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JoyFeedbackArray message (sensor_msgs/JoyFeedbackArray)
|
||||
/// Array of JoyFeedback
|
||||
/// </summary>
|
||||
public struct JoyFeedbackArray
|
||||
{
|
||||
/// <summary>
|
||||
/// Array of feedback
|
||||
/// </summary>
|
||||
public JoyFeedback[] Array { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public JoyFeedbackArray()
|
||||
{
|
||||
Array = System.Array.Empty<JoyFeedback>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user