00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <interfaces/ObjectPositionInterface.h>
00025
00026 #include <core/exceptions/software.h>
00027
00028 #include <cstring>
00029 #include <cstdlib>
00030
00031 namespace fawkes {
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 const unsigned int ObjectPositionInterface::TYPE_OTHER = 0;
00048
00049 const unsigned int ObjectPositionInterface::TYPE_BALL = 1;
00050
00051 const unsigned int ObjectPositionInterface::TYPE_OPPONENT = 2;
00052
00053 const unsigned int ObjectPositionInterface::TYPE_TEAMMEMBER = 3;
00054
00055 const unsigned int ObjectPositionInterface::TYPE_LINE = 4;
00056
00057 const unsigned int ObjectPositionInterface::TYPE_SELF = 5;
00058
00059 const unsigned int ObjectPositionInterface::TYPE_GOAL_BLUE = 6;
00060
00061 const unsigned int ObjectPositionInterface::TYPE_GOAL_YELLOW = 7;
00062
00063 const unsigned int ObjectPositionInterface::FLAG_NONE = 0;
00064
00065 const unsigned int ObjectPositionInterface::FLAG_HAS_WORLD = 1;
00066
00067 const unsigned int ObjectPositionInterface::FLAG_HAS_RELATIVE_CARTESIAN = 2;
00068
00069 const unsigned int ObjectPositionInterface::FLAG_HAS_RELATIVE_POLAR = 4;
00070
00071 const unsigned int ObjectPositionInterface::FLAG_HAS_EULER_ANGLES = 8;
00072
00073 const unsigned int ObjectPositionInterface::FLAG_HAS_EXTENT = 16;
00074
00075 const unsigned int ObjectPositionInterface::FLAG_HAS_VOLUME_EXTENT = 32;
00076
00077 const unsigned int ObjectPositionInterface::FLAG_HAS_CIRCULAR_EXTENT = 64;
00078
00079 const unsigned int ObjectPositionInterface::FLAG_HAS_COVARIANCES = 128;
00080
00081 const unsigned int ObjectPositionInterface::FLAG_HAS_WORLD_VELOCITY = 256;
00082
00083 const unsigned int ObjectPositionInterface::FLAG_HAS_Z_AS_ORI = 512;
00084
00085 const unsigned int ObjectPositionInterface::FLAG_IS_FIXED_OBJECT = 1024;
00086
00087
00088 ObjectPositionInterface::ObjectPositionInterface() : Interface()
00089 {
00090 data_size = sizeof(ObjectPositionInterface_data_t);
00091 data_ptr = malloc(data_size);
00092 data = (ObjectPositionInterface_data_t *)data_ptr;
00093 memset(data_ptr, 0, data_size);
00094 add_fieldinfo(IFT_UINT, "object_type", 1, &data->object_type);
00095 add_fieldinfo(IFT_UINT, "flags", 1, &data->flags);
00096 add_fieldinfo(IFT_BOOL, "visible", 1, &data->visible);
00097 add_fieldinfo(IFT_BOOL, "valid", 1, &data->valid);
00098 add_fieldinfo(IFT_INT, "visibility_history", 1, &data->visibility_history);
00099 add_fieldinfo(IFT_FLOAT, "roll", 1, &data->roll);
00100 add_fieldinfo(IFT_FLOAT, "pitch", 1, &data->pitch);
00101 add_fieldinfo(IFT_FLOAT, "yaw", 1, &data->yaw);
00102 add_fieldinfo(IFT_FLOAT, "distance", 1, &data->distance);
00103 add_fieldinfo(IFT_FLOAT, "bearing", 1, &data->bearing);
00104 add_fieldinfo(IFT_FLOAT, "slope", 1, &data->slope);
00105 add_fieldinfo(IFT_FLOAT, "dbs_covariance", 9, &data->dbs_covariance);
00106 add_fieldinfo(IFT_FLOAT, "world_x", 1, &data->world_x);
00107 add_fieldinfo(IFT_FLOAT, "world_y", 1, &data->world_y);
00108 add_fieldinfo(IFT_FLOAT, "world_z", 1, &data->world_z);
00109 add_fieldinfo(IFT_FLOAT, "world_xyz_covariance", 9, &data->world_xyz_covariance);
00110 add_fieldinfo(IFT_FLOAT, "relative_x", 1, &data->relative_x);
00111 add_fieldinfo(IFT_FLOAT, "relative_y", 1, &data->relative_y);
00112 add_fieldinfo(IFT_FLOAT, "relative_z", 1, &data->relative_z);
00113 add_fieldinfo(IFT_FLOAT, "relative_xyz_covariance", 9, &data->relative_xyz_covariance);
00114 add_fieldinfo(IFT_FLOAT, "extent_x", 1, &data->extent_x);
00115 add_fieldinfo(IFT_FLOAT, "extent_y", 1, &data->extent_y);
00116 add_fieldinfo(IFT_FLOAT, "extent_z", 1, &data->extent_z);
00117 add_fieldinfo(IFT_FLOAT, "world_x_velocity", 1, &data->world_x_velocity);
00118 add_fieldinfo(IFT_FLOAT, "world_y_velocity", 1, &data->world_y_velocity);
00119 add_fieldinfo(IFT_FLOAT, "world_z_velocity", 1, &data->world_z_velocity);
00120 add_fieldinfo(IFT_FLOAT, "world_xyz_velocity_covariance", 9, &data->world_xyz_velocity_covariance);
00121 add_fieldinfo(IFT_FLOAT, "relative_x_velocity", 1, &data->relative_x_velocity);
00122 add_fieldinfo(IFT_FLOAT, "relative_y_velocity", 1, &data->relative_y_velocity);
00123 add_fieldinfo(IFT_FLOAT, "relative_z_velocity", 1, &data->relative_z_velocity);
00124 add_fieldinfo(IFT_FLOAT, "relative_xyz_velocity_covariance", 9, &data->relative_xyz_velocity_covariance);
00125 unsigned char tmp_hash[] = {0xe6, 0x60, 0x23, 0x1b, 0xa4, 0x1a, 0x32, 0xb3, 0xed, 0x8e, 0xf8, 0x7f, 0x13, 0x1c, 0x73, 0x1f};
00126 set_hash(tmp_hash);
00127 }
00128
00129
00130 ObjectPositionInterface::~ObjectPositionInterface()
00131 {
00132 free(data_ptr);
00133 }
00134
00135
00136
00137
00138
00139
00140
00141 unsigned int
00142 ObjectPositionInterface::object_type() const
00143 {
00144 return data->object_type;
00145 }
00146
00147
00148
00149
00150
00151 size_t
00152 ObjectPositionInterface::maxlenof_object_type() const
00153 {
00154 return 1;
00155 }
00156
00157
00158
00159
00160
00161
00162
00163 void
00164 ObjectPositionInterface::set_object_type(const unsigned int new_object_type)
00165 {
00166 data->object_type = new_object_type;
00167 }
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177 unsigned int
00178 ObjectPositionInterface::flags() const
00179 {
00180 return data->flags;
00181 }
00182
00183
00184
00185
00186
00187 size_t
00188 ObjectPositionInterface::maxlenof_flags() const
00189 {
00190 return 1;
00191 }
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201 void
00202 ObjectPositionInterface::set_flags(const unsigned int new_flags)
00203 {
00204 data->flags = new_flags;
00205 }
00206
00207
00208
00209
00210
00211 bool
00212 ObjectPositionInterface::is_visible() const
00213 {
00214 return data->visible;
00215 }
00216
00217
00218
00219
00220
00221 size_t
00222 ObjectPositionInterface::maxlenof_visible() const
00223 {
00224 return 1;
00225 }
00226
00227
00228
00229
00230
00231 void
00232 ObjectPositionInterface::set_visible(const bool new_visible)
00233 {
00234 data->visible = new_visible;
00235 }
00236
00237
00238
00239
00240
00241 bool
00242 ObjectPositionInterface::is_valid() const
00243 {
00244 return data->valid;
00245 }
00246
00247
00248
00249
00250
00251 size_t
00252 ObjectPositionInterface::maxlenof_valid() const
00253 {
00254 return 1;
00255 }
00256
00257
00258
00259
00260
00261 void
00262 ObjectPositionInterface::set_valid(const bool new_valid)
00263 {
00264 data->valid = new_valid;
00265 }
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277 int
00278 ObjectPositionInterface::visibility_history() const
00279 {
00280 return data->visibility_history;
00281 }
00282
00283
00284
00285
00286
00287 size_t
00288 ObjectPositionInterface::maxlenof_visibility_history() const
00289 {
00290 return 1;
00291 }
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303 void
00304 ObjectPositionInterface::set_visibility_history(const int new_visibility_history)
00305 {
00306 data->visibility_history = new_visibility_history;
00307 }
00308
00309
00310
00311
00312
00313
00314
00315 float
00316 ObjectPositionInterface::roll() const
00317 {
00318 return data->roll;
00319 }
00320
00321
00322
00323
00324
00325 size_t
00326 ObjectPositionInterface::maxlenof_roll() const
00327 {
00328 return 1;
00329 }
00330
00331
00332
00333
00334
00335
00336
00337 void
00338 ObjectPositionInterface::set_roll(const float new_roll)
00339 {
00340 data->roll = new_roll;
00341 }
00342
00343
00344
00345
00346
00347
00348
00349 float
00350 ObjectPositionInterface::pitch() const
00351 {
00352 return data->pitch;
00353 }
00354
00355
00356
00357
00358
00359 size_t
00360 ObjectPositionInterface::maxlenof_pitch() const
00361 {
00362 return 1;
00363 }
00364
00365
00366
00367
00368
00369
00370
00371 void
00372 ObjectPositionInterface::set_pitch(const float new_pitch)
00373 {
00374 data->pitch = new_pitch;
00375 }
00376
00377
00378
00379
00380
00381
00382
00383 float
00384 ObjectPositionInterface::yaw() const
00385 {
00386 return data->yaw;
00387 }
00388
00389
00390
00391
00392
00393 size_t
00394 ObjectPositionInterface::maxlenof_yaw() const
00395 {
00396 return 1;
00397 }
00398
00399
00400
00401
00402
00403
00404
00405 void
00406 ObjectPositionInterface::set_yaw(const float new_yaw)
00407 {
00408 data->yaw = new_yaw;
00409 }
00410
00411
00412
00413
00414
00415
00416
00417
00418 float
00419 ObjectPositionInterface::distance() const
00420 {
00421 return data->distance;
00422 }
00423
00424
00425
00426
00427
00428 size_t
00429 ObjectPositionInterface::maxlenof_distance() const
00430 {
00431 return 1;
00432 }
00433
00434
00435
00436
00437
00438
00439
00440
00441 void
00442 ObjectPositionInterface::set_distance(const float new_distance)
00443 {
00444 data->distance = new_distance;
00445 }
00446
00447
00448
00449
00450
00451
00452
00453
00454 float
00455 ObjectPositionInterface::bearing() const
00456 {
00457 return data->bearing;
00458 }
00459
00460
00461
00462
00463
00464 size_t
00465 ObjectPositionInterface::maxlenof_bearing() const
00466 {
00467 return 1;
00468 }
00469
00470
00471
00472
00473
00474
00475
00476
00477 void
00478 ObjectPositionInterface::set_bearing(const float new_bearing)
00479 {
00480 data->bearing = new_bearing;
00481 }
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491 float
00492 ObjectPositionInterface::slope() const
00493 {
00494 return data->slope;
00495 }
00496
00497
00498
00499
00500
00501 size_t
00502 ObjectPositionInterface::maxlenof_slope() const
00503 {
00504 return 1;
00505 }
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515 void
00516 ObjectPositionInterface::set_slope(const float new_slope)
00517 {
00518 data->slope = new_slope;
00519 }
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529 float *
00530 ObjectPositionInterface::dbs_covariance() const
00531 {
00532 return data->dbs_covariance;
00533 }
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545 float
00546 ObjectPositionInterface::dbs_covariance(unsigned int index) const
00547 {
00548 if (index > 9) {
00549 throw Exception("Index value %u out of bounds (0..9)", index);
00550 }
00551 return data->dbs_covariance[index];
00552 }
00553
00554
00555
00556
00557
00558 size_t
00559 ObjectPositionInterface::maxlenof_dbs_covariance() const
00560 {
00561 return 9;
00562 }
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572 void
00573 ObjectPositionInterface::set_dbs_covariance(const float * new_dbs_covariance)
00574 {
00575 memcpy(data->dbs_covariance, new_dbs_covariance, sizeof(float) * 9);
00576 }
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587 void
00588 ObjectPositionInterface::set_dbs_covariance(unsigned int index, const float new_dbs_covariance)
00589 {
00590 if (index > 9) {
00591 throw Exception("Index value %u out of bounds (0..9)", index);
00592 }
00593 data->dbs_covariance[index] = new_dbs_covariance;
00594 }
00595
00596
00597
00598
00599
00600
00601
00602
00603 float
00604 ObjectPositionInterface::world_x() const
00605 {
00606 return data->world_x;
00607 }
00608
00609
00610
00611
00612
00613 size_t
00614 ObjectPositionInterface::maxlenof_world_x() const
00615 {
00616 return 1;
00617 }
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627 void
00628 ObjectPositionInterface::set_world_x(const float new_world_x)
00629 {
00630 data->world_x = new_world_x;
00631 }
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641 float
00642 ObjectPositionInterface::world_y() const
00643 {
00644 return data->world_y;
00645 }
00646
00647
00648
00649
00650
00651 size_t
00652 ObjectPositionInterface::maxlenof_world_y() const
00653 {
00654 return 1;
00655 }
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665 void
00666 ObjectPositionInterface::set_world_y(const float new_world_y)
00667 {
00668 data->world_y = new_world_y;
00669 }
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679 float
00680 ObjectPositionInterface::world_z() const
00681 {
00682 return data->world_z;
00683 }
00684
00685
00686
00687
00688
00689 size_t
00690 ObjectPositionInterface::maxlenof_world_z() const
00691 {
00692 return 1;
00693 }
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703 void
00704 ObjectPositionInterface::set_world_z(const float new_world_z)
00705 {
00706 data->world_z = new_world_z;
00707 }
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717 float *
00718 ObjectPositionInterface::world_xyz_covariance() const
00719 {
00720 return data->world_xyz_covariance;
00721 }
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733 float
00734 ObjectPositionInterface::world_xyz_covariance(unsigned int index) const
00735 {
00736 if (index > 9) {
00737 throw Exception("Index value %u out of bounds (0..9)", index);
00738 }
00739 return data->world_xyz_covariance[index];
00740 }
00741
00742
00743
00744
00745
00746 size_t
00747 ObjectPositionInterface::maxlenof_world_xyz_covariance() const
00748 {
00749 return 9;
00750 }
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760 void
00761 ObjectPositionInterface::set_world_xyz_covariance(const float * new_world_xyz_covariance)
00762 {
00763 memcpy(data->world_xyz_covariance, new_world_xyz_covariance, sizeof(float) * 9);
00764 }
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775 void
00776 ObjectPositionInterface::set_world_xyz_covariance(unsigned int index, const float new_world_xyz_covariance)
00777 {
00778 if (index > 9) {
00779 throw Exception("Index value %u out of bounds (0..9)", index);
00780 }
00781 data->world_xyz_covariance[index] = new_world_xyz_covariance;
00782 }
00783
00784
00785
00786
00787
00788
00789 float
00790 ObjectPositionInterface::relative_x() const
00791 {
00792 return data->relative_x;
00793 }
00794
00795
00796
00797
00798
00799 size_t
00800 ObjectPositionInterface::maxlenof_relative_x() const
00801 {
00802 return 1;
00803 }
00804
00805
00806
00807
00808
00809
00810
00811 void
00812 ObjectPositionInterface::set_relative_x(const float new_relative_x)
00813 {
00814 data->relative_x = new_relative_x;
00815 }
00816
00817
00818
00819
00820
00821
00822
00823 float
00824 ObjectPositionInterface::relative_y() const
00825 {
00826 return data->relative_y;
00827 }
00828
00829
00830
00831
00832
00833 size_t
00834 ObjectPositionInterface::maxlenof_relative_y() const
00835 {
00836 return 1;
00837 }
00838
00839
00840
00841
00842
00843
00844
00845 void
00846 ObjectPositionInterface::set_relative_y(const float new_relative_y)
00847 {
00848 data->relative_y = new_relative_y;
00849 }
00850
00851
00852
00853
00854
00855
00856
00857 float
00858 ObjectPositionInterface::relative_z() const
00859 {
00860 return data->relative_z;
00861 }
00862
00863
00864
00865
00866
00867 size_t
00868 ObjectPositionInterface::maxlenof_relative_z() const
00869 {
00870 return 1;
00871 }
00872
00873
00874
00875
00876
00877
00878
00879 void
00880 ObjectPositionInterface::set_relative_z(const float new_relative_z)
00881 {
00882 data->relative_z = new_relative_z;
00883 }
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893 float *
00894 ObjectPositionInterface::relative_xyz_covariance() const
00895 {
00896 return data->relative_xyz_covariance;
00897 }
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909 float
00910 ObjectPositionInterface::relative_xyz_covariance(unsigned int index) const
00911 {
00912 if (index > 9) {
00913 throw Exception("Index value %u out of bounds (0..9)", index);
00914 }
00915 return data->relative_xyz_covariance[index];
00916 }
00917
00918
00919
00920
00921
00922 size_t
00923 ObjectPositionInterface::maxlenof_relative_xyz_covariance() const
00924 {
00925 return 9;
00926 }
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936 void
00937 ObjectPositionInterface::set_relative_xyz_covariance(const float * new_relative_xyz_covariance)
00938 {
00939 memcpy(data->relative_xyz_covariance, new_relative_xyz_covariance, sizeof(float) * 9);
00940 }
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951 void
00952 ObjectPositionInterface::set_relative_xyz_covariance(unsigned int index, const float new_relative_xyz_covariance)
00953 {
00954 if (index > 9) {
00955 throw Exception("Index value %u out of bounds (0..9)", index);
00956 }
00957 data->relative_xyz_covariance[index] = new_relative_xyz_covariance;
00958 }
00959
00960
00961
00962
00963
00964
00965 float
00966 ObjectPositionInterface::extent_x() const
00967 {
00968 return data->extent_x;
00969 }
00970
00971
00972
00973
00974
00975 size_t
00976 ObjectPositionInterface::maxlenof_extent_x() const
00977 {
00978 return 1;
00979 }
00980
00981
00982
00983
00984
00985
00986
00987 void
00988 ObjectPositionInterface::set_extent_x(const float new_extent_x)
00989 {
00990 data->extent_x = new_extent_x;
00991 }
00992
00993
00994
00995
00996
00997
00998
00999 float
01000 ObjectPositionInterface::extent_y() const
01001 {
01002 return data->extent_y;
01003 }
01004
01005
01006
01007
01008
01009 size_t
01010 ObjectPositionInterface::maxlenof_extent_y() const
01011 {
01012 return 1;
01013 }
01014
01015
01016
01017
01018
01019
01020
01021 void
01022 ObjectPositionInterface::set_extent_y(const float new_extent_y)
01023 {
01024 data->extent_y = new_extent_y;
01025 }
01026
01027
01028
01029
01030
01031
01032
01033 float
01034 ObjectPositionInterface::extent_z() const
01035 {
01036 return data->extent_z;
01037 }
01038
01039
01040
01041
01042
01043 size_t
01044 ObjectPositionInterface::maxlenof_extent_z() const
01045 {
01046 return 1;
01047 }
01048
01049
01050
01051
01052
01053
01054
01055 void
01056 ObjectPositionInterface::set_extent_z(const float new_extent_z)
01057 {
01058 data->extent_z = new_extent_z;
01059 }
01060
01061
01062
01063
01064
01065
01066
01067 float
01068 ObjectPositionInterface::world_x_velocity() const
01069 {
01070 return data->world_x_velocity;
01071 }
01072
01073
01074
01075
01076
01077 size_t
01078 ObjectPositionInterface::maxlenof_world_x_velocity() const
01079 {
01080 return 1;
01081 }
01082
01083
01084
01085
01086
01087
01088
01089 void
01090 ObjectPositionInterface::set_world_x_velocity(const float new_world_x_velocity)
01091 {
01092 data->world_x_velocity = new_world_x_velocity;
01093 }
01094
01095
01096
01097
01098
01099
01100
01101 float
01102 ObjectPositionInterface::world_y_velocity() const
01103 {
01104 return data->world_y_velocity;
01105 }
01106
01107
01108
01109
01110
01111 size_t
01112 ObjectPositionInterface::maxlenof_world_y_velocity() const
01113 {
01114 return 1;
01115 }
01116
01117
01118
01119
01120
01121
01122
01123 void
01124 ObjectPositionInterface::set_world_y_velocity(const float new_world_y_velocity)
01125 {
01126 data->world_y_velocity = new_world_y_velocity;
01127 }
01128
01129
01130
01131
01132
01133
01134
01135 float
01136 ObjectPositionInterface::world_z_velocity() const
01137 {
01138 return data->world_z_velocity;
01139 }
01140
01141
01142
01143
01144
01145 size_t
01146 ObjectPositionInterface::maxlenof_world_z_velocity() const
01147 {
01148 return 1;
01149 }
01150
01151
01152
01153
01154
01155
01156
01157 void
01158 ObjectPositionInterface::set_world_z_velocity(const float new_world_z_velocity)
01159 {
01160 data->world_z_velocity = new_world_z_velocity;
01161 }
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171 float *
01172 ObjectPositionInterface::world_xyz_velocity_covariance() const
01173 {
01174 return data->world_xyz_velocity_covariance;
01175 }
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187 float
01188 ObjectPositionInterface::world_xyz_velocity_covariance(unsigned int index) const
01189 {
01190 if (index > 9) {
01191 throw Exception("Index value %u out of bounds (0..9)", index);
01192 }
01193 return data->world_xyz_velocity_covariance[index];
01194 }
01195
01196
01197
01198
01199
01200 size_t
01201 ObjectPositionInterface::maxlenof_world_xyz_velocity_covariance() const
01202 {
01203 return 9;
01204 }
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214 void
01215 ObjectPositionInterface::set_world_xyz_velocity_covariance(const float * new_world_xyz_velocity_covariance)
01216 {
01217 memcpy(data->world_xyz_velocity_covariance, new_world_xyz_velocity_covariance, sizeof(float) * 9);
01218 }
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
01229 void
01230 ObjectPositionInterface::set_world_xyz_velocity_covariance(unsigned int index, const float new_world_xyz_velocity_covariance)
01231 {
01232 if (index > 9) {
01233 throw Exception("Index value %u out of bounds (0..9)", index);
01234 }
01235 data->world_xyz_velocity_covariance[index] = new_world_xyz_velocity_covariance;
01236 }
01237
01238
01239
01240
01241
01242
01243 float
01244 ObjectPositionInterface::relative_x_velocity() const
01245 {
01246 return data->relative_x_velocity;
01247 }
01248
01249
01250
01251
01252
01253 size_t
01254 ObjectPositionInterface::maxlenof_relative_x_velocity() const
01255 {
01256 return 1;
01257 }
01258
01259
01260
01261
01262
01263
01264
01265 void
01266 ObjectPositionInterface::set_relative_x_velocity(const float new_relative_x_velocity)
01267 {
01268 data->relative_x_velocity = new_relative_x_velocity;
01269 }
01270
01271
01272
01273
01274
01275
01276
01277 float
01278 ObjectPositionInterface::relative_y_velocity() const
01279 {
01280 return data->relative_y_velocity;
01281 }
01282
01283
01284
01285
01286
01287 size_t
01288 ObjectPositionInterface::maxlenof_relative_y_velocity() const
01289 {
01290 return 1;
01291 }
01292
01293
01294
01295
01296
01297
01298
01299 void
01300 ObjectPositionInterface::set_relative_y_velocity(const float new_relative_y_velocity)
01301 {
01302 data->relative_y_velocity = new_relative_y_velocity;
01303 }
01304
01305
01306
01307
01308
01309
01310
01311 float
01312 ObjectPositionInterface::relative_z_velocity() const
01313 {
01314 return data->relative_z_velocity;
01315 }
01316
01317
01318
01319
01320
01321 size_t
01322 ObjectPositionInterface::maxlenof_relative_z_velocity() const
01323 {
01324 return 1;
01325 }
01326
01327
01328
01329
01330
01331
01332
01333 void
01334 ObjectPositionInterface::set_relative_z_velocity(const float new_relative_z_velocity)
01335 {
01336 data->relative_z_velocity = new_relative_z_velocity;
01337 }
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347 float *
01348 ObjectPositionInterface::relative_xyz_velocity_covariance() const
01349 {
01350 return data->relative_xyz_velocity_covariance;
01351 }
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363 float
01364 ObjectPositionInterface::relative_xyz_velocity_covariance(unsigned int index) const
01365 {
01366 if (index > 9) {
01367 throw Exception("Index value %u out of bounds (0..9)", index);
01368 }
01369 return data->relative_xyz_velocity_covariance[index];
01370 }
01371
01372
01373
01374
01375
01376 size_t
01377 ObjectPositionInterface::maxlenof_relative_xyz_velocity_covariance() const
01378 {
01379 return 9;
01380 }
01381
01382
01383
01384
01385
01386
01387
01388
01389
01390 void
01391 ObjectPositionInterface::set_relative_xyz_velocity_covariance(const float * new_relative_xyz_velocity_covariance)
01392 {
01393 memcpy(data->relative_xyz_velocity_covariance, new_relative_xyz_velocity_covariance, sizeof(float) * 9);
01394 }
01395
01396
01397
01398
01399
01400
01401
01402
01403
01404
01405 void
01406 ObjectPositionInterface::set_relative_xyz_velocity_covariance(unsigned int index, const float new_relative_xyz_velocity_covariance)
01407 {
01408 if (index > 9) {
01409 throw Exception("Index value %u out of bounds (0..9)", index);
01410 }
01411 data->relative_xyz_velocity_covariance[index] = new_relative_xyz_velocity_covariance;
01412 }
01413
01414 Message *
01415 ObjectPositionInterface::create_message(const char *type) const
01416 {
01417 throw UnknownTypeException("The given type '%s' does not match any known "
01418 "message type for this interface type.", type);
01419 }
01420
01421
01422
01423
01424
01425 void
01426 ObjectPositionInterface::copy_values(const Interface *other)
01427 {
01428 const ObjectPositionInterface *oi = dynamic_cast<const ObjectPositionInterface *>(other);
01429 if (oi == NULL) {
01430 throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
01431 type(), other->type());
01432 }
01433 memcpy(data, oi->data, sizeof(ObjectPositionInterface_data_t));
01434 }
01435
01436
01437
01438
01439
01440 bool
01441 ObjectPositionInterface::message_valid(const Message *message) const
01442 {
01443 return false;
01444 }
01445
01446
01447 EXPORT_INTERFACE(ObjectPositionInterface)
01448
01449
01450
01451 }