-
Notifications
You must be signed in to change notification settings - Fork 16
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
Project: Autonomous Ski Lift Simulation for Safety & Efficiency (C example) #118
base: main
Are you sure you want to change the base?
Conversation
…lift and the status of it's motion. Moreover, the status of the entry gate is printed too.Other functionalities are not fully implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a great start! I left some comments to clean up the code and finish the implementation of an empty reactor.
This is pretty cool! I approved a CI run for this. |
…stdout reactor, and remove unused c files.
@lhstrh Thank you! So glad you like the idea! |
@hokeun I cleaned up comments, reformatted the code using VS code formatter, and implemented the ScreenPrinter reactor! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing my previous comments! I left some additional minor comments. I tested this example out on my local machine, and confirmed that it works fine.
Also, could you add a README for this example?
Here are some sample READMEs for other examples in the playground:
- https://github.com/lf-lang/playground-lingua-franca/blob/main/examples/C/src/car-brake/README.md
- https://github.com/lf-lang/playground-lingua-franca/blob/main/examples/C/src/modal_models/FurutaPendulum/README.md
Also, when you write your README, please feel free to re-use the content you already have in the PR description.
examples/C/src/SkiLift/Lift.lf
Outdated
self->offset = (self->offset + 1) % self->screen_wideth; // Update the offset for the next frame | ||
=} | ||
|
||
// TODO: Behaviors on the start of the lift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a TODO that you want to do after merging this PR? Can you elaborate on what TODOs are left?
examples/C/src/SkiLift/Lift.lf
Outdated
} | ||
=} | ||
|
||
// TODO: Behavior on the end of the lift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here.
…om Lift.lf to lib/LiftMotion.lf
@hokeun Thank you for reviewing professor! I pushed three new changes.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me! Thanks, Cheng Yen.
@Max851010 I suggest we wait for a few more days in case other reviewers want to take a look before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Any reflections on the experience of building this? How did LF make it easier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Can you elaborate on what the problem is with passing parameters with bodiless reactions? Maybe open an issue?
@hokeun @lhstrh @edwardalee Thank you all for reviewing the project! I'll keep adding new features! @lhstrh The best part of Lingua Franca is the reactor diagrams in VS Code! The logic and data flow of embedded systems can be quite complex sometimes in my opinion. It's much easier to design the system with the diagram feature. On the other hand, the difficult part of LF might be the documentation doesn't cover enough use cases. Sometime it's hard to find guidance for specific scenarios. For example, it took me several hours to figure out how to implement self loop in my LiftMotion modal reactors (which I'm not sure if I did it correctly). If cases like this were documented, it would help a lot! @edwardalee For example, I tried to put all the preamble functions in a C file and call one of the function with a parameter as it's input. However, I couldn't find a similar example in other projects or in the LF documentation. #include <stdio.h>
#include "../include/HelloDecl/HelloDecl.h"
void hello(hellodecl_self_t* self, int x) {
printf("x: %d\n", x);
}
Moreover, can I call the function without using the startup event? Like using timer event or none? |
Good questions. You are right that we need more examples. That has been one of the goals of the playground! One option would be this, I think:
IMHO, this would be even cleaner, so you wouldn't have to expose the (internal)
and then
or better
On the question about whether to use the startup event, a reaction has to have a trigger. The startup event is equivalent to a timer declared as follows:
|
@edwardalee Thank you so much!!! That's exactly what I need. I just tried it and it worked!
|
Project Description
This project simulates the behavior of ski lifts with a focus on improving safety and reducing labor costs through automation using Lingua Franca. The simulation models key aspects of ski lift operations, including:
The goal is to explore how automation can enhance safety while reducing operational costs, making ski lifts more efficient and reliable.
About me
Hello everyone! I'm Cheng Yen, Tsai, a current M.S. Computer Science student at Arizona State University. In Fall 2024, I took CSE 522: Real-Time Embedded Systems, where I had my first experience programming for embedded systems and working with Lingua Franca. It's amazing because embedded system is so different than any system I built before (I was a full-stack web developer before return to school).
Now I'm developing this applied project under the guidance of Professor @hokeun for my graduate requirement. Because I'm a snowboarder, it's really excited to have this opportunity to combine my passion with my technical skills while contributing to the Lingua Franca community. I'm sure I will have fun here! Nice to meet you all.
More detail about my experience: https://www.linkedin.com/in/cheng-yen-tsai-3690a2201/
Updates in this PR
The current implementation now is only the animation of lift motion, the ability to open/close entry gate, the stop/move behavior of the lift.
Sensors (Reactors) – Planned for Future Implementation
Modal Models
Main Reactor
Demo Video
Screen.Recording.2025-02-02.at.11.08.26.AM.mov