ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

schokkobaer's profile - activity

2022-10-12 04:51:38 -0500 marked best answer Flexbe unabel to reache action_server

I'currently trying to work with Flexbe and trying to include an action but I keep getting the following error:

[22:03:59] Behavior execution failed! [-]
Could not execute state 'turn' of type '': Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/smach/state_machine.py", line 247, in _update_once
    self._remappings[self._current_label]))
  File "/home/sil/us_ws/src/flexbe_behavior_engine/flexbe_core/src/flexbe_core/core/event_state.py", line 71, in _event_execute
    self.on_exit(*args, **kwargs)
  File "/home/sil/us_ws/src/husky_behaviors/husky_flexbe_states/src/husky_flexbe_states/turn_state.py", line 66, in on_exit
    if not self._client.has_result(self._server_name):
  File "/home/sil/us_ws/src/flexbe_behavior_engine/flexbe_core/src/flexbe_core/proxy/proxy_action_client.py", line 114, in has_result
    return ProxyActionClient._result[topic] is not None
KeyError: '/TurnHusky'

I checked that the the Action exists by looking at my currently available rostopics. They seem to be there. Are there any other possibilities why flexbe cannot find the action or why I get this error. The state that calls the action is as followed:

#!/usr/bin/env python
import rospy
import math

from action_tut.msg import turn_huskyAction, turn_huskyGoal, turn_huskyResult, turn_huskyFeedback
from flexbe_core import EventState, Logger

from flexbe_core.proxy import ProxyActionClient
'''
This state will turn teh husky by calling the necessary action

-- turn_angel   float       Angel between 180 - (-180) the Husky will turn
-- speed        flaot       Speed with which the robot will try to get to the angle
-- topic        string      topic of the server that turn the Husky

<= done                     if turn is completed successfully
'''

class TurnState(EventState):
    '''
    Class that defines the state to turn the husky 
    '''

    def __init__(self, angle, speed):
        super(TurnState, self).__init__(outcomes=['done', 'failed'])
        self._angle =angle
        self._speed = speed
        self._server_name='/TurnHusky'
        self._client = ProxyActionClient({self._server_name: turn_huskyAction}) # pass required clients as dict (topic: type)
        self._error_flag = False 

    def execute(self, userdata):
        if self._error_flag:
            return 'failed'

        if self._client.has_result(self._server_name):
            result= self._client.get_result(self._server_name)
            restult_val=result.done

            if restult_val=="done":
                return 'done'
            else: 
                return 'failed'
        if self._client.has_feedback(self._server_name):
            feedback= self._client.get_feedback(self._server_name)
            Logger.loginfo('Current heading is : %s' %str(feedback.heading))

    def on_enter(self, userdata):
        goal=turn_huskyGoal()
        goal.angle= self._angle
        goal.turn_speed= self._speed

        #Send the goal
        self._error_flag= False

        try:
            self._client.send_goal(self._server_name)
        except Exception as e:
            Logger.logwarn('Failed to send the Turn command: \n %s' %str(e))
            self._error_flag=True


    def on_exit(self, userdata):
        Logger.loginfo('exit the Turn state')
        if not self._client.has_result(self._server_name):
            self._client.cancel(self._server_name)
            Logger.loginfo('Canceslled the active turning')

    def on_start(self):
        Logger.loginfo('State is read to turn husky')


    def on_stop(self):
        Logger.loginfo('The state has been stopped')
        if not self._client.has_result(self._server_name):
            self._client.cancel(self._server_name)
            Logger.loginfo('Canceslled the active turning')

Any help would be useful.

2020-04-15 18:00:13 -0500 received badge  Famous Question (source)
2019-11-28 06:29:49 -0500 received badge  Famous Question (source)
2019-06-25 03:19:17 -0500 received badge  Notable Question (source)
2019-06-25 03:19:17 -0500 received badge  Popular Question (source)
2019-05-13 21:07:56 -0500 received badge  Notable Question (source)
2019-04-26 16:21:47 -0500 received badge  Popular Question (source)
2019-03-17 19:49:18 -0500 edited question Flexbe unabel to reache action_server

Flexbe unabel to reache action_server I'currently trying to work with Flexbe and trying to include an action but I keep

2019-03-17 19:48:24 -0500 edited question Flexbe unabel to reache action_server

Flexbe unabel to reache action_server I'currently trying to work with Flexbe and trying to include an action but I keep

2019-03-17 19:47:30 -0500 edited question Flexbe unabel to reache action_server

Flexbe unabel to reache action_server I'currently trying to work with Flexbe and trying to include an action but I keep

2019-03-17 19:47:30 -0500 received badge  Editor (source)
2019-03-17 19:46:35 -0500 edited question Flexbe unabel to reache action_server

Flexbe unabel to reache action_server I'currently trying to work with Flexbe ant trying to include an action but I keep

2019-03-17 16:30:46 -0500 asked a question Flexbe unabel to reache action_server

Flexbe unabel to reache action_server I'currently trying to work with Flexbe ant try to include an action but I keep get

2019-03-02 06:45:06 -0500 received badge  Supporter (source)
2019-02-09 11:15:23 -0500 received badge  Enthusiast
2019-01-30 04:57:36 -0500 asked a question How to implement the Skid Steering Drive plugin in Gazebo and why do I not need transmission tags?

How to implement the Skid Steering Drive plugin in Gazebo and why do I not need transmission tags? Hello, I'm new to G