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

Add: Automatic function generation for get,set and control #31

Merged
merged 7 commits into from
May 7, 2024

Conversation

RaulTrombin
Copy link
Member

@RaulTrombin RaulTrombin commented May 2, 2024

Requirements:

This PR adds an enum 'category' to make it easier to compose each kind of function.
All the functions related to ping1d/ping360 are now auto-generated.

The functions' set has the parameters exactly as "Set-any-structures". Each set function has a subscriber which waits until receiving its corresponding Ack code or error.
Each setting function simply sends the corresponding request (Ack codes after setting request weren't observed). Each get function has its own subscriber that waits to match the corresponding structure. Functions also have their descriptions.

All the logic towards sending, subscribing, receiving with ack check, and timeout remains the same and is defined in PingDevice.

The Ping1D has been moved to a builder and is now ping1d::Device. ping1D::Device is reimported as Ping1D, as is Ping360 which actually has all functions attached to it.

image

Next steps:

  • - Add function inputs description and their unities;
  • - Modify the Device structure back to device.rs and allow custom ones;

@RaulTrombin RaulTrombin requested review from patrickelectric and joaoantoniocardoso and removed request for patrickelectric May 2, 2024 15:17
@RaulTrombin RaulTrombin marked this pull request as draft May 2, 2024 15:18
build/parser.rs Outdated Show resolved Hide resolved
build/parser.rs Outdated Show resolved Hide resolved
build/parser.rs Outdated Show resolved Hide resolved
build/parser.rs Outdated Show resolved Hide resolved
build/parser.rs Outdated
}
}
impl Device {
pub fn new(port: tokio_serial::SerialStream) -> Self {
Copy link
Member

Choose a reason for hiding this comment

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

We should not use serial, but an abstraction over io. This should work with serial, tcp, udp and file.

Copy link
Member Author

Choose a reason for hiding this comment

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

Please check proposal

examples/ping_1d.rs Outdated Show resolved Hide resolved
@RaulTrombin RaulTrombin changed the title Add: Automatic function generation, for get,set and control [WIP] Add: Automatic function generation for get,set and control May 7, 2024
@RaulTrombin RaulTrombin force-pushed the fn_gen branch 2 times, most recently from 5f34b08 to 34ff863 Compare May 7, 2024 14:48
@RaulTrombin
Copy link
Member Author

@patrickelectric @joaoantoniocardoso
Please check updated PR,
created new emit_fn(), enum category, io abstraction and fully implemented set/get/setting with their descriptions.

@RaulTrombin RaulTrombin marked this pull request as ready for review May 7, 2024 19:15
@RaulTrombin
Copy link
Member Author

@patrickelectric
Fully functional through udp stream from BlueOS ( to be implemented on a next PR updating example and clap fields)
image

@patrickelectric patrickelectric merged commit 43a316b into bluerobotics:master May 7, 2024
3 checks passed
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