sea-bass / turtlebot3_behavior_demos

Example repository for autonomous behaviors using TurtleBot3, as well as Docker workflows in ROS based projects.
MIT License
270 stars 53 forks source link

TypeError: setup() got an unexpected keyword argument 'node' #8

Closed ichdich closed 1 year ago

ichdich commented 1 year ago

Hello, I've encountered an error below. I've modified a line in autonomy_node.py line 112 and successfully run the demo. tree.setup(timeout=15.0, node=self) -> tree.setup(timeout=15.0)

[autonomy_node.py-1] Traceback (most recent call last): [autonomy_node.py-1] File "/home/ubuntu/host/share/bt_ws/install/tb3_autonomy/lib/tb3_autonomy/autonomy_node.py", line 133, in [autonomy_node.py-1] behavior = AutonomyBehavior() [autonomy_node.py-1] File "/home/ubuntu/host/share/bt_ws/install/tb3_autonomy/lib/tb3_autonomy/autonomy_node.py", line 53, in init [autonomy_node.py-1] self.create_behavior_tree(self.tree_type) [autonomy_node.py-1] File "/home/ubuntu/host/share/bt_ws/install/tb3_autonomy/lib/tb3_autonomy/autonomy_node.py", line 64, in create_behavior_tree [autonomy_node.py-1] self.tree = self.create_queue_tree() [autonomy_node.py-1] File "/home/ubuntu/host/share/bt_ws/install/tb3_autonomy/lib/tb3_autonomy/autonomy_node.py", line 112, in create_queue_tree [autonomy_node.py-1] tree.setup(timeout=15.0, node=self) [autonomy_node.py-1] TypeError: setup() got an unexpected keyword argument 'node'

sea-bass commented 1 year ago

Hello -- thanks for bringing this up.

This extra node argument is something I added to my own personal fork of py_trees_ros at https://github.com/sea-bass/py_trees_ros -- you can learn more in this PR (https://github.com/splintered-reality/py_trees_ros/pull/182).

If you're not using Docker and have your own local workspace, ensure that you don't have py_trees_ros installed via pip or apt, and instead are using my fork above. Or, as you did, you can remove that node argument. In my case I found that it made the visualization and ticking of the ROS node not consistent, but if it works well on your end that's interesting...

ichdich commented 1 year ago

Thank you for your feedback. This is the environment I've tested.

I've located these two packages and turtlebot3_behavior_demos into bt_ws/src and then I've compiled with "colcon build --symlink-install" and then launched ros2 launch tb3_worlds tb3_demo_world.launch.py (before launch, export TURTLEBOT3_MODEL=waffle) and ros2 launch tb3_autonomy tb3_demo_behavior_py.launch.py I appreciate your work. It's very helpful for me to understand behavior trees.

sea-bass commented 1 year ago

Right -- can you change your py_trees_ros from the official source to https://github.com/sea-bass/py_trees_ros ? That should allow the example to work as is.