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