TypeError: MySensor: No constructor defined! #347
-
I wanna define a sensor class using template in python, but when I use the code:
there will be a error: No constructor defined! I can only use
but in C++, ProjectiveCamera is used as a parent class, so... what can i do to use ProjectiveCamera as a parent class in python? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The reason why it only works with If you wanted to define a Python class which derives from |
Beta Was this translation helpful? Give feedback.
-
ok, I am trying to re-implement the |
Beta Was this translation helpful? Give feedback.
The reason why it only works with
mi.Sensor
is that we only defined Python bindings on the top-level base classes for every plugin. This is done insrc/render/python/sensor_v.cpp
, we define apybind11
trampoline (more information).If you wanted to define a Python class which derives from
ProjcetiveCamera
. I believe you would need to add a similar trampoline to the existing one forSensor
but forProjectiveCamera
.Another approach would be to re-implement the
ProjectiveCamera
in Python, and then have your newSensor
inherit from that one instead.