splintered-reality / py_trees_ros Goto Github PK
View Code? Open in Web Editor NEWROS extensions and implementations for py_trees
License: Other
ROS extensions and implementations for py_trees
License: Other
Doesn't shutdown when the gui 'x' is clicked.
py_trees_ros
as much as possibleWhen running an Behavior of type ActionClient it always prints the goal that was send because of this line:
https://github.com/stonier/py_trees_ros/blob/release/0.5-kinetic/py_trees_ros/actions.py#L92
To me, it would be desirable to disable this print out. I pollutes my console a bit.
If you agree, I could provide a pull request with a fix. I'd use a call such as self.logger.debug("{}".format(self.action_goal))
. Also, to which branch would you like to receive such a pull request?
Presently, launch node name renaming is not possible via ros2 launch, so this enforces the decision to bundle everything into one node.
PROS:
CONS:
**kwargs
hack in setupI'd like to revert to having behaviours take in node_name
and namespace
on init and construct their nodes themselves (supposing the overhead of nodes isn't large itself).
Given that it is so much more critical in ROS2 than ROS1, it is probably worth forcing the user to think about it.
Reproduce:
shell one $ ros2 launch py_trees_ros mock-robot.launch.py
shell two $ ros2 topic pub /led_strip/command std_msgs/String "data: 'blue'"
shell one $ ctrl-c
Workarounds:
ros2 run
Should be feasible to put them there as you should not need all the dependencies to build docs.
doc-requirements.txt
and point rtd at that for installing sphinx and other sphinx modules.autodoc_mock_imports
for any imports that aren't available at build timeGet the ros package to link to core package references.
py_trees
is released for melodic but py_trees_ros
, py_trees_msgs
and rqt_py_trees
are not.
I tried to create a workspace with these four and rosdep failed to find the python-termcolor
package. This definition was added and now it resolves correctly. Packages compile but I have not run any tests.
I was wondering what is the roadmap for these packages to be released in melodic. We could do a checklist and split resources ๐
Action Client Behaviour
Tests
This would reconfigure this package into the more natural py_trees.ros.*
namespace.
Currently have the appropriate (?) node.destroy_publisher()
call in BlackboardView.shutdown()
commented out which induces the spawning without end of blackboard publishers.
If I don't have it commented though, subsequent executions of the blackboard watcher frequently create a subscriber that fails to have it's callbacks triggered. Note: frequently, not all the time.
Tested against rclpy 0.6.4
(crystal).
Simple kobuki gazebo demo just for demonstration that it works with a robot. Doesn't need to be as complex as the mock.
When installing the py_trees suite from the ROS repo and going through the tutorials I get the error:
ERROR: cannot launch node of type [py_trees_ros/mock_safety_sensors]: can't locate node [mock_safety_sensors] in package [py_trees_ros]
Fixed by #25 . Until pushed to the ROS repo the script can be manually put in:
/opt/ros/kinetic/lib/py_trees_ros
and give it execution permission
When ros-kinetic-py-trees-ros is installed through apt on Ubuntu 16.04 with ROS kinetic, the installed versions of py-trees and py-trees-ros do not match. py-trees is v0.5.10 and py-trees-ros is v0.5.17. This leads to decorators being unavailable in py-trees (They seem to have been added on 0.5.11?).
Everything just throws 'module' object has no attribute 'decorators'
from py_trees_ros/conversions.py
line 49. The line is: elif isinstance(behaviour, py_trees.decorators.Decorator):
.
I checked the install directory and indeed the file decorators
does not exist.
Such a common pattern for ROS behaviours.
Previous discussion in py_trees#18
Is there a way to feed the initialise_variables
with the rosmsg instance?
for example:
pose_to_blackboard = ToBlackboard(topic_name="pose",
topic_type=geometry_msgs.msg.Pose,
blackboard_variables = {'pose': None},
initialise_variables=geometry_msgs.msg.Pose()
)
As I understand, we can supply a python dict which means initializing with dummy data would require rosmsg -> python dict conversion.
A page dedicated to just list up all the behaviours available in this package.
Really ought to have put them on the same release/0.5.x
branch back when. They now seem to have gotten out of sync (I'd stopped working on kinetic, but turns out there are quite a few users still).
After updating last binary package in melodic (0.5.16-0bionic.20190204.215333), py_trees_ros seems broken. All my applications give me the same error: AttributeError: 'module' object has no attribute 'decorators'
Even the first tutorial, here is the console output:
Traceback (most recent call last):
File "/opt/ros/melodic/lib/py_trees_ros/tutorial_tree", line 44, in
main_itself()
File "/opt/ros/melodic/lib/python2.7/dist-packages/py_trees_ros/tutorials/one.py", line 139, in main
behaviour_tree.tick_tock(500)
File "/opt/ros/melodic/lib/python2.7/dist-packages/py_trees/trees.py", line 259, in tick_tock
self.tick(pre_tick_handler, post_tick_handler)
File "/opt/ros/melodic/lib/python2.7/dist-packages/py_trees/trees.py", line 233, in tick
node.visit(visitor)
File "/opt/ros/melodic/lib/python2.7/dist-packages/py_trees/behaviour.py", line 220, in visit
visitor.run(self)
File "/opt/ros/melodic/lib/python2.7/dist-packages/py_trees_ros/visitors.py", line 108, in run
self.tree.behaviours.append(conversions.behaviour_to_msg(behaviour))
File "/opt/ros/melodic/lib/python2.7/dist-packages/py_trees_ros/conversions.py", line 122, in behaviour_to_msg
msg.type = behaviour_type_to_msg_constant(behaviour)
File "/opt/ros/melodic/lib/python2.7/dist-packages/py_trees_ros/conversions.py", line 49, in behaviour_type_to_msg_constant
elif isinstance(behaviour, py_trees.decorators.Decorator):
AttributeError: 'module' object has no attribute 'decorators'
[tree-10] process has died [pid 23311, exit code 1, cmd /opt/ros/melodic/lib/py_trees_ros/tutorial_tree one __name:=tree __log:=/home/**/.ros/log/6fd2029c-2f8c-11e9-949f-f0d5bfb298e1/tree-10.log].
I installed the py_trees suit from the ROS repository and when performing the tutorial 3 I get this error when executing any of the py-trees-blackboard-watcher related commands.
$ py-trees-blackboard-watcher --list-variables
Traceback (most recent call last):
File "/opt/ros/kinetic/bin/py-trees-blackboard-watcher", line 23, in <module>
py_trees_ros.programs.blackboard_watcher.main()
File "/opt/ros/kinetic/lib/python2.7/dist-packages/py_trees_ros/programs/blackboard_watcher.py", line 222, in main
handle_args(args)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/py_trees_ros/programs/blackboard_watcher.py", line 167, in handle_args
list_variables_service_name = find_service(args.namespace, 'py_trees_msgs/GetBlackboardVariables')
File "/opt/ros/kinetic/lib/python2.7/dist-packages/py_trees_ros/programs/blackboard_watcher.py", line 142, in find_service
service_name = rosservice.rosservice_find(service_type)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosservice/__init__.py", line 325, in rosservice_find
t = get_service_type(s)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosservice/__init__.py", line 147, in get_service_type
return get_service_headers(service_name, service_uri).get('type', None)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosservice/__init__.py", line 126, in get_service_headers
raise ROSServiceIOException("Unable to communicate with service [%s], address [%s]"%(service_name, service_uri))
rosservice.ROSServiceIOException: Unable to communicate with service [/rqt_gui_py_node_26372/get_loggers], address [rosrpc://spaghetti-monster-machine:42717]
The spaguetti-monster-machine is a fictional machine name that tries to boost performance by using the same sense of humor ๐
I try to install the py_trees_ros package and when I catkin_make it, it is showng error.
it is telling pytree ros is a non catkin package.
how can I use this package in ros melodic ??
Both are currently stubs.
Hi,
Still pretty new to py_trees, I am experimenting with ROS and I don't understand why Timers are not working after a failing action inside a selector. But are working after other type of failing behavior.
I have reproduced the problem with a modified version tutorial 5.
Below inside a selector with an always failing behavior, it is working as expected:
But with an always failing action client behavior, the timer is not working as expected:
Here is the modifed tutorial 5 code:
def create_root():
# behaviours
root = py_trees.composites.Parallel("Tutorial")
topics2bb = py_trees.composites.Sequence("Topics2BB")
scan2bb = py_trees_ros.subscribers.EventToBlackboard(
name="Scan2BB",
topic_name="/dashboard/scan",
variable_name="event_scan_button"
)
battery2bb = py_trees_ros.battery.ToBlackboard(name="Battery2BB",
topic_name="/battery/state",
threshold=30.0
)
priorities = py_trees.composites.Selector("Priorities")
battery_check = py_trees.meta.success_is_failure(py_trees.composites.Selector)(name="Battery Emergency")
is_battery_ok = py_trees.blackboard.CheckBlackboardVariable(
name="Battery Ok?",
variable_name='battery_low_warning',
expected_value=False
)
flash_led_strip = py_trees_ros.tutorials.behaviours.FlashLedStrip(
name="Flash Red",
colour="red")
scan = py_trees.composites.Sequence(name="Scan")
is_scan_requested = py_trees.blackboard.CheckBlackboardVariable(
name="Scan?",
variable_name='event_scan_button',
expected_value=True
)
scan_preempt = py_trees.composites.Selector(name="Preempt?")
is_scan_requested_two = py_trees.meta.success_is_running(py_trees.blackboard.CheckBlackboardVariable)(
name="Scan?",
variable_name='event_scan_button',
expected_value=True
)
scanning = py_trees.composites.Parallel(name="Scanning", policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
test_timer = py_trees.composites.Selector("Test Timer")
wait_5_secs = py_trees.timers.Timer(name="Wait5secs", duration=5.0)
wait_5_secs2 = py_trees.timers.Timer(name="Wait5secs2", duration=5.0)
#make the action client return failure for tests
scan_rotate = py_trees.meta.success_is_failure(py_trees_ros.actions.ActionClient)(
name="Rotate (always failing)",
action_namespace="/rotate",
action_spec=py_trees_msgs.RotateAction,
action_goal=py_trees_msgs.RotateGoal(),
override_feedback_message_on_running="rotating"
)
#failing behavior for alternative test
failure = py_trees.behaviours.Failure(name="Failing behavior (not action)")
scan_flash_blue = py_trees_ros.tutorials.behaviours.FlashLedStrip(name="Flash Blue", colour="blue")
scan_celebrate = py_trees.composites.Parallel(name="Celebrate", policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
scan_flash_green = py_trees_ros.tutorials.behaviours.FlashLedStrip(name="Flash Green", colour="green")
scan_pause = py_trees.timers.Timer("Pause", duration=3.0)
idle = py_trees.behaviours.Running(name="Idle")
# tree
root.add_children([topics2bb, priorities])
topics2bb.add_children([scan2bb, battery2bb])
priorities.add_children([battery_check, scan, idle])
battery_check.add_children([is_battery_ok, flash_led_strip])
scan.add_children([is_scan_requested, scan_preempt, scan_celebrate])
scan_preempt.add_children([is_scan_requested_two, scanning])
scanning.add_children([test_timer, scan_flash_blue])
#With failing action, timer is not working
test_timer.add_children([scan_rotate,wait_5_secs,wait_5_secs2])
#Without action, working timer:
#test_timer.add_children([failure,wait_5_secs,wait_5_secs2])
scan_celebrate.add_children([scan_flash_green, scan_pause])
return root
Might be useful to put the devel branch under CircleCI, depending on how clever the build farm hooks are.
Ostensibly, I'd like to be able to trigger the build on a PR for any of the py_trees_ros*
repositories alongside devel
or an equivalently named PR branch for py_trees
, py_trees_ros_interfaces
, py_trees_ros
and py_trees_ros_tutorials
.
06:59:37 [ROSTEST]-----------------------------------------------------------------------
06:59:37
06:59:37 [py_trees_ros.rosunit-test_subscriber_check/test_tick_tock][ERROR]--------------
06:59:37 unorderable types: Status() < int()
06:59:37 File "/usr/lib/python2.7/unittest/case.py", line 329, in run
06:59:37 testMethod()
06:59:37 File "/tmp/catkin_workspace/src/py_trees_ros/tests/rostests/subscriber_check/test_subscriber_check.py", line 101, in test_tick_tock
06:59:37 self.runner.tick_tock(number_of_iterations=50)
06:59:37 File "/tmp/catkin_workspace/src/py_trees_ros/tests/rostests/subscriber_check/test_subscriber_check.py", line 72, in tick_tock
06:59:37 while not rospy.is_shutdown() and self.root.status < number_of_iterations:
06:59:37 File "/usr/lib/python2.7/dist-packages/enum/__init__.py", line 719, in __lt__
06:59:37 raise TypeError("unorderable types: %s() < %s()" % (self.__class__.__name__, other.__class__.__name__))
Reproduce:
Note, package.xml is symlinked, python files are not.
$ make all
$ ls -l install/py_trees_ros/share/py_trees_ros
$ ls -l install/py_trees_ros/share/py_trees_ros/launch
Workaround:
launch/<name>.launch.py
fileHalf the tutorials are just plain absent.
Goals
Messages
BehaviourTree
Watcher
Behaviours
Proof of Life
battery_state
instead of battery/state
)Out of Scope
That matter...
See also the question list at snorriheim.atlassian.net/rclpy
resolved_name
in rclpy classes, remove py_trees_ros
workaroundsros2 topic echo
(ros2/ros2cli#154)@stonier Would it be a good idea to have services.py
similar to actions.py
? could be good as a reference.
A common pattern is to shoot off a service request. Probably need to handle:
Tip showing at 'Ere we go' instead of 'Pause'
[||] Tutorial Seven [*]
[-] Topics2BB [o]
--> Scan2BB [o]
--> Cancel2BB [o]
--> Battery2BB [o] -- Battery level is ok
[o] Tasks [*]
-^- Battery Low? [x]
--> Flash Red
[-] Scan [*]
--> Scan?
[o] Scan or Die [*]
[-] Ere we Go [*]
--> UnDock
[o] Scan or Be Cancelled
[-] Cancelling?
--> Cancel?
--> Move Home
--> Result2BB 'cancelled'
[-] Move Out and Scan
--> Move Out
[||] Scanning
--> Context Switch
--> Rotate
--> Flash Blue
--> Move Home
--> Result2BB 'succeeded'
--> Dock [o] -- successfully completed
[||] Celebrate [*]
--> Flash Green [*] -- flashing green
--> Pause [*] -- still running
[-] Die
[||] Notification
--> Flash Red
--> Pause
--> Result2BB 'failed'
--> Send Result
--> Idle
Right now, I'm adopting the following convention:
node_name
and namespace
in via __init__()
rclpy.create_node(node_name=..., namespace=..., ...)
in setup()
There is a constraint to this though - it assumes that all behaviour nodes run off the default context. Is there ever a situation in which someone would want to specify the context as well?
If so, then we'd need to pass in the node
itself via setup()
. This would require py_trees
change to setup()
so that it could take in an arbitrary dictionary of arguments that behaviours could cherrypick from.
update()
in ActionServer
has an assumption that result
will have message
field on preemption py_trees_ros/actions.py#99. This will crash with any action, such as move_base
not having result with mesage field.
This ofcourse can be solved by subclassing the update()
but it would be better to not having to.
node.get_node_names()
)?This is the argument passed in when creating a node (rclpy.node.Node('exchange')
).
~
from rospy
)?This issue may be root caused and end up at py_trees_ros_js instead.
Whatever the case, the snapshot message looks like it is being populated in a way that causes the timeline on the viewer to be broken.
G'day.
Would it be a good idea to have a subscriber
behaviour which returns success
instead of running
whether a message is received or not. I use meta.running_is_success
to deal with non-frequent topics.
I checked the subscribers.Event
does similar to intended case but it takes std_msgs.Empty
. One way of it would be to make it more general.
What are your thoughts on this @stonier
Get the fundamentals up and running:
Infra
PyTrees ROS
3rd Party
unique_identifier_msgs
: dependency for colconHello,
I am completely new at py_tree_ros and I just started following the tutorials. I am under Melodic and when executing the first tutorial, the output of rostopic echo /tree/blackboard seems badly formatted:
data: "\e[32mBlackboard\n\e[0m\e[36m battery \e[0m:\n\e[33m header: \n\e\
[0m\e[33m seq: 12173\n\e[0m\e[33m stamp: \n\e[0m\e[33m secs: 1546607831\n\
\e[0m\e[33m nsecs: 515712022\n\e[0m\e[33m frame_id: ''\n\e[0m\e[33m\
\ voltage: nan\n\e[0m\e[33m current: nan\n\e[0m\e[33m charge: nan\n\e[0m\e\
[33m capacity: nan\n\e[0m\e[33m design_capacity: nan\n\e[0m\e[33m percentage:\
\ 0.0\n\e[0m\e[33m power_supply_status: 2\n\e[0m\e[33m power_supply_health:\
\ 1\n\e[0m\e[33m power_supply_technology: 2\n\e[0m\e[33m present: True\n\e\
[0m\e[33m cell_voltage: []\n\e[0m\e[33m location: ''\n\e[0m\e[33m serial_number:\
\ ''\n\e[0m\e[36m battery_low_warning \e[0m: \e[33mTrue\n\e[0m\e[0m"
Additionally I had to pip install pygraphviz and in order to start the first tutorial.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.