FlexBE / flexbe_webui

ROS 2 Web-based user interface (editor + runtime control) for the FlexBE behavior engine.
Apache License 2.0
4 stars 3 forks source link

Custom ROS2 Message Type Constants Not Recognized in FlexBE Web UI #3

Closed RPRKLR closed 1 week ago

RPRKLR commented 4 months ago

I have created a custom message type for ROS2, which I will refer to as Statuses. This custom message type consists of different constant integers and bytes, each representing a different state. For example, 1 is IDLE, 2 is EXECUTION, etc.

When using these constants in FlexBE Web UI, I encounter an issue where the constants are not recognized, and I am forced to use the actual integer values instead. This makes it difficult to keep track of the different states in a larger project. Specifically, I receive the following error: Unknown variable for parameter of LogStatus Invalid parameter 'Statuses.IDLE' (reference) of LogStatus

Steps to Reproduce:

  1. Create a custom ROS2 message type with constants, e.g., Statuses.
  2. Define states using these constants in FlexBE Web UI.
  3. Attempt to use the constants in a state definition.

Expected Behavior:

Actual Behavior:

I only encountered this issue with webui.

Environment:

dcconner commented 4 months ago

Can you upload a screen shot of the relevant screens (dashboard, statemachine, and state properties) with data as you enter it? The WebUI attempts to validate and detect variable types, and clearly there are some special cases that are not handled. If you prefer not to upload, you can email me at https://flexbe.readthedocs.io/en/latest/contactinfo.html

dcconner commented 4 months ago

I used an example with using BEStatus.RUNNING as text field for LogState.

I had to add the import to manual section of behavior before I could run the behavior.

# [MANUAL_IMPORT]
from flexbe_msgs.msg import BEStatus
# [/MANUAL_IMPORT]

but after doing so it ran fine.

@RPRKLR I'll need some more details if this is still an issue for you.

Thanks for the testing and reports. Keep them coming.

RPRKLR commented 4 months ago

When I load in the behavior, I still get the Error in the terminal: Unknown variable for parameter of LogStatus Invalid parameter 'Statuses.IDLE' (reference) of LogStatus But when I run the behavior, it can run with the custom interfaces.

dcconner commented 4 months ago

The unknown variable is flagged and reported to terminal but it does not invalidate the state machine, so you can still run.

I will need to add any classes from manual imports to the list of potential matches for variables. The checks were put in place to flag when people forget to define userdata or constants in dashboard.

RPRKLR commented 4 months ago

I understand, thank you for your help.

dcconner commented 4 months ago

I'm going to leave this open until I make changes that will improve the handling of imported class definitions

dcconner commented 4 months ago

My plan is to add a panel to the dashboard to display manual manual imports and to allow the user to directly add them to the class. I will then use that information in the checking routine. The import information is already loaded, but I think it will be helpful to allow the user to directly access the information instead of requiring the user to edit the source files.

Once that is in, I will consider any variable that uses an imported class as valid. That is if user specifies MyStatus.MY_STATUS_CONSTANT in a field, I will assume it is a valid reference if they have imported MyStatus class.

dcconner commented 3 months ago

The beta-enhanced branch should address most of this issue.

RPRKLR commented 2 months ago

I have tested, and it does solves the issue, and also it is a great addition, that I can add the imports in flexbe.

dcconner commented 1 week ago

This is fixed in flexbe_behavior_engine 4.0.0 in latest jazzy and ros2-devel branches and flexbe_webui in main branch