Giter Club home page Giter Club logo

flexbe_behavior_engine's People

Contributors

achllle avatar alireza-hosseini avatar aravindadp avatar benjw90 avatar cheffe112 avatar cjue avatar ckchow avatar dcconner avatar dorianscholz avatar fmauch avatar fmessmer avatar henroth avatar icemanx avatar jmz919 avatar joshz18 avatar ksm0709 avatar loyvanbeek avatar luator avatar mgruhler avatar philgit avatar pschillinger avatar romayiii avatar stefanfabian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flexbe_behavior_engine's Issues

ProxyServiceCaller call fails

When creating a simple state that calls the list_controllers service (and others) in Humble, I am getting a TypeError exception "Invalid request type ListControllers_Request (vs. ListControllers) for topic /controller_manager/list_controllers". Here is the example state code:

#!/usr/bin/env python
from flexbe_core import EventState, Logger
from flexbe_core.proxy import ProxyServiceCaller
from controller_manager_msgs.srv import ListControllers


class CheckControllerLoaded(EventState):
    '''
    Checks if a given controller is loaded.

    -- controller_name  str  name of controller to check.

    <= true     Controller is currently loaded.
    <= false    Controller is not loaded.
    '''

    def __init__(self, controller_name):
        super(CheckControllerLoaded, self).__init__(
            outcomes=['true', 'false'])
        ProxyServiceCaller._initialize(CheckControllerLoaded._node)

        self._controller_name = controller_name

        self._srv_topic = '/controller_manager/list_controllers'
        self._srv_result = None

        self._error = None

    def on_enter(self, userdata):
        # Try to call service to list controllers
        self._srv = ProxyServiceCaller(
            {self._srv_topic: ListControllers}, wait_duration=5.0)
        self._error = False
        try:
            request = ListControllers.Request()
            self._srv_result = self._srv.call(self._srv_topic, request)
        except Exception as e:
            Logger.logerr(f"Exception {str(e)}")
            self._error = True

    def execute(self, userdata):
        if (self._error) or (self._srv_result is None):
            return 'false'
        elif any(controller.name == self._controller_name for controller in self._srv_result.controller):
            return 'true'
        else:
            return 'false'

    def on_exit(self, userdata):
        pass

I was able to get it to work with these modifications universal-field-robots/flexbe_behavior_engine@b3228b2. I would have made a PR for it however I don't think this solution is in line with the intent of recent changes made in proxy_service_caller.py @ 345e65c

FlexibleCalculationState does not accept correct lambda expression

According to the help of the FlexibleCalculationState state, it requires a lambda function with a list argument (e.g., lambda x: x[0]^2 + x[1]^2) but that gives following error message:

python <lambda>() got an unexpected keyword argument

What works though is a lambda function with multiple arguments (e.g., lambda x1,x2: x1^2 + x2^2). However, the behavior cannot be saved because the checking function says:

Unable to save behavior: parameter calculation of state [...] has invalid value

My current workaround is to put any acceptable value in the calculation parameter field and put the correct, desired lambda function in the source code later. But this is quite tedious because it is always overwritten when the behavior is changed with the GUI.

ROS-Galactic

Unable to connect to ROS master in galactic. What could be the reason

Support specifying QOS profile for SubscriberState

Currently SubscriberState do not have a parameter for specifying QOS profile and use QOS_DEFAULT in underline subscriber. This prevents it from subscribing to topics with publishers using QoSReliabilityPolicy.BEST_EFFORT

If this is a welcome enhancement happy to open a PR with suggested enhancement.

Delay available in behaviour_launcher_main before Setting up behavior_launcher is not enough

Time delay loop available at https://github.com/FlexBE/flexbe_behavior_engine/blob/iron/flexbe_widget/flexbe_widget/behavior_launcher.py#L266 is not enough to give time to _status_callback to get called. So trying to launch behaviors with following command fails. (With ros2 launch flexbe_onboard behavior_onboard.launch.py already called in a seperate terminal)

rosrun flexbe_widget be_launcher -b 'Example Behavior'

[INFO] [1716011288.849518090] [flexbe_widget]: 1 behaviors available, ready for start request.
Set up behavior_launcher with 'Example Behavior' ...
Add callback request for 'Example Behavior' ...
Run initial request of behavior_launcher spinner ...
[ERROR] [1716011288.974051574] [flexbe_widget]: Behavior engine is not ready - cannot process start request!
[INFO] [1716011288.974993184] [flexbe_widget]: Initial behavior launcher request is sent!
Start behavior_launcher spinner ...
[INFO] [1716011297.819500334] [flexbe_widget]: BE status code=20 received - READY for new behavior!

