Announcement

Collapse
No announcement yet.

Legacy Module Help

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Legacy Module Help

    How do you program the legacy module to function with the Hi-Technic motor and servo controllers in Android Studio?

  • #2
    You just plug each controller into one of the ports using and NXT cable then create a new configuration from the Robot Controller ... Settings...Configure Robot menu. You assign names to each device (controller and motor) then when you write your OpMode you call out those names. If you want to use one of the existing OpModes to get started, I recommend looking at the code to find out what names they use then setup the names to match.
    Mark Hancock
    Tigard Team Mentor

    Comment


    • #3
      Thank you.

      Comment


      • #4
        Originally posted by FTC9655 View Post
        How do you program the legacy module to function with the Hi-Technic motor and servo controllers in Android Studio?
        Technically, you don't program the legacy module.

        The controllers will show up from the opmode's perspective
        as a DcMotorController and ServoController. The motors
        and servos attached as DcMotor and Servo.

        The only caveat with programming devices through the
        legacy module is the need to set into read or write mode
        prior to performing respective operations. This is unnecessary
        with the Modern Robotics usb-based controllers.

        An example of an event-based extension to the core SDK
        that does this for you and then sends an event back to
        the robot when it's done can be found here.

        https://github.com/cmacfarl/FTC-Team...rModeTask.java

        What's this robot and event thing you talk of?

        https://github.com/cmacfarl/FTC-Team...est/Robot.java
        https://github.com/cmacfarl/FTC-Team...obotEvent.java
        https://github.com/cmacfarl/FTC-Team...RobotTask.java

        Disclaimer: The infrastructure above is work in progress. Has already changed...yada yada yada.

        Comment


        • #5
          That is some sexy stuff you have there!

          Comment


          • #6
            Originally posted by skatefriday View Post
            Technically, you don't program the legacy module.

            The controllers will show up from the opmode's perspective
            as a DcMotorController and ServoController. The motors
            and servos attached as DcMotor and Servo.

            The only caveat with programming devices through the
            legacy module is the need to set into read or write mode
            prior to performing respective operations. This is unnecessary
            with the Modern Robotics usb-based controllers.
            Where did you learn this? I read the tutorial and do not remember seeing that you had to set the read and write. After seeing your post I did see it in the JavaDoc. I am glad I saw your post, so thanks. We want to order more kits for parts and are looking for kits that contain the new controllers. What are peoples opinion on these? Are they easier to use? Seems the scan in the Robot Controller did not pickup the controllers in the scan. I had to enter names manually. Is that correct?

            Comment


            • #7
              Originally posted by FTC8388 View Post
              Where did you learn this?
              Forums mostly. This is a great resource.

              Comment


              • #8
                Originally posted by skatefriday View Post
                Forums mostly. This is a great resource.
                I will agree there. Have you updated your code? I was trying to compile it and was getting some errors. Mainly about RobotTask. I see what you are doing though. I think your Robot class is basically the opmode. It is basically the same as the k9opmode example correct. I mainly program in C# at work which is close to Java. You code has helped me out greatly.

                Comment


                • #9
                  Originally posted by FTC8388 View Post
                  I will agree there. Have you updated your code? I was trying to compile it and was getting some errors. Mainly about RobotTask. I see what you are doing though. I think your Robot class is basically the opmode. It is basically the same as the k9opmode example correct. I mainly program in C# at work which is close to Java. You code has helped me out greatly.
                  Yeah the stuff in github is, at present, just examples
                  of the framework.

                  Robot extends OpMode and provides
                  the framework for task scheduling and event
                  dispatching. We will have a class derived
                  from Robot for each instance of a robot we
                  build, and then multiple classes fanning out
                  from there for each individual program "opmode"
                  we develop for that robot.

                  In a few weeks my team will start pushing all of their
                  source to github at which point everything pushed
                  will build. PM me your email address if you want individual
                  help in the meantime.

                  Comment

                  Working...
                  X