Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExecutionResult is None in DetectObjects ROS Action #337

Closed
Oberacda opened this issue Mar 12, 2025 · 3 comments · Fixed by #338
Closed

ExecutionResult is None in DetectObjects ROS Action #337

Oberacda opened this issue Mar 12, 2025 · 3 comments · Fixed by #338

Comments

@Oberacda
Copy link

Oberacda commented Mar 12, 2025

When using the detect_objects action the ExecutionResult returned by pyrobosim to the pyrobotsim_ros wrapper is None.

[ERROR] [1741771114.873669517] [pyrobosim.action_server]: Error raised in execute callback: 'NoneType' object has no attribute 'status'
Traceback (most recent call last):
  File "/opt/ros/jazzy/lib/python3.12/site-packages/rclpy/action/server.py", line 333, in _execute_goal
    execute_result = await await_or_execute(execute_callback, goal_handle)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ros/jazzy/lib/python3.12/site-packages/rclpy/executors.py", line 111, in await_or_execute
    return callback(*args)
           ^^^^^^^^^^^^^^^
  File "/delib_ws/install/pyrobosim_ros/lib/python3.12/site-packages/pyrobosim_ros/ros_interface.py", line 663, in robot_detect_objects_callback
    execution_result=execution_result_to_ros(execution_result),
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/delib_ws/install/pyrobosim_ros/lib/python3.12/site-packages/pyrobosim_ros/ros_conversions.py", line 228, in execution_result_to_ros
    status=getattr(ExecutionStatus, result.status.name),
                                    ^^^^^^^^^^^^^

I think the issue stems from the call to detect_objects in world_canvas.py as this only starts the detection but does not return a result.

@sea-bass
Copy link
Owner

The function being called is here:

def detect_objects(self, target_object: str | None = None) -> ExecutionResult:

I will take a look later, but just sharing this in case you have time to debug before then.

@sea-bass
Copy link
Owner

I just tested on main by doing

ros2 launch pyrobosim_ros demo.launch.py

Then, I moved the robot manually to a location, after which I did:

ros2 action send_goal /execute_action pyrobosim_msgs/action/ExecuteTaskAction "{action: {robot: robot, type: detect}}"

This ran correctly for me with this output

Result:
    execution_result:
  status: 0
  message: ''

Goal finished with status: SUCCEEDED

What was the payload of the action you used so I can maybe try reproduce this on my end and fix the bug?

And... are you on the main version, or other?

@sea-bass
Copy link
Owner

sea-bass commented Mar 12, 2025

Wait, I see now! This happens with the /robot/detect_objects action as I forgot to port something over after the big type annotation PR.

ros2 action send_goal /robot/detect_objects pyrobosim_msgs/action/DetectObjects {}

This should fix it -- thanks @Oberacda! #338

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants