0
$\begingroup$

Rosanswers logo

Hi all,

I'm trying to run simple ros2 node inside blender environment.

The node should render some scenario and publish the frames to a topic using cv_bridge.

I tried to source /opt/ros/foxy/setup.bash and build a workspace in the scripts folder before running blender. After that, execute the node's script from blender, but It can't find the ros2 python packages and fails to run simple publisher node.

Any ideas of how I can get it to work?

Thanks in advance, Iftach.


Originally posted by Iftahnaf on ROS Answers with karma: 23 on 2021-11-10

Post score: 0


Original comments

Comment by gvdhoorn on 2021-11-10:
ROS 2 is Python 3 only. You've tagged this python2.7, so that would appear not to work.

Comment by Iftahnaf on 2021-11-10:
Wrong tagget, my bad. The blender environment's python version is 3.9

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Ok so I manage to make this work, it's not pretty and I'm sure that this is a correct solution but:

copy the desired ros2 packages (rclpy, std_msgs etc..) to /path/to/blender/scripts/modules (i copied the whole ros2 package folder)

--- if your ros2 python env doesnt match the python version of blender ---

  • in each package edit the name of the .so file, for example, I work with python 3.8.10 and blender was with python 3.9.2 (2.93.5 version of blender) so the file: std_msgs_s__rosidl_typesupport_c.cpython-38-x86_64-linux-gnu.so inside std_msgs package was changed to std_msgs_s__rosidl_typesupport_c.cpython-39-x86_64-linux-gnu.so. probably you will have to debug it for few tries until you change everything in all the packages

Originally posted by Iftahnaf with karma: 23 on 2021-11-10

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.