Increasing time delay to 0.02 or more (So total delay is 2s or more for loop of 100) seems to resolve the issue. (Or best is to wait till _ready_event.is_set() or a max time out of 5sec.)

[INFO] [1716012112.849948804] [flexbe_widget]: 1 behaviors available, ready for start request.
Set up behavior_launcher with 'Example Behavior' ...
[INFO] [1716012113.442451071] [flexbe_widget]: BE status code=20 received - READY for new behavior!
Add callback request for 'Example Behavior' ...
Run initial request of behavior_launcher spinner ...
[INFO] [1716012114.903119699] [flexbe_widget]: Got message from request behavior for Example Behavior
[INFO] [1716012114.903953843] [flexbe_widget]: Processing request using behavior 'Example Behavior' from package='example_flexbe_behaviors' with key=1205735444 ...
[INFO] [1716012114.905562292] [flexbe_widget]: Check for behavior change ...
[INFO] [1716012114.906543963] [flexbe_widget]: No changes to behavior version - restart
[INFO] [1716012114.907227931] [flexbe_widget]: Initial behavior launcher request is sent!
Start behavior_launcher spinner ...
``

AttributeError: module 'rclpy.signals' has no attribute 'SignalHandlerOptions'

Hello,

I am using ros2-devel branch for Galactic. The command ros2 launch flexbe_onboard behavior_onboard.launch.py use_sim_time:=False raises the error below:

[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [start_behavior-1]: process started with pid [1000498]
[start_behavior-1] Traceback (most recent call last):
[start_behavior-1]   File "/home/zeid/ariac_eval_ws/install/flexbe_onboard/lib/flexbe_onboard/start_behavior", line 33, in <module>
[start_behavior-1]     sys.exit(load_entry_point('flexbe-onboard==2.3.2', 'console_scripts', 'start_behavior')())
[start_behavior-1]   File "/home/zeid/ariac_eval_ws/install/flexbe_onboard/lib/python3.8/site-packages/flexbe_onboard/start_behavior.py", line 43, in main
[start_behavior-1]     signal_handler_options=rclpy.signals.SignalHandlerOptions.NO)  # We will handle shutdown
[start_behavior-1] AttributeError: module 'rclpy.signals' has no attribute 'SignalHandlerOptions'

This is due to signal_handler_options not being recognized in the following snippet.

rclpy.init(args=args, signal_handler_options=rclpy.signals.SignalHandlerOptions.NO)

some ROS 2 states are still using ROS 1 actions

The InputState state:

from flexbe_msgs.msg import BehaviorInputAction, BehaviorInputGoal, BehaviorInputResult

and BehaviorInput:
from flexbe_msgs.msg import BehaviorInputAction, BehaviorInputFeedback, BehaviorInputResult, BehaviorInputGoal

are still using the ROS 1 action. This should probably be from flexbe_msgs.action import BehaviorInput. And other usages of BehaviorInputAction should be replaced with BehaviorInput.

flexbe_mirror setup.py lists unnecessary console scripts

Hi,

I am investigating a build failure that we are seeing in building flexbe_mirror when building ROS 2 for OpenEmbedded / Yocto Project: ros/meta-ros#1077

I used the official ROS2 container images to investigate how the flexbe_mirror and mirror_state console scripts behave normally. When I tried to run the scripts directly it seems like the entry point may not be set properly:

/opt/ros/humble/lib/flexbe_mirror/flexbe_mirror
Traceback (most recent call last):
File "/opt/ros/humble/lib/flexbe_mirror/flexbe_mirror", line 33, in <module>
sys.exit(load_entry_point('flexbe-mirror==2.3.3', 'console_scripts', 'flexbe_mirror')())
TypeError: 'module' object is not callable

I could be mistaken, but I believe that [lines 25 and 26 of the setup.py for flexbe_mirror and mirror_state may be unnecessary as "behavior_mirror_sm" seems to use the FlexbeMirror and MirrorState classes and the other scripts do not have a main() entry point.

Cheers,
Rob

ActionClientProxy can't query goal status

I am able to set up, issue goals through, and get a result from an action client via the ActionClientProxy, but when I attempt to get the goal status I see 'ActionClient' object has no attribute 'status'.

I can instead capture the result of the action through get_result() and do some error checking on that, but is there a way to check the goal status in an action-agnostic sense?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.