Skip to content

TypeError: MySensor: No constructor defined! #347

Answered by njroussel
JiangGuotai asked this question in Q&A
Discussion options

You must be logged in to vote

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 in src/render/python/sensor_v.cpp, we define a pybind11 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 for Sensor but for ProjectiveCamera.
Another approach would be to re-implement the ProjectiveCamera in Python, and then have your new Sensor inherit from that one instead.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by JiangGuotai
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants