Open rohanpsingh opened 2 years ago
Hi Rohan,
Is it possible to implement a RobotModule in Python?
No but it isn't impossible to implement either.
Still, I would like to know how it could be done.
You need two pieces:
RobotModule
C++ object, we already have this in the bindings (ref) but the implementation does not allow you to overwrite every member in RobotModule
RobotModule
does not implement any behavior I think the simplest approach is to have a Python
module similar to the Python
controller but it will just instantiate a Python RobotModule
object so that you can extract the C++ RobotModule
from inside.You would use the loader as such:
MainRobot: Python#my_module.MyRobot
Where MyRobot
is a Python class that derives from mc_rbdyn.RobotModule
that you instantiate in the Python
RobotModule (and then extract the C++ RobotModule from the object)
do you think it is a good idea?
I would avoid using the name from_xml_file
since it's a little too broad and you probably have a particular kind of XML model in mind (so e.g. from_mujoco_xml_file
?)
do you have any pointers?
Not really. The only thing the function has to do is return a rbd::parsers::ParserResult
and from there most of the work is done :)
Hi @rohanpsingh
Is this still an active topic for you?
Hi @gergondet Sorry I got involved with several other stuff recently so did not have time to work on this. I started implementing your suggestions above and ultimately want to get this done, but it's currently a low priority for me.
I have two questions:
Is it possible to implement a RobotModule in Python? In the tutorial, it shows a C++ example only, so I assume it's not straightforward to do so in Python. Still, I would like to know how it could be done.
I want to build a parser for XML models so I'd be able to something like
init(rbd::parsers::from_xml_file(xml_path))
while creating the robot module. A, do you think it is a good idea? and, B, do you have any pointers?