-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplayer.ads
89 lines (63 loc) · 2.7 KB
/
player.ads
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
-- Root package for the binding to the C library libplayerc.
-- As a general rule, names of entities/functions are keep as closer as the
-- C ones to keep consistency, even if that means they're not totally Adaish.
-- All functions returning an error code are replaced by procedures which may
-- raise Player_Error.
-- Where possible, creation and destruction of C structs has been replace by
-- Controlled types. There seems to be some problem with creating the same
-- object multiple times, so in general avoid it.
with Interfaces.C;
package Player is
pragma Pure;
package I renames Interfaces;
-- The linking of playerc is in player-interfaces.ads
-- This allows "with" this root file without causing the linking.
-- Some definitions of general use
type C_Float is new Interfaces.C.C_Float;
subtype Player_Float is C_Float;
type Double is new Interfaces.C.double;
type Double_Array is array (Positive range <>) of Double;
type Double_Matrix is array (Positive range <>, Positive range <>) of Double;
type Point_2d is record
X, Y : aliased Double;
end record;
type Pose_3d is record
-- X,Y,Z [m]
px, py, pz : aliased Double;
-- roll, pitch, yaw [rad]
proll, ppitch, pyaw : aliased Double;
end record;
subtype Pose is Double_Array (1 .. 3);
subtype Velo is Double_Array (1 .. 3);
subtype Covariance is Double_Matrix (1 .. 3, 1 .. 3);
type Pose_Array is array (Positive range <>) of Pose;
subtype HPose is Double_Array (1 .. 4);
-- Homogeneous representation, (x, y, a, 1)
subtype Transformation is Double_Matrix (1 .. 4, 1 .. 4);
-- Extended to include the pose in the transformation.
-- Some record structures depend on the fact that Double is C.double,
-- because doubles are used all over the place in Player.
-- Device access modes:
type Access_Modes is new Integer;
function Open_Mode return Access_Modes;
function Close_Mode return Access_Modes;
function Error_Mode return Access_Modes;
function "-" (D : in Double_Array) return Double_Array;
-- Unary negation
-- Message types
Msgtype_Data : constant := 1;
Msgtype_Cmd : constant := 2;
Msgtype_Req : constant := 3;
Msgtype_Resp_Ack : constant := 4;
Msgtype_Synch : constant := 5;
Msgtype_Resp_Nack : constant := 6;
private
pragma Convention (C, Point_2d);
pragma Convention (C, Double_Array);
pragma Convention (C, Double_Matrix);
pragma Convention (C, Pose_Array);
pragma Import (C, Open_Mode, "playerc_open_mode");
pragma Import (C, Close_Mode, "playerc_close_mode");
pragma Import (C, Error_Mode, "playerc_error_mode");
pragma Convention (C, Access_Modes);
end Player;