| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# Rinchi Common Image Generator Interface for Perl |
|
3
|
|
|
|
|
|
|
# Class Identifier: f78ac504-200e-11de-bda7-001c25551abc |
|
4
|
|
|
|
|
|
|
# Author: Brian M. Ames |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Rinchi::CIGIPP::ShortArticulatedPartControl; |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
29
|
use 5.006; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
62
|
|
|
10
|
1
|
|
|
1
|
|
8
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
255
|
|
|
11
|
1
|
|
|
1
|
|
9
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
521
|
|
|
12
|
1
|
|
|
1
|
|
7
|
use Carp; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
4335
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
require Exporter; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
|
19
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
|
20
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# This allows declaration use Rinchi::CIGI::AtmosphereControl ':all'; |
|
23
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
|
24
|
|
|
|
|
|
|
# will save memory. |
|
25
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
) ] ); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our @EXPORT = qw( |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Preloaded methods go here. |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Rinchi::CIGIPP::ShortArticulatedPartControl - Perl extension for the Common |
|
42
|
|
|
|
|
|
|
Image Generator Interface - Short Articulated Part Control data packet. |
|
43
|
|
|
|
|
|
|
data packet. |
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use Rinchi::CIGIPP::ShortArticulatedPartControl; |
|
47
|
|
|
|
|
|
|
my $sap_ctl = Rinchi::CIGIPP::ShortArticulatedPartControl->new(); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$packet_type = $sap_ctl->packet_type(); |
|
50
|
|
|
|
|
|
|
$packet_size = $sap_ctl->packet_size(); |
|
51
|
|
|
|
|
|
|
$entity_ident = $sap_ctl->entity_ident(15419); |
|
52
|
|
|
|
|
|
|
$articulated_part_ident1 = $sap_ctl->articulated_part_ident1(124); |
|
53
|
|
|
|
|
|
|
$articulated_part_ident2 = $sap_ctl->articulated_part_ident2(21); |
|
54
|
|
|
|
|
|
|
$articulated_part_enable2 = $sap_ctl->articulated_part_enable2(Rinchi::CIGIPP->Enable); |
|
55
|
|
|
|
|
|
|
$articulated_part_enable1 = $sap_ctl->articulated_part_enable1(Rinchi::CIGIPP->Disable); |
|
56
|
|
|
|
|
|
|
$dof_select2 = $sap_ctl->dof_select2(Rinchi::CIGIPP->NotUsed); |
|
57
|
|
|
|
|
|
|
$dof_select1 = $sap_ctl->dof_select1(Rinchi::CIGIPP->XOffset); |
|
58
|
|
|
|
|
|
|
$degree_of_freedom1 = $sap_ctl->degree_of_freedom1(2.007); |
|
59
|
|
|
|
|
|
|
$degree_of_freedom2 = $sap_ctl->degree_of_freedom2(49.352); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
The Short Articulated Part Control packet is provided as a lower-bandwidth |
|
64
|
|
|
|
|
|
|
alternative to the Articulated Part Control packet. It can be used when |
|
65
|
|
|
|
|
|
|
manipulation of only one or two degrees of freedom of a submodel is necessary. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This packet allows for up to two articulations. The articulations may be |
|
68
|
|
|
|
|
|
|
applied to a single articulated part or two separate ones belonging to the same |
|
69
|
|
|
|
|
|
|
entity. The articulated part or parts are specified by the Articulated Part ID |
|
70
|
|
|
|
|
|
|
1 and Articulated Part ID 2 attributes. Two floating-point degree-of-freedom |
|
71
|
|
|
|
|
|
|
attributes, DOF 1 and DOF 2, specify offsets or angular positions for the |
|
72
|
|
|
|
|
|
|
specified articulated parts. The DOF Select 1 and DOF Select 2 attributes |
|
73
|
|
|
|
|
|
|
specify which degree of freedom each of these floating-point attributes |
|
74
|
|
|
|
|
|
|
represents. |
|
75
|
|
|
|
|
|
|
Note: If DOF Select 1 and DOF Select 2 refer to the same degree of freedom for |
|
76
|
|
|
|
|
|
|
the same articulated part, then DOF 2 (i.e., the "last-in" value) takes |
|
77
|
|
|
|
|
|
|
priority over DOF 1. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 EXPORT |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
None by default. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
#============================================================================== |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item new $sap_ctl = Rinchi::CIGIPP::ShortArticulatedPartControl->new() |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Constructor for Rinchi::ShortArticulatedPartControl. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub new { |
|
92
|
1
|
|
|
1
|
1
|
191
|
my $class = shift; |
|
93
|
1
|
|
33
|
|
|
7
|
$class = ref($class) || $class; |
|
94
|
|
|
|
|
|
|
|
|
95
|
1
|
|
|
|
|
16
|
my $self = { |
|
96
|
|
|
|
|
|
|
'_Buffer' => '', |
|
97
|
|
|
|
|
|
|
'_ClassIdent' => 'f78ac504-200e-11de-bda7-001c25551abc', |
|
98
|
|
|
|
|
|
|
'_Pack' => 'CCSCCCCff', |
|
99
|
|
|
|
|
|
|
'_Swap1' => 'CCvCCCCVV', |
|
100
|
|
|
|
|
|
|
'_Swap2' => 'CCnCCCCNN', |
|
101
|
|
|
|
|
|
|
'packetType' => 7, |
|
102
|
|
|
|
|
|
|
'packetSize' => 16, |
|
103
|
|
|
|
|
|
|
'entityIdent' => 0, |
|
104
|
|
|
|
|
|
|
'articulatedPartIdent1' => 0, |
|
105
|
|
|
|
|
|
|
'articulatedPartIdent2' => 0, |
|
106
|
|
|
|
|
|
|
'_bitfields1' => 0, # Includes bitfields articulatedPartEnable2, articulatedPartEnable1, dofSelect2, and dofSelect1. |
|
107
|
|
|
|
|
|
|
'articulatedPartEnable2' => 0, |
|
108
|
|
|
|
|
|
|
'articulatedPartEnable1' => 0, |
|
109
|
|
|
|
|
|
|
'dofSelect2' => 0, |
|
110
|
|
|
|
|
|
|
'dofSelect1' => 0, |
|
111
|
|
|
|
|
|
|
'_unused9' => 0, |
|
112
|
|
|
|
|
|
|
'degreeOfFreedom1' => 0, |
|
113
|
|
|
|
|
|
|
'degreeOfFreedom2' => 0, |
|
114
|
|
|
|
|
|
|
}; |
|
115
|
|
|
|
|
|
|
|
|
116
|
1
|
50
|
|
|
|
4
|
if (@_) { |
|
117
|
0
|
0
|
|
|
|
0
|
if (ref($_[0]) eq 'ARRAY') { |
|
|
|
0
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
0
|
$self->{'_Buffer'} = $_[0][0]; |
|
119
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
|
120
|
0
|
|
|
|
|
0
|
foreach my $attr (keys %{$_[0]}) { |
|
|
0
|
|
|
|
|
0
|
|
|
121
|
0
|
0
|
|
|
|
0
|
$self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/); |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
1
|
|
|
|
|
3
|
bless($self,$class); |
|
127
|
1
|
|
|
|
|
3
|
return $self; |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
#============================================================================== |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item sub packet_type() |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
$value = $sap_ctl->packet_type(); |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Data Packet Identifier. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This attribute identifies this data packet as the Short Articulated Part |
|
139
|
|
|
|
|
|
|
Control packet. The value of this attribute must be 7. |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub packet_type() { |
|
144
|
1
|
|
|
1
|
1
|
6
|
my ($self) = @_; |
|
145
|
1
|
|
|
|
|
8
|
return $self->{'packetType'}; |
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
#============================================================================== |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item sub packet_size() |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
$value = $sap_ctl->packet_size(); |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Data Packet Size. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
This attribute indicates the number of bytes in this data packet. The value of |
|
157
|
|
|
|
|
|
|
this attribute must be 16. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub packet_size() { |
|
162
|
1
|
|
|
1
|
1
|
5
|
my ($self) = @_; |
|
163
|
1
|
|
|
|
|
4
|
return $self->{'packetSize'}; |
|
164
|
|
|
|
|
|
|
} |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
#============================================================================== |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item sub entity_ident([$newValue]) |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
$value = $sap_ctl->entity_ident($newValue); |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Entity ID. |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
This attribute specifies the entity to which the articulated part(s) belongs. |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=cut |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub entity_ident() { |
|
179
|
1
|
|
|
1
|
1
|
10
|
my ($self,$nv) = @_; |
|
180
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
|
181
|
1
|
|
|
|
|
3
|
$self->{'entityIdent'} = $nv; |
|
182
|
|
|
|
|
|
|
} |
|
183
|
1
|
|
|
|
|
3
|
return $self->{'entityIdent'}; |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
#============================================================================== |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item sub articulated_part_ident1([$newValue]) |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
$value = $sap_ctl->articulated_part_ident1($newValue); |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Articulated Part ID 1. |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
This attribute specifies one of up to two articulated parts to which the data |
|
195
|
|
|
|
|
|
|
in this packet should be applied. When used with the Entity ID attribute, this |
|
196
|
|
|
|
|
|
|
attribute uniquely identifies a particular articulated part within the scene |
|
197
|
|
|
|
|
|
|
graph. |
|
198
|
|
|
|
|
|
|
The value of this attribute may be equal to that of Articulated Part ID 2. |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
sub articulated_part_ident1() { |
|
203
|
1
|
|
|
1
|
1
|
4
|
my ($self,$nv) = @_; |
|
204
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
|
205
|
1
|
|
|
|
|
8
|
$self->{'articulatedPartIdent1'} = $nv; |
|
206
|
|
|
|
|
|
|
} |
|
207
|
1
|
|
|
|
|
3
|
return $self->{'articulatedPartIdent1'}; |
|
208
|
|
|
|
|
|
|
} |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
#============================================================================== |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item sub articulated_part_ident2([$newValue]) |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
$value = $sap_ctl->articulated_part_ident2($newValue); |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
Articulated Part ID 2. |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
This attribute specifies one of up to two articulated parts to which the data |
|
219
|
|
|
|
|
|
|
in this packet should be applied. When used with the Entity ID attribute, this |
|
220
|
|
|
|
|
|
|
attribute uniquely identifies a particular articulated part within the scene |
|
221
|
|
|
|
|
|
|
graph. |
|
222
|
|
|
|
|
|
|
The value of this attribute may be equal to that of Articulated Part ID 1. |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=cut |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub articulated_part_ident2() { |
|
227
|
1
|
|
|
1
|
1
|
4
|
my ($self,$nv) = @_; |
|
228
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
|
229
|
1
|
|
|
|
|
2
|
$self->{'articulatedPartIdent2'} = $nv; |
|
230
|
|
|
|
|
|
|
} |
|
231
|
1
|
|
|
|
|
2
|
return $self->{'articulatedPartIdent2'}; |
|
232
|
|
|
|
|
|
|
} |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
#============================================================================== |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=item sub articulated_part_enable2([$newValue]) |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
$value = $sap_ctl->articulated_part_enable2($newValue); |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
Articulated Part Enable 2. |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
This attribute determines whether the articulated part submodel specified by |
|
243
|
|
|
|
|
|
|
Articulated Part ID 2 should be enabled or disabled within the scene graph. If |
|
244
|
|
|
|
|
|
|
this attribute is set to Disable (0), the part is removed from the scene; if |
|
245
|
|
|
|
|
|
|
the attribute is set to Enable (1), the part is included in the scene. |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
Disable 0 |
|
248
|
|
|
|
|
|
|
Enable 1 |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=cut |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
sub articulated_part_enable2() { |
|
253
|
1
|
|
|
1
|
1
|
2
|
my ($self,$nv) = @_; |
|
254
|
1
|
50
|
|
|
|
10
|
if (defined($nv)) { |
|
255
|
1
|
50
|
33
|
|
|
8
|
if (($nv==0) or ($nv==1)) { |
|
256
|
1
|
|
|
|
|
3
|
$self->{'articulatedPartEnable2'} = $nv; |
|
257
|
1
|
|
|
|
|
3
|
$self->{'_bitfields1'} |= ($nv << 7) &0x80; |
|
258
|
|
|
|
|
|
|
} else { |
|
259
|
0
|
|
|
|
|
0
|
carp "articulated_part_enable2 must be 0 (Disable), or 1 (Enable)."; |
|
260
|
|
|
|
|
|
|
} |
|
261
|
|
|
|
|
|
|
} |
|
262
|
1
|
|
|
|
|
3
|
return (($self->{'_bitfields1'} & 0x80) >> 7); |
|
263
|
|
|
|
|
|
|
} |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
#============================================================================== |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=item sub articulated_part_enable1([$newValue]) |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
$value = $sap_ctl->articulated_part_enable1($newValue); |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
Articulated Part Enable 1. |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
This attribute determines whether the articulated part submodel specified by |
|
274
|
|
|
|
|
|
|
Articulated Part ID 1 should be enabled or disabled within the scene graph. If |
|
275
|
|
|
|
|
|
|
this attribute is set to Disable (0), the part is removed from the scene; if |
|
276
|
|
|
|
|
|
|
the attribute is set to Enable (1), the part is included in the scene. |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
Disable 0 |
|
279
|
|
|
|
|
|
|
Enable 1 |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=cut |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
sub articulated_part_enable1() { |
|
284
|
1
|
|
|
1
|
1
|
2
|
my ($self,$nv) = @_; |
|
285
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
|
286
|
1
|
50
|
33
|
|
|
9
|
if (($nv==0) or ($nv==1)) { |
|
287
|
1
|
|
|
|
|
3
|
$self->{'articulatedPartEnable1'} = $nv; |
|
288
|
1
|
|
|
|
|
2
|
$self->{'_bitfields1'} |= ($nv << 6) &0x40; |
|
289
|
|
|
|
|
|
|
} else { |
|
290
|
0
|
|
|
|
|
0
|
carp "articulated_part_enable1 must be 0 (Disable), or 1 (Enable)."; |
|
291
|
|
|
|
|
|
|
} |
|
292
|
|
|
|
|
|
|
} |
|
293
|
1
|
|
|
|
|
4
|
return (($self->{'_bitfields1'} & 0x40) >> 6); |
|
294
|
|
|
|
|
|
|
} |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
#============================================================================== |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=item sub dof_select2([$newValue]) |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
$value = $sap_ctl->dof_select2($newValue); |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
DOF Select 2. |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
This attribute specifies the degree of freedom to which the value of DOF 2 is |
|
305
|
|
|
|
|
|
|
applied. |
|
306
|
|
|
|
|
|
|
If this attribute is set to Not Used (0), both DOF 2 and Articulated Part |
|
307
|
|
|
|
|
|
|
Enable 2 are ignored. |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
NotUsed 0 |
|
310
|
|
|
|
|
|
|
XOffset 1 |
|
311
|
|
|
|
|
|
|
YOffset 2 |
|
312
|
|
|
|
|
|
|
ZOffset 3 |
|
313
|
|
|
|
|
|
|
Yaw 4 |
|
314
|
|
|
|
|
|
|
Pitch 5 |
|
315
|
|
|
|
|
|
|
Roll 6 |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=cut |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
sub dof_select2() { |
|
320
|
1
|
|
|
1
|
1
|
3
|
my ($self,$nv) = @_; |
|
321
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
|
322
|
1
|
50
|
33
|
|
|
6
|
if (($nv==0) or ($nv==1) or ($nv==2) or ($nv==3) or ($nv==4) or ($nv==5) or ($nv==6)) { |
|
|
|
|
33
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
323
|
1
|
|
|
|
|
3
|
$self->{'dofSelect2'} = $nv; |
|
324
|
1
|
|
|
|
|
2
|
$self->{'_bitfields1'} |= ($nv << 3) &0x38; |
|
325
|
|
|
|
|
|
|
} else { |
|
326
|
0
|
|
|
|
|
0
|
carp "dof_select2 must be 0 (NotUsed), 1 (XOffset), 2 (YOffset), 3 (ZOffset), 4 (Yaw), 5 (Pitch), or 6 (Roll)."; |
|
327
|
|
|
|
|
|
|
} |
|
328
|
|
|
|
|
|
|
} |
|
329
|
1
|
|
|
|
|
3
|
return (($self->{'_bitfields1'} & 0x38) >> 3); |
|
330
|
|
|
|
|
|
|
} |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
#============================================================================== |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=item sub dof_select1([$newValue]) |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
$value = $sap_ctl->dof_select1($newValue); |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
DOF Select 1. |
|
339
|
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
This attribute specifies the degree of freedom to which the value of DOF 1 is |
|
341
|
|
|
|
|
|
|
applied. |
|
342
|
|
|
|
|
|
|
If this attribute is set to Not Used (0), both DOF 1 and Articulated Part |
|
343
|
|
|
|
|
|
|
Enable 1 are ignored. |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
NotUsed 0 |
|
346
|
|
|
|
|
|
|
XOffset 1 |
|
347
|
|
|
|
|
|
|
YOffset 2 |
|
348
|
|
|
|
|
|
|
ZOffset 3 |
|
349
|
|
|
|
|
|
|
Yaw 4 |
|
350
|
|
|
|
|
|
|
Pitch 5 |
|
351
|
|
|
|
|
|
|
Roll 6 |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=cut |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
sub dof_select1() { |
|
356
|
1
|
|
|
1
|
1
|
2
|
my ($self,$nv) = @_; |
|
357
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
|
358
|
1
|
50
|
33
|
|
|
9
|
if (($nv==0) or ($nv==1) or ($nv==2) or ($nv==3) or ($nv==4) or ($nv==5) or ($nv==6)) { |
|
|
|
|
33
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
359
|
1
|
|
|
|
|
3
|
$self->{'dofSelect1'} = $nv; |
|
360
|
1
|
|
|
|
|
1
|
$self->{'_bitfields1'} |= $nv &0x07; |
|
361
|
|
|
|
|
|
|
} else { |
|
362
|
0
|
|
|
|
|
0
|
carp "dof_select1 must be 0 (NotUsed), 1 (XOffset), 2 (YOffset), 3 (ZOffset), 4 (Yaw), 5 (Pitch), or 6 (Roll)."; |
|
363
|
|
|
|
|
|
|
} |
|
364
|
|
|
|
|
|
|
} |
|
365
|
1
|
|
|
|
|
3
|
return ($self->{'_bitfields1'} & 0x07); |
|
366
|
|
|
|
|
|
|
} |
|
367
|
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
#============================================================================== |
|
369
|
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
=item sub degree_of_freedom1([$newValue]) |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
$value = $sap_ctl->degree_of_freedom1($newValue); |
|
373
|
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
DOF 1. |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
This attribute specifies either an offset or an angular position for the part |
|
377
|
|
|
|
|
|
|
identified by Articulated Part ID 1. |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
The application of this value is determined by the DOF Select 1 attribute. If |
|
380
|
|
|
|
|
|
|
the attribute is set to X Offset (1), Y Offset (2), or Z Offset (3), then DOF 1 |
|
381
|
|
|
|
|
|
|
specifies an offset in meters. If DOF Select 1 is set to Yaw (4), Pitch (5), or |
|
382
|
|
|
|
|
|
|
Roll (6), then DOF 1 specifies an angular position in degrees. |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
=cut |
|
385
|
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
sub degree_of_freedom1() { |
|
387
|
1
|
|
|
1
|
1
|
5
|
my ($self,$nv) = @_; |
|
388
|
1
|
50
|
|
|
|
9
|
if (defined($nv)) { |
|
389
|
1
|
|
|
|
|
3
|
$self->{'degreeOfFreedom1'} = $nv; |
|
390
|
|
|
|
|
|
|
} |
|
391
|
1
|
|
|
|
|
3
|
return $self->{'degreeOfFreedom1'}; |
|
392
|
|
|
|
|
|
|
} |
|
393
|
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
#============================================================================== |
|
395
|
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
=item sub degree_of_freedom2([$newValue]) |
|
397
|
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
$value = $sap_ctl->degree_of_freedom2($newValue); |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
DOF 2. |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
This attribute specifies either an offset or an angular position for the part |
|
403
|
|
|
|
|
|
|
identified by Articulated Part ID 2. |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
The application of this value is determined by the DOF Select 2 attribute. If |
|
406
|
|
|
|
|
|
|
the attribute is set to X Offset (1), Y Offset (2), or Z Offset (3), then DOF 2 |
|
407
|
|
|
|
|
|
|
specifies an offset in meters. If DOF Select 2 is set to Yaw (4), Pitch (5), or |
|
408
|
|
|
|
|
|
|
Roll (6), then DOF 2 specifies an angular position in degrees. |
|
409
|
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
=cut |
|
411
|
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
sub degree_of_freedom2() { |
|
413
|
1
|
|
|
1
|
1
|
5
|
my ($self,$nv) = @_; |
|
414
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
|
415
|
1
|
|
|
|
|
2
|
$self->{'degreeOfFreedom2'} = $nv; |
|
416
|
|
|
|
|
|
|
} |
|
417
|
1
|
|
|
|
|
2
|
return $self->{'degreeOfFreedom2'}; |
|
418
|
|
|
|
|
|
|
} |
|
419
|
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
#========================================================================== |
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
=item sub pack() |
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
$value = $sap_ctl->pack(); |
|
425
|
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
Returns the packed data packet. |
|
427
|
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
=cut |
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
sub pack($) { |
|
431
|
1
|
|
|
1
|
1
|
5
|
my $self = shift ; |
|
432
|
|
|
|
|
|
|
|
|
433
|
1
|
|
|
|
|
7
|
$self->{'_Buffer'} = CORE::pack($self->{'_Pack'}, |
|
434
|
|
|
|
|
|
|
$self->{'packetType'}, |
|
435
|
|
|
|
|
|
|
$self->{'packetSize'}, |
|
436
|
|
|
|
|
|
|
$self->{'entityIdent'}, |
|
437
|
|
|
|
|
|
|
$self->{'articulatedPartIdent1'}, |
|
438
|
|
|
|
|
|
|
$self->{'articulatedPartIdent2'}, |
|
439
|
|
|
|
|
|
|
$self->{'_bitfields1'}, # Includes bitfields articulatedPartEnable2, articulatedPartEnable1, dofSelect2, and dofSelect1. |
|
440
|
|
|
|
|
|
|
$self->{'_unused9'}, |
|
441
|
|
|
|
|
|
|
$self->{'degreeOfFreedom1'}, |
|
442
|
|
|
|
|
|
|
$self->{'degreeOfFreedom2'}, |
|
443
|
|
|
|
|
|
|
); |
|
444
|
|
|
|
|
|
|
|
|
445
|
1
|
|
|
|
|
3
|
return $self->{'_Buffer'}; |
|
446
|
|
|
|
|
|
|
} |
|
447
|
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
#========================================================================== |
|
449
|
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
=item sub unpack() |
|
451
|
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
$value = $sap_ctl->unpack(); |
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
Unpacks the packed data packet. |
|
455
|
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
=cut |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
sub unpack($) { |
|
459
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
|
460
|
|
|
|
|
|
|
|
|
461
|
0
|
0
|
|
|
|
|
if (@_) { |
|
462
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
|
463
|
|
|
|
|
|
|
} |
|
464
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f,$g,$h,$i) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'}); |
|
465
|
0
|
|
|
|
|
|
$self->{'packetType'} = $a; |
|
466
|
0
|
|
|
|
|
|
$self->{'packetSize'} = $b; |
|
467
|
0
|
|
|
|
|
|
$self->{'entityIdent'} = $c; |
|
468
|
0
|
|
|
|
|
|
$self->{'articulatedPartIdent1'} = $d; |
|
469
|
0
|
|
|
|
|
|
$self->{'articulatedPartIdent2'} = $e; |
|
470
|
0
|
|
|
|
|
|
$self->{'_bitfields1'} = $f; # Includes bitfields articulatedPartEnable2, articulatedPartEnable1, dofSelect2, and dofSelect1. |
|
471
|
0
|
|
|
|
|
|
$self->{'_unused9'} = $g; |
|
472
|
0
|
|
|
|
|
|
$self->{'degreeOfFreedom1'} = $h; |
|
473
|
0
|
|
|
|
|
|
$self->{'degreeOfFreedom2'} = $i; |
|
474
|
|
|
|
|
|
|
|
|
475
|
0
|
|
|
|
|
|
$self->{'articulatedPartEnable2'} = $self->articulated_part_enable2(); |
|
476
|
0
|
|
|
|
|
|
$self->{'articulatedPartEnable1'} = $self->articulated_part_enable1(); |
|
477
|
0
|
|
|
|
|
|
$self->{'dofSelect2'} = $self->dof_select2(); |
|
478
|
0
|
|
|
|
|
|
$self->{'dofSelect1'} = $self->dof_select1(); |
|
479
|
|
|
|
|
|
|
|
|
480
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
|
481
|
|
|
|
|
|
|
} |
|
482
|
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
#========================================================================== |
|
484
|
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
=item sub byte_swap() |
|
486
|
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
$obj_name->byte_swap(); |
|
488
|
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
Byte swaps the packed data packet. |
|
490
|
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
=cut |
|
492
|
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
sub byte_swap($) { |
|
494
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
|
495
|
|
|
|
|
|
|
|
|
496
|
0
|
0
|
|
|
|
|
if (@_) { |
|
497
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
|
498
|
|
|
|
|
|
|
} else { |
|
499
|
0
|
|
|
|
|
|
$self->pack(); |
|
500
|
|
|
|
|
|
|
} |
|
501
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f,$g,$h,$i) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'}); |
|
502
|
|
|
|
|
|
|
|
|
503
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g,$h,$i); |
|
504
|
0
|
|
|
|
|
|
$self->unpack(); |
|
505
|
|
|
|
|
|
|
|
|
506
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
|
507
|
|
|
|
|
|
|
} |
|
508
|
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
1; |
|
510
|
|
|
|
|
|
|
__END__ |