Announcement

Collapse
No announcement yet.

Reading Legacy servo position

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

  • Reading Legacy servo position

    Testing the Legacy module with HT servo controller connected, how do you read the servo? Motor controller class allows you to switch between read/write modes, and that seems to work. The servo controller class has no function to change modes. I'm probably missing something simple, but I can't see how to treat the HT servo the same as an HT motor in terms of reading data back.

  • #2
    Originally posted by Crossle86 View Post
    Testing the Legacy module with HT servo controller connected, how do you read the servo? Motor controller class allows you to switch between read/write modes, and that seems to work. The servo controller class has no function to change modes. I'm probably missing something simple, but I can't see how to treat the HT servo the same as an HT motor in terms of reading data back.
    Hello - my naive reading of http://www.hitechnic.com/blog/wp-con...cification.pdf, combined with my naive understanding that the PWM (pulse-width-modulator) signal cables from the controller to the servos are essentially uni-directional, and my understanding that the servos lack an embedded rotary shaft encoder, suggests to me that reading the servo (if it is possible) would just tell you what value you most recently wrote.

    If I find out anything else, I'll make an updated post.

    Comment


    • #3
      Due to limited developer time we didn't enable reading from the HiTechnic NXT Servo Controllers. mhaeberli is correct that they would only report back the value that you most recently wrote.

      Comment


      • #4
        Will this be added in a future release (in sometime, maybe next year)?

        Comment


        • #5
          I really don't see the use of having a read mode for the HiTechnic Servo Controllers. It is such a pain to have to switch between the read and write modes, so why encourage people to do it for another piece of hardware? It seems trivial to simply create a wrapper class that stores the last set value and returns it when a getPosition() call is made.

          Comment


          • #6
            Originally posted by GearTicks View Post
            I really don't see the use of having a read mode for the HiTechnic Servo Controllers. It is such a pain to have to switch between the read and write modes, so why encourage people to do it for another piece of hardware? It seems trivial to simply create a wrapper class that stores the last set value and returns it when a getPosition() call is made.
            Bingo.

            For servos, the practical, short term solution, is indeed to
            simply save off the last position you told it to move to.

            Most of the time, the servo change rate is going to be so
            fast as to mitigate the need to check where it is at any
            given time. You told it to move to 0.75? Pretty sure it's
            there in the next timeslice that loop gives you.

            There may be applications where this might not be the case
            but I'd think they are likely rare.

            Comment


            • #7
              Originally posted by skatefriday View Post
              Bingo.

              For servos, the practical, short term solution, is indeed to
              simply save off the last position you told it to move to.

              Most of the time, the servo change rate is going to be so
              fast as to mitigate the need to check where it is at any
              given time. You told it to move to 0.75? Pretty sure it's
              there in the next timeslice that loop gives you.

              There may be applications where this might not be the case
              but I'd think they are likely rare.
              Oh, that explains a lot about servos. Thanks.

              Comment


              • #8
                The other thing to think about is: with an open - loop servo (like the HiTechnic ones), you may have instructed them to go to value: x, but a mechanical constraint, or other factor (like not enough torque against the load to turn) might prevent the servo from getting to the location that, unloaded, you think of as x. And your program will never know. Unless you have an encoder, or limit switch, or something, to tell you otherwise.

                Martin Haeberli
                (one of the) programming mentors
                FTC #7593 TigerBots

                Comment


                • #9
                  Originally posted by mhaeberli View Post
                  The other thing to think about is: with an open - loop servo (like the HiTechnic ones), you may have instructed them to go to value: x, but a mechanical constraint, or other factor (like not enough torque against the load to turn) might prevent the servo from getting to the location that, unloaded, you think of as x. And your program will never know. Unless you have an encoder, or limit switch, or something, to tell you otherwise.

                  Martin Haeberli
                  (one of the) programming mentors
                  FTC #7593 TigerBots
                  Right. Because you can't tell exactly what position the servo
                  is actually at because the controller only has a memory map
                  location for the set point.

                  So if there are mechanical constraints, all bets are off.

                  But I'm a software guy, so I assume that the physical
                  world is a perfect void.

                  Comment


                  • #10
                    Originally posted by skatefriday View Post
                    Right. Because you can't tell exactly what position the servo
                    is actually at because the controller only has a memory map
                    location for the set point.

                    So if there are mechanical constraints, all bets are off.

                    But I'm a software guy, so I assume that the physical
                    world is a perfect void.
                    I agree, but I like to try to emulate cases like that when testing the bot's program, Then, asking the designers what they need me to do.

                    Comment


                    • #11
                      Originally posted by Jonathan Berling View Post
                      Due to limited developer time we didn't enable reading from the HiTechnic NXT Servo Controllers. mhaeberli is correct that they would only report back the value that you most recently wrote.
                      It certainly makes it hard to home a servo or use it for sense a mechanical position if you can't read its actual position.
                      Also, how do you determine that the commanded move is complete? Time it?

                      Originally posted by skatefriday View Post
                      For servos, the practical, short term solution, is indeed to simply save off the last position you told it to move to.
                      That only works for an unobstructed move and you give up half of what a servo can do. Using a servo as a position or force sensor is a cool trick; but, only if you can access actual position and current.

                      Mark Hancock
                      Tigard Team Mentor
                      Mark Hancock
                      Tigard Team Mentor

                      Comment


                      • #12
                        Originally posted by markshancock View Post
                        It certainly makes it hard to home a servo or use it for sense a mechanical position if you can't read its actual position.
                        Also, how do you determine that the commanded move is complete? Time it?


                        That only works for an unobstructed move and you give up half of what a servo can do. Using a servo as a position or force sensor is a cool trick; but, only if you can access actual position and current.

                        Mark Hancock
                        Tigard Team Mentor
                        The controllers are not as smart as you think they should be.

                        Position is only available in the form of where you told it to
                        go, not where it actually is. Current is not available at all.

                        Google "hitechnic servo controller datasheet" and the datasheet
                        for the device will show up.

                        Comment


                        • #13
                          Servos used in FTC do not have encoders or hardware that will return the current position which is why it cannot be read. When first powered up, servos will usually move to the center position. One method used to get servos into a known position is to move them to an end position and use a touch sensor or switch to detect when they get to that position. Not all servos will move the the exact same position for a given position value so it can be helpful to "calibrate" a servo so you know where it will be for a given position value.

                          Comment


                          • #14
                            Originally posted by Jonathan Berling View Post
                            Due to limited developer time we didn't enable reading from the HiTechnic NXT Servo Controllers. mhaeberli is correct that they would only report back the value that you most recently wrote.
                            This is actually answers the answer I asked.

                            Comment


                            • #15
                              Originally posted by Crossle86 View Post
                              This is actually answers the answer I asked.
                              Sorry, should read: This actually answers the question I asked.

                              Comment

                              Working...
                              X