-
Notifications
You must be signed in to change notification settings - Fork 4
/
remApi.m
1935 lines (1595 loc) · 72.3 KB
/
remApi.m
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% This file is part of the REMOTE API
%
% Copyright 2006-2015 Coppelia Robotics GmbH. All rights reserved.
% www.coppeliarobotics.com
%
% The REMOTE API is licensed under the terms of GNU GPL:
%
% -------------------------------------------------------------------
% The REMOTE API is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% THE REMOTE API IS DISTRIBUTED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
% WARRANTY. THE USER WILL USE IT AT HIS/HER OWN RISK. THE ORIGINAL
% AUTHORS AND COPPELIA ROBOTICS GMBH WILL NOT BE LIABLE FOR DATA LOSS,
% DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR
% MISUSING THIS SOFTWARE.
%
% See the GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with the REMOTE API. If not, see <http://www.gnu.org/licenses/>.
% -------------------------------------------------------------------
%
% This file was automatically created for V-REP release V3.2.1 on May 3rd 2015
classdef remApi
properties
libName;
hFile;
end
properties (Constant)
% Scene object types
sim_object_shape_type =0;
sim_object_joint_type =1;
sim_object_graph_type =2;
sim_object_camera_type =3;
sim_object_dummy_type =4;
sim_object_proximitysensor_type =5;
sim_object_reserved1 =6;
sim_object_reserved2 =7;
sim_object_path_type =8;
sim_object_visionsensor_type =9;
sim_object_volume_type =10;
sim_object_mill_type =11;
sim_object_forcesensor_type =12;
sim_object_light_type =13;
sim_object_mirror_type =14;
%General object types
sim_appobj_object_type =109;
sim_appobj_collision_type =110;
sim_appobj_distance_type =111;
sim_appobj_simulation_type =112;
sim_appobj_ik_type =113;
sim_appobj_constraintsolver_type=114;
sim_appobj_collection_type =115;
sim_appobj_ui_type =116;
sim_appobj_script_type =117;
sim_appobj_pathplanning_type =118;
sim_appobj_RESERVED_type =119;
sim_appobj_texture_type =120;
% Ik calculation methods
sim_ik_pseudo_inverse_method =0;
sim_ik_damped_least_squares_method =1;
sim_ik_jacobian_transpose_method =2;
% Ik constraints
sim_ik_x_constraint =1;
sim_ik_y_constraint =2;
sim_ik_z_constraint =4;
sim_ik_alpha_beta_constraint=8;
sim_ik_gamma_constraint =16;
sim_ik_avoidance_constraint =64;
% Ik calculation results
sim_ikresult_not_performed =0;
sim_ikresult_success =1;
sim_ikresult_fail =2;
% Scene object sub-types
sim_light_omnidirectional_subtype =1;
sim_light_spot_subtype =2;
sim_light_directional_subtype =3;
sim_joint_revolute_subtype =10;
sim_joint_prismatic_subtype =11;
sim_joint_spherical_subtype =12;
sim_shape_simpleshape_subtype =20;
sim_shape_multishape_subtype =21;
sim_proximitysensor_pyramid_subtype =30;
sim_proximitysensor_cylinder_subtype=31;
sim_proximitysensor_disc_subtype =32;
sim_proximitysensor_cone_subtype =33;
sim_proximitysensor_ray_subtype =34;
sim_mill_pyramid_subtype =40;
sim_mill_cylinder_subtype =41;
sim_mill_disc_subtype =42;
sim_mill_cone_subtype =42;
sim_object_no_subtype =200;
%Scene object main properties
sim_objectspecialproperty_collidable =1;
sim_objectspecialproperty_measurable =2;
sim_objectspecialproperty_detectable_ultrasonic =16;
sim_objectspecialproperty_detectable_infrared =32;
sim_objectspecialproperty_detectable_laser =64;
sim_objectspecialproperty_detectable_inductive =128;
sim_objectspecialproperty_detectable_capacitive =256;
sim_objectspecialproperty_renderable =512;
sim_objectspecialproperty_detectable_all =496;
sim_objectspecialproperty_cuttable =1024;
sim_objectspecialproperty_pathplanning_ignored =2048;
% Model properties
sim_modelproperty_not_collidable =1;
sim_modelproperty_not_measurable =2;
sim_modelproperty_not_renderable =4;
sim_modelproperty_not_detectable =8;
sim_modelproperty_not_cuttable =16;
sim_modelproperty_not_dynamic =32;
sim_modelproperty_not_respondable =64;
sim_modelproperty_not_reset =128;
sim_modelproperty_not_visible =256;
sim_modelproperty_not_model =61440;
% Check the documentation instead of comments below!!
sim_message_ui_button_state_change =0;
sim_message_reserved9 =1;
sim_message_object_selection_changed=2;
sim_message_reserved10 =3;
sim_message_model_loaded =4;
sim_message_reserved11 =5;
sim_message_keypress =6;
sim_message_bannerclicked =7;
sim_message_for_c_api_only_start =256;
sim_message_reserved1 =257;
sim_message_reserved2 =258;
sim_message_reserved3 =259;
sim_message_eventcallback_scenesave =260;
sim_message_eventcallback_modelsave =261;
sim_message_eventcallback_moduleopen =262;
sim_message_eventcallback_modulehandle =263;
sim_message_eventcallback_moduleclose =264;
sim_message_reserved4 =265;
sim_message_reserved5 =266;
sim_message_reserved6 =267;
sim_message_reserved7 =268;
sim_message_eventcallback_instancepass =269;
sim_message_eventcallback_broadcast =270;
sim_message_eventcallback_imagefilter_enumreset =271;
sim_message_eventcallback_imagefilter_enumerate =272;
sim_message_eventcallback_imagefilter_adjustparams =273;
sim_message_eventcallback_imagefilter_reserved =274;
sim_message_eventcallback_imagefilter_process =275;
sim_message_eventcallback_reserved1 =276;
sim_message_eventcallback_reserved2 =277;
sim_message_eventcallback_reserved3 =278;
sim_message_eventcallback_reserved4 =279;
sim_message_eventcallback_abouttoundo =280;
sim_message_eventcallback_undoperformed =281;
sim_message_eventcallback_abouttoredo =282;
sim_message_eventcallback_redoperformed =283;
sim_message_eventcallback_scripticondblclick =284;
sim_message_eventcallback_simulationabouttostart =285;
sim_message_eventcallback_simulationended =286;
sim_message_eventcallback_reserved5 =287;
sim_message_eventcallback_keypress =288;
sim_message_eventcallback_modulehandleinsensingpart =289;
sim_message_eventcallback_renderingpass =290;
sim_message_eventcallback_bannerclicked =291;
sim_message_eventcallback_menuitemselected =292;
sim_message_eventcallback_refreshdialogs =293;
sim_message_eventcallback_sceneloaded =294;
sim_message_eventcallback_modelloaded =295;
sim_message_eventcallback_instanceswitch =296;
sim_message_eventcallback_guipass =297;
sim_message_eventcallback_mainscriptabouttobecalled =298;
sim_message_eventcallback_rmlposition =299;
sim_message_eventcallback_rmlvelocity =300;
sim_message_simulation_start_resume_request =4096;
sim_message_simulation_pause_request =4097;
sim_message_simulation_stop_request =4098;
% Scene object properties
sim_objectproperty_collapsed =16;
sim_objectproperty_selectable =32;
sim_objectproperty_reserved7 =64;
sim_objectproperty_selectmodelbaseinstead =128;
sim_objectproperty_dontshowasinsidemodel =256;
sim_objectproperty_canupdatedna =1024;
sim_objectproperty_selectinvisible =2048;
sim_objectproperty_depthinvisible =4096;
% type of arguments (input and output) for custom lua commands
sim_lua_arg_nil =0;
sim_lua_arg_bool =1;
sim_lua_arg_int =2;
sim_lua_arg_float =3;
sim_lua_arg_string =4;
sim_lua_arg_invalid =5;
sim_lua_arg_table =8;
% custom user interface properties
sim_ui_property_visible =1;
sim_ui_property_visibleduringsimulationonly =2;
sim_ui_property_moveable =4;
sim_ui_property_relativetoleftborder =8;
sim_ui_property_relativetotopborder =16;
sim_ui_property_fixedwidthfont =32;
sim_ui_property_systemblock =64;
sim_ui_property_settocenter =128;
sim_ui_property_rolledup =256;
sim_ui_property_selectassociatedobject =512;
sim_ui_property_visiblewhenobjectselected =1024;
% button properties
sim_buttonproperty_button =0;
sim_buttonproperty_label =1;
sim_buttonproperty_slider =2;
sim_buttonproperty_editbox =3;
sim_buttonproperty_staydown =8;
sim_buttonproperty_enabled =16;
sim_buttonproperty_borderless =32;
sim_buttonproperty_horizontallycentered =64;
sim_buttonproperty_ignoremouse =128;
sim_buttonproperty_isdown =256;
sim_buttonproperty_transparent =512;
sim_buttonproperty_nobackgroundcolor =1024;
sim_buttonproperty_rollupaction =2048;
sim_buttonproperty_closeaction =4096;
sim_buttonproperty_verticallycentered =8192;
sim_buttonproperty_downupevent =16384;
% Simulation status
sim_simulation_stopped =0;
sim_simulation_paused =8;
sim_simulation_advancing =16;
sim_simulation_advancing_firstafterstop =16;
sim_simulation_advancing_running =17;
sim_simulation_advancing_lastbeforepause =19;
sim_simulation_advancing_firstafterpause =20;
sim_simulation_advancing_abouttostop =21;
sim_simulation_advancing_lastbeforestop =22;
% Script execution result (first return value)
sim_script_no_error =0;
sim_script_main_script_nonexistent =1;
sim_script_main_script_not_called =2;
sim_script_reentrance_error =4;
sim_script_lua_error =8;
sim_script_call_error =16;
% Script types
sim_scripttype_mainscript =0;
sim_scripttype_childscript =1;
sim_scripttype_pluginscript =2;
sim_scripttype_threaded =240;
% API call error messages
sim_api_errormessage_ignore =0;
sim_api_errormessage_report =1;
sim_api_errormessage_output =2;
% special argument of some functions
sim_handle_all =-2;
sim_handle_all_except_explicit =-3;
sim_handle_self =-4;
sim_handle_main_script =-5;
sim_handle_tree =-6;
sim_handle_chain =-7;
sim_handle_single =-8;
sim_handle_default =-9;
sim_handle_all_except_self =-10;
sim_handle_parent =-11;
% special handle flags
sim_handleflag_assembly =4194304;
sim_handleflag_model =8388608;
% distance calculation methods
sim_distcalcmethod_dl =0;
sim_distcalcmethod_dac =1;
sim_distcalcmethod_max_dl_dac =2;
sim_distcalcmethod_dl_and_dac =3;
sim_distcalcmethod_sqrt_dl2_and_dac2=4;
sim_distcalcmethod_dl_if_nonzero =5;
sim_distcalcmethod_dac_if_nonzero =6;
% Generic dialog styles
sim_dlgstyle_message =0;
sim_dlgstyle_input =1;
sim_dlgstyle_ok =2;
sim_dlgstyle_ok_cancel =3;
sim_dlgstyle_yes_no =4;
sim_dlgstyle_dont_center =32;
% Generic dialog return values
sim_dlgret_still_open =0;
sim_dlgret_ok =1;
sim_dlgret_cancel =2;
sim_dlgret_yes =3;
sim_dlgret_no =4;
% Path properties
sim_pathproperty_show_line =1;
sim_pathproperty_show_orientation =2;
sim_pathproperty_closed_path =4;
sim_pathproperty_automatic_orientation =8;
sim_pathproperty_invert_velocity =16;
sim_pathproperty_infinite_acceleration =32;
sim_pathproperty_flat_path =64;
sim_pathproperty_show_position =128;
sim_pathproperty_auto_velocity_profile_translation =256;
sim_pathproperty_auto_velocity_profile_rotation =512;
sim_pathproperty_endpoints_at_zero =1024;
sim_pathproperty_keep_x_up =2048;
% drawing objects
sim_drawing_points =0;
sim_drawing_lines =1;
sim_drawing_triangles =2;
sim_drawing_trianglepoints =3;
sim_drawing_quadpoints =4;
sim_drawing_discpoints =5;
sim_drawing_cubepoints =6;
sim_drawing_spherepoints =7;
sim_drawing_itemcolors =32;
sim_drawing_vertexcolors =64;
sim_drawing_itemsizes =128;
sim_drawing_backfaceculling =256;
sim_drawing_wireframe =512;
sim_drawing_painttag =1024;
sim_drawing_followparentvisibility =2048;
sim_drawing_cyclic =4096;
sim_drawing_50percenttransparency =8192;
sim_drawing_25percenttransparency =16384;
sim_drawing_12percenttransparency =32768;
sim_drawing_emissioncolor =65536;
sim_drawing_facingcamera =131072;
sim_drawing_overlay =262144;
sim_drawing_itemtransparency =524288;
% banner values
sim_banner_left =1;
sim_banner_right =2;
sim_banner_nobackground =4;
sim_banner_overlay =8;
sim_banner_followparentvisibility =16;
sim_banner_clickselectsparent =32;
sim_banner_clicktriggersevent =64;
sim_banner_facingcamera =128;
sim_banner_fullyfacingcamera =256;
sim_banner_backfaceculling =512;
sim_banner_keepsamesize =1024;
sim_banner_bitmapfont =2048;
% particle objects
sim_particle_points1 =0;
sim_particle_points2 =1;
sim_particle_points4 =2;
sim_particle_roughspheres =3;
sim_particle_spheres =4;
sim_particle_respondable1to4 =32;
sim_particle_respondable5to8 =64;
sim_particle_particlerespondable =128;
sim_particle_ignoresgravity =256;
sim_particle_invisible =512;
sim_particle_itemsizes =1024;
sim_particle_itemdensities =2048;
sim_particle_itemcolors =4096;
sim_particle_cyclic =8192;
sim_particle_emissioncolor =16384;
sim_particle_water =32768;
sim_particle_painttag =65536;
% custom user interface menu attributes
sim_ui_menu_title =1;
sim_ui_menu_minimize =2;
sim_ui_menu_close =4;
sim_ui_menu_systemblock =8;
% Boolean parameters
sim_boolparam_hierarchy_visible =0;
sim_boolparam_console_visible =1;
sim_boolparam_collision_handling_enabled =2;
sim_boolparam_distance_handling_enabled =3;
sim_boolparam_ik_handling_enabled =4;
sim_boolparam_gcs_handling_enabled =5;
sim_boolparam_dynamics_handling_enabled =6;
sim_boolparam_joint_motion_handling_enabled =7;
sim_boolparam_path_motion_handling_enabled =8;
sim_boolparam_proximity_sensor_handling_enabled =9;
sim_boolparam_vision_sensor_handling_enabled =10;
sim_boolparam_mill_handling_enabled =11;
sim_boolparam_browser_visible =12;
sim_boolparam_scene_and_model_load_messages =13;
sim_reserved0 =14;
sim_boolparam_shape_textures_are_visible =15;
sim_boolparam_display_enabled =16;
sim_boolparam_infotext_visible =17;
sim_boolparam_statustext_open =18;
sim_boolparam_fog_enabled =19;
sim_boolparam_rml2_available =20;
sim_boolparam_rml4_available =21;
sim_boolparam_mirrors_enabled =22;
sim_boolparam_aux_clip_planes_enabled =23;
sim_boolparam_full_model_copy_from_api =24;
sim_boolparam_realtime_simulation =25;
sim_boolparam_force_show_wireless_emission =27;
sim_boolparam_force_show_wireless_reception =28;
sim_boolparam_video_recording_triggered =29;
sim_boolparam_threaded_rendering_enabled =32;
sim_boolparam_fullscreen =33;
sim_boolparam_headless =34;
sim_boolparam_hierarchy_toolbarbutton_enabled =35;
sim_boolparam_browser_toolbarbutton_enabled =36;
sim_boolparam_objectshift_toolbarbutton_enabled =37;
sim_boolparam_objectrotate_toolbarbutton_enabled=38;
sim_boolparam_force_calcstruct_all_visible =39;
sim_boolparam_force_calcstruct_all =40;
sim_boolparam_exit_request =41;
sim_boolparam_play_toolbarbutton_enabled =42;
sim_boolparam_pause_toolbarbutton_enabled =43;
sim_boolparam_stop_toolbarbutton_enabled =44;
% Integer parameters
sim_intparam_error_report_mode =0;
sim_intparam_program_version =1;
sim_intparam_instance_count =2;
sim_intparam_custom_cmd_start_id =3;
sim_intparam_compilation_version =4;
sim_intparam_current_page =5;
sim_intparam_flymode_camera_handle =6;
sim_intparam_dynamic_step_divider =7;
sim_intparam_dynamic_engine =8;
sim_intparam_server_port_start =9;
sim_intparam_server_port_range =10;
sim_intparam_visible_layers =11;
sim_intparam_infotext_style =12;
sim_intparam_settings =13;
sim_intparam_edit_mode_type =14;
sim_intparam_server_port_next =15;
sim_intparam_qt_version =16;
sim_intparam_event_flags_read =17;
sim_intparam_event_flags_read_clear =18;
sim_intparam_platform =19;
sim_intparam_scene_unique_id =20;
sim_intparam_work_thread_count =21;
sim_intparam_mouse_x =22;
sim_intparam_mouse_y =23;
sim_intparam_core_count =24;
sim_intparam_work_thread_calc_time_ms =25;
sim_intparam_idle_fps =26;
sim_intparam_prox_sensor_select_down =27;
sim_intparam_prox_sensor_select_up =28;
sim_intparam_stop_request_counter =29;
sim_intparam_program_revision =30;
sim_intparam_mouse_buttons =31;
sim_intparam_dynamic_warning_disabled_mask =32;
sim_intparam_simulation_warning_disabled_mask =33;
sim_intparam_scene_index =34;
sim_intparam_motionplanning_seed =35;
% Float parameters
sim_floatparam_rand =0;
sim_floatparam_simulation_time_step =1;
sim_floatparam_stereo_distance =2;
% String parameters
sim_stringparam_application_path =0;
sim_stringparam_video_filename =1;
sim_stringparam_app_arg1 =2;
sim_stringparam_app_arg2 =3;
sim_stringparam_app_arg3 =4;
sim_stringparam_app_arg4 =5;
sim_stringparam_app_arg5 =6;
sim_stringparam_app_arg6 =7;
sim_stringparam_app_arg7 =8;
sim_stringparam_app_arg8 =9;
sim_stringparam_app_arg9 =10;
sim_stringparam_scene_path_and_name =13;
% Array parameters
sim_arrayparam_gravity =0;
sim_arrayparam_fog =1;
sim_arrayparam_fog_color =2;
sim_arrayparam_background_color1=3;
sim_arrayparam_background_color2=4;
sim_arrayparam_ambient_light =5;
sim_arrayparam_random_euler =6;
% User interface elements
sim_gui_menubar =1;
sim_gui_popups =2;
sim_gui_toolbar1 =4;
sim_gui_toolbar2 =8;
sim_gui_hierarchy =16;
sim_gui_infobar =32;
sim_gui_statusbar =64;
sim_gui_scripteditor =128;
sim_gui_scriptsimulationparameters =256;
sim_gui_dialogs =512;
sim_gui_browser =1024;
sim_gui_all =65535;
% Joint modes
sim_jointmode_passive =0;
sim_jointmode_motion =1;
sim_jointmode_ik =2;
sim_jointmode_ikdependent =3;
sim_jointmode_dependent =4;
sim_jointmode_force =5;
% Navigation and selection modes with the mouse.
sim_navigation_passive =0;
sim_navigation_camerashift =1;
sim_navigation_camerarotate =2;
sim_navigation_camerazoom =3;
sim_navigation_cameratilt =4;
sim_navigation_cameraangle =5;
sim_navigation_camerafly =6;
sim_navigation_objectshift =7;
sim_navigation_objectrotate =8;
sim_navigation_reserved2 =9;
sim_navigation_reserved3 =10;
sim_navigation_jointpathtest =11;
sim_navigation_ikmanip =12;
sim_navigation_objectmultipleselection =13;
sim_navigation_reserved4 =256;
sim_navigation_clickselection =512;
sim_navigation_ctrlselection =1024;
sim_navigation_shiftselection =2048;
sim_navigation_camerazoomwheel =4096;
sim_navigation_camerarotaterightbutton =8192;
% Remote API message header structure
simx_headeroffset_crc =0;
simx_headeroffset_version =2;
simx_headeroffset_message_id =3;
simx_headeroffset_client_time =7;
simx_headeroffset_server_time =11;
simx_headeroffset_scene_id =15;
simx_headeroffset_server_state =17;
% Remote API command header
simx_cmdheaderoffset_mem_size =0;
simx_cmdheaderoffset_full_mem_size =4;
simx_cmdheaderoffset_pdata_offset0 =8;
simx_cmdheaderoffset_pdata_offset1 =10;
simx_cmdheaderoffset_cmd =14;
simx_cmdheaderoffset_delay_or_split =18;
simx_cmdheaderoffset_sim_time =20;
simx_cmdheaderoffset_status =24;
simx_cmdheaderoffset_reserved =25;
% Regular operation modes
simx_opmode_oneshot =0;
simx_opmode_oneshot_wait =65536;
simx_opmode_continuous =131072;
simx_opmode_streaming =131072;
% Operation modes for heavy data
simx_opmode_oneshot_split =196608;
simx_opmode_continuous_split =262144;
simx_opmode_streaming_split =262144;
% Special operation modes
simx_opmode_discontinue =327680;
simx_opmode_buffer =393216;
simx_opmode_remove =458752;
% Command return codes
simx_return_ok =0;
simx_return_novalue_flag =1;
simx_return_timeout_flag =2;
simx_return_illegal_opmode_flag =4;
simx_return_remote_error_flag =8;
simx_return_split_progress_flag =16;
simx_return_local_error_flag =32;
simx_return_initialize_error_flag =64;
% Following for backward compatibility (same as above)
simx_error_noerror =0;
simx_error_novalue_flag =1;
simx_error_timeout_flag =2;
simx_error_illegal_opmode_flag =4;
simx_error_remote_error_flag =8;
simx_error_split_progress_flag =16;
simx_error_local_error_flag =32;
simx_error_initialize_error_flag =64;
end
methods
%constructor
function obj = remApi(libname,hfile)
obj.libName = libname;
fprintf('Running Matlab %s\n',computer('arch'));
disp('Note: always make sure you use the corresponding remoteApi library');
disp('(i.e. 32bit Matlab will not work with 64bit remoteApi, and vice-versa)');
if ~libisloaded(obj.libName)
if exist('hfile','var')
obj.hFile = hfile;
loadlibrary(obj.libName,obj.hFile);
else
loadlibrary(obj.libName,@remoteApiProto);
end
end
end
%destructor
function delete(obj)
% we keep the library in memory for now unloadlibrary(obj.libName);
end
%api methods
function [rtn] = simxStart(obj,server,port,waitUntilConnected,doNotReconnectOnceDisconnected,timeOutInMs,commThreadCycleInMs)
server_intval = int8([server,0]);
server_ptr = libpointer('int8Ptr',server_intval);
rtn = calllib(obj.libName,'simxStart',server_ptr,port,uint8(waitUntilConnected),uint8(doNotReconnectOnceDisconnected),timeOutInMs,commThreadCycleInMs);
end
function simxFinish(obj,clientID)
calllib(obj.libName,'simxFinish',clientID);
end
function rtn = simxAddStatusbarMessage(obj,clientID,message,operationmode)
message_ = libpointer('int8Ptr',[int8(message) 0]);
operationmode_ = int32(operationmode);
[rtn message_] = calllib(obj.libName,'simxAddStatusbarMessage',clientID,message_,operationmode_);
end
function rtn = simxAuxiliaryConsoleClose(obj,clientID,console, operationmode)
console_ = int32(console);
operationmode_ = int32(operationmode);
rtn = calllib(obj.libName,'simxAuxiliaryConsoleClose',clientID,console_,operationmode_)
end
function rtn = simxAuxiliaryConsolePrint(obj,clientID,console,text,operationmode)
console_ = int32(console);
operationmode_ = int32(operationmode);
if text
text_ = libpointer('int8Ptr',[int8(text) 0]);
else
text_ = [];
end
rtn = calllib(obj.libName,'simxAuxiliaryConsolePrint',clientID,console_,text_,operationmode_);
end
function rtn = simxAuxiliaryConsoleShow(obj,clientID,consoleHandle,showState,operationMode)
consoleHandle_ = int32(consoleHandle);
showState_ = uint8(showState);
operationMode_ = int32(operationMode);
rtn = calllib(obj.libName,'simxAuxiliaryConsoleShow',clientID,consoleHandle_,showState_,operationMode_);
end
function rtn = simxBreakForceSensor(obj,clientID,forceSensorHandle,operationMode)
forceSensorHandle_ = int32(forceSensorHandle);
operationMode_ = int32(operationMode);
rtn = calllib(obj.libName, 'simxBreakForceSensor',clientID,forceSensorHandle_,operationMode_);
end
function rtn = simxClearFloatSignal(obj,clientID,signalName,operationMode)
signalName_ = libpointer('int8Ptr',[int8(signalName) 0]);
operationMode_ = int32(operationMode);
rtn = calllib(obj.libName,'simxClearFloatSignal',clientID,signalName_,operationMode_);
end
function rtn = simxClearIntegerSignal(obj,clientID,signalName,operationMode)
signalName_ = libpointer('int8Ptr',[int8(signalName) 0]);
operationMode_ = int32(operationMode);
rtn = calllib(obj.libName,'simxClearIntegerSignal',clientID,signalName_,operationMode_);
end
function rtn = simxClearStringSignal(obj,clientID,signalName,operationMode)
signalName_ = libpointer('int8Ptr',[int8(signalName) 0]);
operationMode_ = int32(operationMode);
rtn = calllib(obj.libName,'simxClearStringSignal',clientID,signalName_,operationMode_);
end
function rtn = simxCloseScene(obj,clientID,operationMode)
operationMode_ = int32(operationMode);
rtn = calllib(obj.libName,'simxCloseScene',clientID,operationMode_);
end
function [rtn newObjectHandles] = simxCopyPasteObjects(obj,clientID,objectHandles,operationMode)
objectHandles_ = libpointer('int32Ptr',int32(objectHandles));
objectCount_ = int32(numel(objectHandles));
newObjectHandles_ = libpointer('int32Ptr',[]);
newObjectCount_ = libpointer('int32Ptr',int32(0));
operationMode_ = int32(operationMode);
[rtn objectHandles_ newObjectHandles_ newObjectCount_] = calllib(obj.libName,'simxCopyPasteObjects',clientID,objectHandles_,objectCount_,newObjectHandles_,newObjectCount_,operationMode_);
if (rtn==0)&&(newObjectCount_>0)
newObjectHandles = zeros(1,newObjectCount_);
newObjectHandles_.setdatatype('int32Ptr',1,newObjectCount_);
for i=1:newObjectCount_;
newObjectHandles(i) = newObjectHandles_.value(i);
end
else
newObjectHandles=[];
end
end
function buffer = simxCreateBuffer(obj,bufferSize)
bufferSize_ = int32(bufferSize);
buffer = calllib(obj.libName,'simxCreateBuffer',bufferSize_);
end
function rtn = simxEndDialog(obj,clientID,dialogHandle,operationMode)
operationMode_ = int32(operationMode);
dialogHandle_ = int32(dialogHandle);
rtn = calllib(obj.libName,'simxEndDialog',clientID,dialogHandle_,operationMode_);
end
function rtn = simxEraseFile(obj,clientID,fileName_serverSide,operationMode)
fileName_serverSide_ = libpointer('int8Ptr',[int8(fileName_serverSide) 0]);
operationMode_ = int32(operationMode);
[rtn fileName_serverSide_] = calllib(obj.libName,'simxEraseFile',clientID,fileName_serverSide_,operationMode_);
end
function [rtn paramValues ]= simxGetArrayParameter(obj,clientID,paramIdentifier,operationMode)
paramIdentifier_ = int32(paramIdentifier);
operationMode_ = int32(operationMode);
paramValues = libpointer('singlePtr',single([0 0 0]));
[rtn paramValues] = calllib(obj.libName,'simxGetArrayParameter',clientID,paramIdentifier_,paramValues ,operationMode_);
end
function [rtn paramValues ]= simxGetBooleanParameter(obj,clientID,paramIdentifier,operationMode)
paramIdentifier_ = int32(paramIdentifier);
operationMode_ = int32(operationMode);
paramValues = libpointer('uint8Ptr',uint8(0));
[rtn paramValues] = calllib(obj.libName,'simxGetBooleanParameter',clientID,paramIdentifier_,paramValues ,operationMode_);
end
function [rtn handle] = simxGetCollisionHandle(obj,clientID,collisionObjectName,operationMode)
collisionObjectName_ = libpointer('int8Ptr',[int8(collisionObjectName) 0]);
handle_ = libpointer('int32Ptr',int32(0));
operationMode_ = int32(operationMode);
[rtn collisionObjectName_ handle] = calllib(obj.libName,'simxGetCollisionHandle',clientID,collisionObjectName_,handle_ ,operationMode_);
end
function rtn = simxGetConnectionId(obj,clientID)
rtn = calllib(obj.libName,'simxGetConnectionId',clientID);
end
function [rtn inputText]= simxGetDialogInput(obj,clientID,dialogHandle,operationMode)
dialogHandle_ = int32(dialogHandle);
inputText_ = libpointer('int8PtrPtr');
operationMode_ = int32(operationMode);
[rtn inputText_ ] = calllib(obj.libName,'simxGetDialogInput',clientID,dialogHandle_,inputText_,operationMode_);
if (rtn==0)
s=1;
inputText_.setdatatype('int8Ptr',1,s);
value = inputText_.value(s);
while(value ~= 0)
inputText_.setdatatype('int8Ptr',1,s);
value = inputText_.value(s);
s=s+1;
end
tmp = inputText_.value(1:s-1);
inputText = char(tmp);
else
inputText = [];
end
end
function [rtn result]= simxGetDialogResult (obj,clientID,dialogHandle,operationMode)
dialogHandle_ = int32(dialogHandle);
result = libpointer('int32Ptr',int32(0));
operationMode_ = int32(operationMode);
[rtn result] = calllib(obj.libName,'simxGetDialogResult',clientID,dialogHandle_,result,operationMode_);
end
function [rtn handle] = simxGetDistanceHandle(obj,clientID,distanceObjectName,operationMode)
distanceObjectName_ = libpointer('int8Ptr',[int8(distanceObjectName) 0]);
handle_ = libpointer('int32Ptr',int32(0));
operationMode_ = int32(operationMode);
[rtn distanceObjectName_ handle] = calllib(obj.libName,'simxGetDistanceHandle',clientID,distanceObjectName_,handle_ ,operationMode_);
end
function [rtn paramValue]= simxGetFloatingParameter(obj,clientID,paramIdentifier,operationMode)
paramIdentifier_ = int32(paramIdentifier);
operationMode_ = int32(operationMode);
paramValue = libpointer('singlePtr',single(0));
[rtn paramValue] = calllib(obj.libName,'simxGetFloatingParameter',clientID,paramIdentifier_,paramValue,operationMode_);
end
function [rtn signalValue]= simxGetFloatSignal(obj,clientID,signalName,operationMode)
signalName_ = libpointer('int8Ptr',[int8(signalName) 0]);
signalValue = libpointer('singlePtr',single(0));
operationMode_ = int32(operationMode);
[rtn signalName_ signalValue] = calllib(obj.libName,'simxGetFloatSignal',clientID,signalName_,signalValue,operationMode_);
end
function [rtn info]= simxGetInMessageInfo(obj,clientID,infoType)
infoType_ = int32(infoType);
info = libpointer('int32Ptr',int32(0));
[rtn info] = calllib(obj.libName,'simxGetInMessageInfo',clientID,infoType_,info);
end
function [rtn paramValue]= simxGetIntegerParameter (obj,clientID,paramIdentifier,operationMode)
paramIdentifier_ = int32(paramIdentifier);
operationMode_ = int32(operationMode);
paramValue = libpointer('int32Ptr',int32(0));
[rtn paramValue] = calllib(obj.libName,'simxGetIntegerParameter',clientID,paramIdentifier_,paramValue,operationMode_);
end
function [rtn signalValue]= simxGetIntegerSignal(obj,clientID,signalName,operationMode)
signalName_ = libpointer('int8Ptr',[int8(signalName) 0]);
signalValue = libpointer('int32Ptr',int32(0));
operationMode_ = int32(operationMode);
[rtn signalName signalValue] = calllib(obj.libName,'simxGetIntegerSignal',clientID,signalName_,signalValue,operationMode_);
end
function [rtn matrix] = simxGetJointMatrix(obj,clientID,jointHandle,operationMode)
jointHandle_ = int32(jointHandle);
matrix = libpointer('singlePtr',single([0 0 0 0 0 0 0 0 0 0 0 0]));
operationMode_ = int32(operationMode);
[rtn matrix ] = calllib(obj.libName,'simxGetJointMatrix',clientID,jointHandle_,matrix, operationMode_);
end
function [rtn position] = simxGetJointPosition(obj,clientID,handle,option)
handle_ = int32(handle);
option_ = int32(option);
[rtn position] = calllib(obj.libName,'simxGetJointPosition',clientID,handle_,single(43),option_);
end
function rtn = simxGetLastCmdTime(obj,clientID)
rtn = calllib(obj.libName,'simxGetLastCmdTime',clientID);
end
function [rtn errorStrings]= simxGetLastErrors(obj,clientID,operationMode)
errorCnt = libpointer('int32Ptr',int32(0));
errorStrings_ = libpointer('int8PtrPtr');
operationMode_ = int32(operationMode);
[rtn errorCnt errorStrings_ ] = calllib(obj.libName,'simxGetLastErrors',clientID,errorCnt,errorStrings_,operationMode_);
if (rtn==0)
errorStrings = cell(double(errorCnt));
s=1;
for i=1:errorCnt
begin = s;
errorStrings_.setdatatype('int8Ptr',1,s);
value = errorStrings_.value(s);
while(value ~= 0)
errorStrings_.setdatatype('int8Ptr',1,s);
value = errorStrings_.value(s);
s=s+1;
end
tmp = errorStrings_.value(begin:s-1);
errorStrings(i) = cellstr(char(tmp));
end
else
errorStrings=[];
end
end
function [rtn prop] = simxGetModelProperty(obj,clientID,objectHandle,operationMode)
objectHandle_ = int32(objectHandle);
operationMode_ = int32(operationMode);
prop = libpointer('int32Ptr',int32(0));
[rtn prop ] = calllib(obj.libName,'simxGetModelProperty',clientID,objectHandle_,prop,operationMode_);
end
function [rtn childObjectHandle] = simxGetObjectChild(obj,clientID,parentObjectHandle,childIndex,operationMode)
parentObjectHandle_ = int32(parentObjectHandle);
childIndex_ = int32(childIndex);
childObjectHandle = libpointer('int32Ptr',int32(0));
operationMode_ = int32(operationMode);
[rtn childObjectHandle ] = calllib(obj.libName,'simxGetObjectChild',clientID,parentObjectHandle_,childIndex_,childObjectHandle,operationMode_);
end
function [rtn paramValue]= simxGetObjectFloatParameter(obj,clientID,objectHandle,parameterID,operationMode)
objectHandle_ = int32(objectHandle);
parameterID_ = int32(parameterID);
operationMode_ = int32(operationMode);
paramValue = libpointer('singlePtr',single(0));
[rtn paramValue] = calllib(obj.libName,'simxGetObjectFloatParameter',clientID,objectHandle_,parameterID_,paramValue,operationMode_);
end
function [rtn handle] = simxGetObjectHandle(obj,clientID,name,operationmode)
name_ptr = libpointer('int8Ptr',[uint8(name) 0]);
handle_ptr = libpointer('int32Ptr',int32(0));
operationmode_ = int32(operationmode);
[rtn name_ptr handle] = calllib(obj.libName,'simxGetObjectHandle',clientID,name_ptr,handle_ptr,operationmode_);
end
function [rtn paramValue]= simxGetObjectIntParameter(obj,clientID,objectHandle,parameterID,operationMode)
objectHandle_ = int32(objectHandle);
parameterID_ = int32(parameterID);
operationMode_ = int32(operationMode);
paramValue = libpointer('int32Ptr',int32(0));
[rtn paramValue] = calllib(obj.libName,'simxGetObjectIntParameter',clientID,objectHandle_,parameterID_,paramValue,operationMode_);
end
function [rtn eulerAngles] = simxGetObjectOrientation(obj,clientID,objectHandle,relativeToObjectHandle,operationMode)
objectHandle_ = int32(objectHandle);
relativeToObjectHandle_ = int32(relativeToObjectHandle);
operationMode_ = int32(operationMode);
eulerAngles = libpointer('singlePtr', single([0 0 0]));
[rtn eulerAngles] = calllib(obj.libName,'simxGetObjectOrientation',clientID,objectHandle_,relativeToObjectHandle_,eulerAngles ,operationMode_);
end
function [rtn parentObjectHandle] = simxGetObjectParent(obj,clientID,objectHandle,operationMode)
objectHandle_ = int32(objectHandle);
parentObjectHandle = libpointer('int32Ptr',int32(0));
operationMode_ = int32(operationMode);
[rtn parentObjectHandle] = calllib(obj.libName,'simxGetObjectParent',clientID,objectHandle_,parentObjectHandle,operationMode);
end
function [rtn position] = simxGetObjectPosition(obj,clientID,objectHandle,relativeToObjectHandle,operationMode)
objectHandle_ = int32(objectHandle);
relativeToObjectHandle_ = int32(relativeToObjectHandle);
operationMode_ = int32(operationMode);
position = libpointer('singlePtr', single([0 0 0]));
[rtn position] = calllib(obj.libName,'simxGetObjectPosition',clientID,objectHandle_,relativeToObjectHandle_,position ,operationMode_);
end
function [rtn objectHandles] = simxGetObjects(obj,clientID,objectType,operationMode)
objectType_ = int32(objectType);
objectHandles_ = libpointer('int32PtrPtr');
objectCount = libpointer('int32Ptr',int32(0));
operationMode_ = int32(operationMode);
[rtn objectCount objectHandles_] = calllib(obj.libName,'simxGetObjects',clientID,objectType_,objectCount,objectHandles_,operationMode_);
if (rtn==0)
if(objectCount > 0 )
objectHandles_.setdatatype('int32Ptr',1,objectCount);