No announcement yet.

Hardware Thread Safety

  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by DanOelkeFTA View Post
    As someone who has done a "few" years of embedded software - I understand the importance of state machines and being able to create and use one proficiently.

    However - for many of the programmers this is their very first experience in programming. And even if it isn't their first, they are probably still beginners. Forcing them to use the Iterative OpMode because it is good for them to learn state machines will just end up frustrating them.

    In my experience the programmers for over 50% of the teams do not need to create a single state machine. They are happy just to have a functional teleop and an autonomous that does a simple drive, turn and move the arm. Having success in programming is more important than forcing them to learn more advanced concepts like state machines.

    For those programmers / teams that get to the point that they need more advanced things - they will learn state machines. They will learn about multiple threads. But they'll do that having gained confidence with the simpler things that they succeeded at before. Let the teams crawl and walk before forcing them to run.
    Dan, we are just laying out the Pros and Cons here. You have to lay out ALL of the Pros and Cons so that teams will be able to make informed decisions.

    If taught right, iterative OpMode programming is not any harder for beginner programmers to learn than LinearOpMode programming in my opinion. This is in virtue of a well designed iterative OpMode class and the nature of the programming involved.

    Perhaps the Tech Team and the FTAs should just let teams try things out for themselves and let them draw their own conclusions. Isn't this what FIRST is all about?


    • #17

      Giving teams information is good. And there is lots of information about programming for FTC.

      I disagree that the Iterative Opmode is not harder than LinearOpMode. I've mentored teams that have struggled with Iterative. The team I coach struggled with it. When they switched to Linear they made progress much faster. In Linear if you want a half second delay it is a single line of code. In Iterative you need another state which will mean multiple lines of code. More lines of code is more work and means more chances for bugs. It also is harder to follow the flow of the action when reading the code which leads to more problems.

      Even as a professional where I deal with asynchronous programming all the time - if I have the opportunity to do something in a linear fashion I will. Because it is simpler, less code, less chances for bugs, and easier maintenance. Many times I've had to fix bugs because someone messed up something rather simple in one of the states and it wasn't obvious until much later in the development cycle.

      When I am asked by a team for help with programming, every time I will tell them to start with Linear over Iterative. If as a mentor I don't give some guidance to them, I am failing them. Now I can't write the code for them, or do all the design for them - that would also be failing them. It has to be a balancing act of giving enough help but not too much.

      Having teams be inspired by science & technology is what it's all about. And for them to be inspired instead of frustrated they need to be able to find some level of success. They don't have to win the award much less the tournament. Just being able to build something and make it move is success at some level.

      So based on my experience as a software engineer, and as a mentor and coach I will respectfully disagree with your view of pushing Iterative Opmode to start with.


      • #18
        I am NOT an embedded programmer, I program business programs in C#. Personally, I think that state machines are way under utilized in many business programs. I think many of my peers would write a better program if they thought of business processes as a series of states.

        Having said all of that, I did NOT realize that one could get away with blocking in the LinearOpMode and I will show the students that for this year. We are starting from scratch and I am certain that there is plenty of opportunity for them to be overwhelmed as it is. Heck, some of the committee members (we are also a Scouts BSA troop) find just the rules and strategy to be overwhelming.

        Thank you everyone for your input.


        • #19
          Originally posted by ftcsachse0 View Post
          Personally, I think that state machines are way under utilized in many business programs. I think many of my peers would write a better program if they thought of business processes as a series of states...
          I've worked with seasoned software engineers who are terrified of state machines, multi-threading, asynchronous programming. They avoid these like the plague.