-
Notifications
You must be signed in to change notification settings - Fork 1
/
player-sonar.adb
126 lines (105 loc) · 3.59 KB
/
player-sonar.adb
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
with player.Aux;
with Interfaces; use Interfaces;
package body Player.Sonar is
------------
-- Create --
------------
procedure Create
(This : in out Object;
Conn : in Client.Connection_Type;
Index : in Natural := 0)
is
function C_Create (Conn : in Types.Handle; Index : in C.int)
return Types.Handle;
pragma Import (C, C_Create, "playerc_sonar_create");
begin
Interfaces.Create (Interfaces.Object (This), Conn, Index);
Set_Handle (This, C_Create (Client.Get_Handle (Conn), C.int (Index)));
end Create;
---------------
-- Subscribe --
---------------
procedure Subscribe (This : in out Object; Mode : in Access_Modes) is
function C_Subscribe (This : in Types.Handle; Mode : in Access_Modes)
return C.int;
pragma Import (C, C_Subscribe, "playerc_sonar_subscribe");
begin
Aux.Check (C_Subscribe (-This, Mode));
Interfaces.Subscribe (Interfaces.Object (This), Mode);
end Subscribe;
-----------------
-- Unsubscribe --
-----------------
procedure Unsubscribe (This : in out Object) is
function C_Unsubscribe (This : in Types.Handle) return C.Int;
pragma Import (C, C_Unsubscribe, "playerc_sonar_unsubscribe");
begin
Aux.Check (C_Unsubscribe (-This));
Interfaces.Unsubscribe (Interfaces.Object (This));
end Unsubscribe;
-----------------
-- Update_Geom --
-----------------
procedure Update_Geom (This : in out Object) is
function Internal (This : Types.Handle) return C.Int;
pragma Import (C, Internal, "playerc_sonar_get_geom");
begin
Aux.Check (Internal (-This));
end Update_Geom;
--------------------
-- Get_Pose_Count --
--------------------
function Get_Pose_Count (This : in Object) return Natural is
function Internal (This : Types.Handle) return C.Int;
pragma Import (C, Internal, "player_ada_sonar_get_pose_count");
begin
return Natural( Internal (-This));
end Get_Pose_Count;
--------------
-- Get_Pose --
--------------
function Get_Pose (This : in Object; Idx : in Positive) return Pose_3d is
procedure Internal (This : Types.Handle;
Index : in C.Int;
X, Y, Z, Roll, Pitch, Yaw : out C.Double);
pragma Import (C, Internal, "player_ada_sonar_get_pose");
P : Pose_3d;
begin
Internal (-This,
C.Int (Idx - 1),
C.Double (P.px),
C.Double (P.py),
C.Double (P.pz),
C.Double (P.proll),
C.Double (P.ppitch),
C.Double (P.pyaw));
return P;
end Get_Pose;
--------------------
-- Get_Scan_Count --
--------------------
function Get_Scan_Count (This : in Object) return Natural is
function Internal (This : Types.Handle) return C.Int;
pragma Import (C, Internal, "player_ada_sonar_get_scan_count");
begin
return Natural (Internal (-This));
end Get_Scan_Count;
--------------
-- Get_Scan --
--------------
function Get_Scan (This : in Object; Idx : in Positive) return Double is
function Internal (This : Types.Handle;
Index : C.Int) return C.Double;
pragma Import (C, Internal, "player_ada_sonar_get_scan");
begin
return Double (Internal (-This, C.Int(Idx - 1)));
end Get_Scan;
-------------
-- Destroy --
-------------
procedure Destroy (This : in out Object) is
begin
Destroy_Handle (-This);
Clear_Handle (This);
end Destroy;
end Player.Sonar;