Closed sebastianstock closed 1 year ago
It works if it is started directly from Python without rosrun (python nodes/uplexmo_pick_n_place_demo_node.py
)
I'm not 100% sure what's going on here, but I dimly remember that any Python code that you want to import should go into the src
folder. One node shouldn't import another node.
In the core ROS repos, they take this to the extreme. Usually almost all code is in the src
folder, and the nodes in the nodes
or scripts
folders only have a main that imports and runs the stuff from the src
folder. For example:
Good to know. Unfortunately, I encounter more and more cases in which Python behaves differently depending on how you do things. In this case, we'll refactor pick_n_place_demo_node.py
to pick_n_place_demo.py
in src
for most of the code and let both nodes import it, right? Just according to Martin's references. Will you do it, @sebastianstock?
Good to know. Unfortunately, I encounter more and more cases in which Python behaves differently depending on how you do things. In this case, we'll refactor
pick_n_place_demo_node.py
topick_n_place_demo.py
insrc
for most of the code and let both nodes import it, right? Just according to Martin's references. Will you do it, @sebastianstock?
Yes, that makes sense. I was thinking the same. Importing the pick_n_place_demo_node was not ideal in the first place. I can do that.
When starting the uplexmo demo in simulation (
rosrun tables_demo_planning uplexmo_pick_n_place_demo_node.py
) I get an ImportError forPickAndPlaceDomain
:This happens in a completely new ROS workspace that only used the install and build scripts to install.