Closed dave992 closed 1 year ago
Try
tesseract_common.setLogLevel(tesseract_common.CONSOLE_BRIDGE_LOG_DEBUG)
```python import numpy as np from tesseract_robotics import tesseract_common from tesseract_robotics.tesseract_environment import Environment tesseract_common.setLogLevel(tesseract_common.CONSOLE_BRIDGE_LOG_DEBUG) joint_names = ["joint_a1", "joint_a2", "joint_a3", "joint_a4", "joint_a5", "joint_a6"] joint_position = np.array([-0.4, 0.2762, 0.0, -1.3348, 0.0, 1.4959, 0.0]) env = Environment() env.setState(joint_names, joint_position) ```
I have tried adding the line you recommended but still get the exact same Segmentation fault
message. No additional output is visible.
You need to call some variant of "init" before using environment. The best option is probably an empty vector of commands.
env = Environment() cmds = Commands() env.init(cmds)
I understand that I used it wrong. I would've expected to get a little more meaningful error in case the object is not initialized/ used as expected instead of just crashing the interpreter.
The SWIG wrappers have the exact same behavior as the C++ classes. These wrappers are intended for use by experts or as building blocks for higher level libraries.
Wrapper/low-level or not, this is a Python library. And even experts can make mistakes 😉
Sure, there is a need for a high level interface like tesseract_robotics_easy
or tesseract_robotics_commander
. These can be easily built on top of the low-level wrappers. Attempts to make the interfaces more friendly using SWIG have only resulted in unmanageable spaghetti code.
Instead of making every method check if the environment is initialized which can have a performance impact, the environment has a method to check if it has been initialized properly which is the developers responsibility to check before using the environment object. env.isInitialized()
;
When I used the
setState
method of a newly constructed Environment I encountered a segmentation fault.I am running Ubuntu 20.04 via WSL2 on Windows 11.
To reproduce the segmentation fault on my system:
Terminal output:
I understand that it does not make much sense to try to set the state of an empty environment, but I encountered this issue trying to recreate one of the C++ examples. Not having any meaningful error message in Python makes it hard to debug.