@@ -290,7 +290,10 @@ namespace yarp {
290
290
namespace os {
291
291
typedef int NetInt32;
292
292
}
293
- }
293
+ }
294
+
295
+ // Define macros for handling the multiple analog sensors interfaces
296
+ %include macrosForMultipleAnalogSensors.i
294
297
295
298
// We skip macros from Vocab.h via SWIG_PREPROCESSOR_SHOULD_SKIP_THIS directive
296
299
// But cannot define YARP_OS_VOCAB_H as we would miss encode/decode
@@ -453,12 +456,13 @@ MAKE_COMMS(Bottle)
453
456
%template (DVector) std::vector<double >;
454
457
%template (BVector) std::vector<bool >;
455
458
%template (SVector) std::vector<std::string>;
456
- #ifdef SWIGMATLAB
457
- // Extend IVector for handling conversion of vectors from and to Matlab
458
- %include " matlab/IVector_fromTo_matlab.i"
459
- #endif
460
459
%template (IVector) std::vector<int >;
461
460
461
+ #ifdef SWIGMATLAB
462
+ // Extend IVector for handling conversion of vectors from and to Matlab
463
+ %include " matlab/IVector_fromTo_matlab.i"
464
+ #endif
465
+
462
466
#if defined(SWIGCSHARP)
463
467
SWIG_STD_VECTOR_SPECIALIZE_MINIMUM (Pid,yarp::dev::Pid)
464
468
#endif
@@ -723,84 +727,30 @@ typedef yarp::os::BufferedPort<ImageRgbFloat> BufferedPortImageRgbFloat;
723
727
// ////////////////////////////////////////////////////////////////////////
724
728
// Deal with PolyDriver idiom that doesn't translate too well
725
729
726
- %extend yarp::dev::PolyDriver {
727
- yarp::dev::IFrameGrabberImage * viewFrameGrabberImage () {
728
- yarp::dev::IFrameGrabberImage *result;
730
+ %define CAST_POLYDRIVER_TO_INTERFACE (interface)
731
+ yarp::dev:: ## interface *view ## interface ## () {
732
+ yarp::dev:: ## interface *result;
729
733
self->view (result);
730
734
return result;
731
735
}
736
+ %enddef
732
737
733
- yarp::dev::IPositionControl *viewIPositionControl () {
734
- yarp::dev::IPositionControl *result;
735
- self->view (result);
736
- return result;
737
- }
738
-
739
- yarp::dev::IVelocityControl *viewIVelocityControl () {
740
- yarp::dev::IVelocityControl *result;
741
- self->view (result);
742
- return result;
743
- }
744
-
745
- yarp::dev::IEncoders *viewIEncoders () {
746
- yarp::dev::IEncoders *result;
747
- self->view (result);
748
- return result;
749
- }
750
-
751
- yarp::dev::IMotorEncoders *viewIMotorEncoders () {
752
- yarp::dev::IMotorEncoders *result;
753
- self->view (result);
754
- return result;
755
- }
756
-
757
- yarp::dev::IPidControl *viewIPidControl () {
758
- yarp::dev::IPidControl *result;
759
- self->view (result);
760
- return result;
761
- }
762
-
763
- yarp::dev::IAmplifierControl *viewIAmplifierControl () {
764
- yarp::dev::IAmplifierControl *result;
765
- self->view (result);
766
- return result;
767
- }
768
-
769
- yarp::dev::IControlLimits *viewIControlLimits () {
770
- yarp::dev::IControlLimits *result;
771
- self->view (result);
772
- return result;
773
- }
774
-
775
- yarp::dev::ICartesianControl *viewICartesianControl () {
776
- yarp::dev::ICartesianControl *result;
777
- self->view (result);
778
- return result;
779
- }
780
-
781
- yarp::dev::IGazeControl *viewIGazeControl () {
782
- yarp::dev::IGazeControl *result;
783
- self->view (result);
784
- return result;
785
- }
786
-
787
- yarp::dev::IImpedanceControl *viewIImpedanceControl () {
788
- yarp::dev::IImpedanceControl *result;
789
- self->view (result);
790
- return result;
791
- }
738
+ %extend yarp::dev::PolyDriver {
792
739
793
- yarp::dev::ITorqueControl *viewITorqueControl () {
794
- yarp::dev::ITorqueControl *result;
795
- self->view (result);
796
- return result;
797
- }
740
+ CAST_POLYDRIVER_TO_INTERFACE (IFrameGrabberImage)
741
+ CAST_POLYDRIVER_TO_INTERFACE (IPositionControl)
742
+ CAST_POLYDRIVER_TO_INTERFACE (IVelocityControl)
743
+ CAST_POLYDRIVER_TO_INTERFACE (IEncoders)
744
+ CAST_POLYDRIVER_TO_INTERFACE (IMotorEncoders)
745
+ CAST_POLYDRIVER_TO_INTERFACE (IPidControl)
746
+ CAST_POLYDRIVER_TO_INTERFACE (IAmplifierControl)
747
+ CAST_POLYDRIVER_TO_INTERFACE (IControlLimits)
748
+ CAST_POLYDRIVER_TO_INTERFACE (ICartesianControl)
749
+ CAST_POLYDRIVER_TO_INTERFACE (IGazeControl)
750
+ CAST_POLYDRIVER_TO_INTERFACE (IImpedanceControl)
751
+ CAST_POLYDRIVER_TO_INTERFACE (ITorqueControl)
752
+ CAST_POLYDRIVER_TO_INTERFACE (IControlMode)
798
753
799
- yarp::dev::IControlMode *viewIControlMode () {
800
- yarp::dev::IControlMode *result;
801
- self->view (result);
802
- return result;
803
- }
804
754
#ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
805
755
yarp::dev::IControlMode *viewIControlMode2 () {
806
756
yarp::dev::IControlMode *result;
@@ -809,114 +759,32 @@ typedef yarp::os::BufferedPort<ImageRgbFloat> BufferedPortImageRgbFloat;
809
759
}
810
760
#endif
811
761
812
- yarp::dev::IInteractionMode *viewIInteractionMode () {
813
- yarp::dev::IInteractionMode *result;
814
- self->view (result);
815
- return result;
816
- }
817
-
818
- yarp::dev::IPWMControl *viewIPWMControl () {
819
- yarp::dev::IPWMControl *result;
820
- self->view (result);
821
- return result;
822
- }
823
-
824
- yarp::dev::ICurrentControl *viewICurrentControl () {
825
- yarp::dev::ICurrentControl *result;
826
- self->view (result);
827
- return result;
828
- }
762
+ CAST_POLYDRIVER_TO_INTERFACE (IInteractionMode)
763
+ CAST_POLYDRIVER_TO_INTERFACE (IPWMControl)
764
+ CAST_POLYDRIVER_TO_INTERFACE (ICurrentControl)
765
+ CAST_POLYDRIVER_TO_INTERFACE (IAnalogSensor)
829
766
830
- yarp::dev::IAnalogSensor *viewIAnalogSensor () {
831
- yarp::dev::IAnalogSensor *result;
832
- self->view (result);
833
- return result;
834
- }
835
767
#ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
836
768
yarp::dev::IFrameGrabberControls *viewIFrameGrabberControls2 () {
837
769
yarp::dev::IFrameGrabberControls *result;
838
770
self->view (result);
839
771
return result;
840
772
}
841
773
#endif
842
- yarp::dev::IFrameGrabberControls *viewIFrameGrabberControls () {
843
- yarp::dev::IFrameGrabberControls *result;
844
- self->view (result);
845
- return result;
846
- }
847
-
848
- yarp::dev::IPositionDirect *viewIPositionDirect () {
849
- yarp::dev::IPositionDirect *result;
850
- self->view (result);
851
- return result;
852
- }
853
-
854
- yarp::dev::IRemoteVariables *viewIRemoteVariables () {
855
- yarp::dev::IRemoteVariables *result;
856
- self->view (result);
857
- return result;
858
- }
859
-
860
- yarp::dev::IAxisInfo *viewIAxisInfo () {
861
- yarp::dev::IAxisInfo *result;
862
- self->view (result);
863
- return result;
864
- }
865
-
866
- yarp::dev::IThreeAxisGyroscopes *viewIThreeAxisGyroscopes () {
867
- yarp::dev::IThreeAxisGyroscopes *result;
868
- self->view (result);
869
- return result;
870
- }
871
-
872
- yarp::dev::IThreeAxisLinearAccelerometers *viewIThreeAxisLinearAccelerometers () {
873
- yarp::dev::IThreeAxisLinearAccelerometers *result;
874
- self->view (result);
875
- return result;
876
- }
877
-
878
- yarp::dev::IThreeAxisMagnetometers *viewIThreeAxisMagnetometers () {
879
- yarp::dev::IThreeAxisMagnetometers *result;
880
- self->view (result);
881
- return result;
882
- }
883
-
884
- yarp::dev::IOrientationSensors *viewIOrientationSensors () {
885
- yarp::dev::IOrientationSensors *result;
886
- self->view (result);
887
- return result;
888
- }
889
-
890
- yarp::dev::ITemperatureSensors *viewITemperatureSensors () {
891
- yarp::dev::ITemperatureSensors *result;
892
- self->view (result);
893
- return result;
894
- }
895
-
896
- yarp::dev::ISixAxisForceTorqueSensors *viewISixAxisForceTorqueSensors () {
897
- yarp::dev::ISixAxisForceTorqueSensors *result;
898
- self->view (result);
899
- return result;
900
- }
901
-
902
- yarp::dev::IContactLoadCellArrays *viewIContactLoadCellArrays () {
903
- yarp::dev::IContactLoadCellArrays *result;
904
- self->view (result);
905
- return result;
906
- }
907
-
908
- yarp::dev::IEncoderArrays *viewIEncoderArrays () {
909
- yarp::dev::IEncoderArrays *result;
910
- self->view (result);
911
- return result;
912
- }
913
-
914
- yarp::dev::ISkinPatches *viewISkinPatches () {
915
- yarp::dev::ISkinPatches *result;
916
- self->view (result);
917
- return result;
918
- }
919
774
775
+ CAST_POLYDRIVER_TO_INTERFACE (IFrameGrabberControls)
776
+ CAST_POLYDRIVER_TO_INTERFACE (IPositionDirect)
777
+ CAST_POLYDRIVER_TO_INTERFACE (IRemoteVariables)
778
+ CAST_POLYDRIVER_TO_INTERFACE (IAxisInfo)
779
+ CAST_POLYDRIVER_TO_INTERFACE (IThreeAxisGyroscopes)
780
+ CAST_POLYDRIVER_TO_INTERFACE (IThreeAxisLinearAccelerometers)
781
+ CAST_POLYDRIVER_TO_INTERFACE (IThreeAxisMagnetometers)
782
+ CAST_POLYDRIVER_TO_INTERFACE (IOrientationSensors)
783
+ CAST_POLYDRIVER_TO_INTERFACE (ITemperatureSensors)
784
+ CAST_POLYDRIVER_TO_INTERFACE (ISixAxisForceTorqueSensors)
785
+ CAST_POLYDRIVER_TO_INTERFACE (IContactLoadCellArrays)
786
+ CAST_POLYDRIVER_TO_INTERFACE (IEncoderArrays)
787
+ CAST_POLYDRIVER_TO_INTERFACE (ISkinPatches)
920
788
// you'll need to add an entry for every interface you wish
921
789
// to use
922
790
}
@@ -1200,28 +1068,15 @@ typedef yarp::os::BufferedPort<ImageRgbFloat> BufferedPortImageRgbFloat;
1200
1068
}
1201
1069
}
1202
1070
1203
- %extend yarp::dev::IThreeAxisGyroscopes {
1204
- std::string getThreeAxisGyroscopeName (int sens_index) const {
1205
- std::string name;
1206
- bool ok = self->getThreeAxisGyroscopeName (sens_index,name);
1207
- if (!ok) return " unknown" ;
1208
- return name;
1209
- }
1210
-
1211
- std::string getThreeAxisGyroscopeFrameName (int sens_index) const {
1212
- std::string frameName;
1213
- bool ok = self->getThreeAxisGyroscopeFrameName (sens_index,frameName);
1214
- if (!ok) return " unknown" ;
1215
- return frameName;
1216
- }
1217
-
1218
- double getThreeAxisGyroscopeMeasure (int sens_index, yarp::sig::Vector& out) const {
1219
- double timestamp;
1220
- bool ok = self->getThreeAxisGyroscopeMeasure (sens_index, out, timestamp);
1221
- if (!ok) return -1 ;
1222
- return timestamp;
1223
- }
1224
- }
1071
+ %extend yarp::dev::IThreeAxisGyroscopes {EXTENDED_ANALOG_SENSOR_INTERFACE (ThreeAxisGyroscope)}
1072
+ %extend yarp::dev::IThreeAxisLinearAccelerometers {EXTENDED_ANALOG_SENSOR_INTERFACE (ThreeAxisLinearAccelerometer)}
1073
+ %extend yarp::dev::IThreeAxisMagnetometers {EXTENDED_ANALOG_SENSOR_INTERFACE (ThreeAxisMagnetometer)}
1074
+ %extend yarp::dev::IOrientationSensors {EXTENDED_ANALOG_SENSOR_INTERFACE (OrientationSensor)}
1075
+ %extend yarp::dev::ITemperatureSensors {EXTENDED_ANALOG_SENSOR_INTERFACE (TemperatureSensor)}
1076
+ %extend yarp::dev::ISixAxisForceTorqueSensors {EXTENDED_ANALOG_SENSOR_INTERFACE (SixAxisForceTorqueSensor)}
1077
+ %extend yarp::dev::IContactLoadCellArrays {EXTENDED_ANALOG_SENSOR_INTERFACE (ContactLoadCellArray)}
1078
+ %extend yarp::dev::IEncoderArrays {EXTENDED_ANALOG_SENSOR_INTERFACE (EncoderArray)}
1079
+ %extend yarp::dev::ISkinPatches {EXTENDED_ANALOG_SENSOR_INTERFACE (SkinPatch)}
1225
1080
1226
1081
%extend yarp::sig::Vector {
1227
1082
0 commit comments