
I'm trying to use move base flex inside a SMACH state machine and want to call the get_path-action. The corresponding action-msg looks like this:
bool use_start_pose geometry_msgs/PoseStamped start_pose geometry_msgs/PoseStamped target_pose float64 tolerance string planner uint8 concurrency_slot --- # Predefined success codes: uint8 SUCCESS = 0 # 1..9 are reserved as plugin specific non-error results # Possible error codes: ... uint32 outcome string message nav_msgs/Path path float64 cost --- Since I have the target_pose stored in an array, I need to pass it to the get_path-actionServer via the goal_cb-Param of the smach_ros.SimpleActionState. Therefore, my code looks as follows:
sm.userdata.next_goal = [target_pose] smach.StateMachine.add('GET_GLOBAL_PATH_IN_GOAL_CHECK_SM', smach_ros.SimpleActionState( '/move_base_flex/get_path', GetPathAction, result_cb = getPathCallback, goal_cb=set_goal_callback, input_keys=['next_goal', ...]), transitions={...}) with the goal_cb as: def set_goal_callback(userdata, goal): if(userdata.next_goal[0]!=None): return userdata.next_goal[0] else: raise Exception("userdata.next_goal is empty.") Doing so, I get the following error:
[ERROR] [1602531192.400746, 0.000000]: InvalidUserCodeError: Could not execute state 'GET_GLOBAL_PATH_IN_GOAL_CHECK_SM' of type '<smach_ros.simple_action_state.SimpleActionState object at 0x7fa458342c18>': Traceback (most recent call last): ...Traceback... File "/home/faps/catkin_ws/devel/lib/python3/dist-packages/mbf_msgs/msg/_GetPathActionGoal.py", line 165, in serialize buff.write(_get_struct_B3I().pack(_x.goal.use_start_pose, _x.goal.start_pose.header.seq, _x.goal.start_pose.header.stamp.secs, _x.goal.start_pose.header.stamp.nsecs)) AttributeError: 'PoseStamped' object has no attribute 'use_start_pose' How do I have to modify my goal_cb to provide the Action with the required use_start_pose-bool and the start_pose-Pose? And furthermore, when I want to get the global path from my current position to the specified goal, do I even need to set the start_pose or does the get_path automatically plan from my current position when use_start_pose is false?
Originally posted by Zimba96 on ROS Answers with karma: 121 on 2020-10-12
Post score: 0