My program can now run in singularity, but it always reports errors when running locally, including the lack of trifinger_object_tracking and trifinger_cameras, I have updated the supporting environment to the latest. How can I solve this problem?
With “locally”, I assume you mean to run the simulation without Singularity, is this correct?
If you are using
SimRearrangeDiceEnv, you should be able to get rid of the dependency on trifinger_cameras by moving the class to a separate file (i.e. separating it from
RealRobotRearrangeDiceEnv which depends on trifinger_cameras).
trifinger_object_tracking will be more complicated, as it provides the function
segment_images which is used for colour segmentation of the images also in simulation. If really needed, it should be possible to reimplement the segmentation in pure Python, all relevant code is in these two files.
However, if it is working with Singularity, why not just run it this way?
Thank you very much for your answer. I’m used to debugging my code with pycharm. Debugging in singularity is very slow because breakpoints cannot be added. Do you have any suggestions to better solve this problem?
I see, this is indeed difficult with Singularity. I typically add breakpoints via
ipdb.set_trace(), i.e. paste the following line in the code, where you want to break:
import ipdb; ipdb.set_trace()
This is probably not as convenient as using pycharm, though.
Unfortunately, I don’t see easy alternatives. You could try to reimplement the colour segmentation in pure Python as suggested above (to get rid of the dependencies) or try to setup/build the full workspace locally.
I don’t recommend the latter as it would be quite some effort but in case you want to try nonetheless, the steps are:
- Install dependencies: ROS Foxy and everything that is listed here. Note that it may only work on Ubuntu 20.04.
- Setup the workspace as described here (but use the branch
real_robot_challenge_2021of the treep_machines_in_motion repo).
- Add your own package to the workspace.
- Now you should be able to build the workspace (run
colcon buildin the root directory).
- You probably need to run PyCharm from a terminal where you sourced the install/setup.bash of the workspace first.
Thank you very much for your answer. It’s very helpful to me.