Skip to content

Conversation

lizlooney
Copy link
Collaborator

Show mechanism methods in the toolbox.

Screenshot 2025-08-05 at 10 47 06 PM

Added INSTANCE_MECHANISM to FunctionKind enum to represent calling a mechanism instance method from the robot or from an OpMode.
In renameMethodCaller, added code to update a block calling a component instance method if the component name is changed, and to update a block calling a mechanism instance method if the mechanism name or method name/signature is changed.
Added functions addInstanceMechanismBlocks and createInstanceMechanismBlock.

In mrc_component.ts:
Added validator to the name field so we can call renameMethodCallers when the user changes the component name.
Removed hideParams and mrcHideParams. Instead use module type to decide whether to hide parameters.
Replaced getNewPort method with getArgName method, which uses both the component name and the arg name so the users knows what kind of ports (or other arguments) they are passing in.

In mrc_mechanism.ts:
Added validator to the name field so we can call renameMethodCallers when the user changes the mechanism name.

In editor.ts:
Added getMechanism method to get the Mechanism that correponds to the given MechanismInRobot.

In common_storage.ts:
Added some comments on className fields.

In hardware_category.ts:
Added code to getRobotMechanismsCategory to add a toolbox category with the methods for each mechanism that was added to the Robot.

In methods_category.ts:
Removed duplicate 'register_event' value.
@lizlooney lizlooney requested a review from alan412 August 6, 2025 05:48
@lizlooney
Copy link
Collaborator Author

This PR also improves the names of mechanism constructor parameters.
For a mechanism that has an ExpansionHubServo named my_expansion_hub_servo, the parameters for the mechanism constructor are my_expansion_hub_servo__hub_number and my_expansion_hub_servo__servo_number (instead of my_expansion_hub_servo_port and my_expansion_hub_servo_2_port).

Copy link
Collaborator

@alan412 alan412 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to think about how components inside of mechanisms get shown in the robot.

@alan412 alan412 merged commit db01671 into wpilibsuite:main Aug 7, 2025
1 check passed
@lizlooney lizlooney deleted the pr_mechanism_methods branch August 7, 2025 05:38
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 this pull request may close these issues.

2 participants