• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Why does the servo not rotate more than +/-180 in sketchyphy

Scheduled Pinned Locked Moved SketchyPhysics
14 Posts 2 Posters 9.4k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    youthreewire
    last edited by 29 Jul 2015, 06:29

    Hello,

    I am trying to command a hinge to act as a servo for +360 and -360 degrees but there is a problom. Just as he servo crosses +180 or -180 it starts to continuously rotate at very high speeds. Can I set these limits software in the plugin (I know that we can set the servo max and min in the UI of sketchy physics but it does not work for more that +/-180 deg). Please tell me how shall I change these limits and where to change these limits or is it hard coded in the Newton dynamics (the physics engine that sketchy physics uses) dll or what ever.Please some one let me know.

    1 Reply Last reply Reply Quote 0
    • A Offline
      Anton_S
      last edited by 29 Jul 2015, 06:50

      I tried configuring servo before, but never got to work properly over 180 degrees. Although, you can use a motor joint and control it with script to achieve something that works even better than sp servo joint.

      1 Reply Last reply Reply Quote 0
      • Y Offline
        youthreewire
        last edited by 29 Jul 2015, 07:45

        Motor joint has velocity control but how to incorporate position control in a motor joint in sketchyphysics is not known. I think we need to modify it in the scripts some where or the newton physics dll to allow for more that 180 deg rotation. Anyone.. any more ideas?

        1 Reply Last reply Reply Quote 0
        • A Offline
          Anton_S
          last edited by 29 Jul 2015, 08:08

          Yeah, that would be great, but we don't have C++ source code to do that. We only have the Ruby source code, but it doesn't contain the code that tells how a servo should work. Most if not all the physics engine related code is within the C++ source which we don't have access to.

          Yet, it is possible to tell the motor to adjust itself to a desired angle. I will upload an example tomorrow. That said, we can also create a custom servo joint in new SP release that bases of a motor joint trough some ruby scripting.

          1 Reply Last reply Reply Quote 0
          • Y Offline
            youthreewire
            last edited by 29 Jul 2015, 08:44

            Also I dont see any proportional controller for the motor in the sketchy physics ruby files. I think Newton server takes care of this and I am guessing if we need the servo to move more than 180 we need to change this in the newton dynamics engine.

            1 Reply Last reply Reply Quote 0
            • Y Offline
              youthreewire
              last edited by 29 Jul 2015, 08:47

              @anton_s said:

              Yet, it is possible to tell the motor to adjust itself to a desired angle. I will upload an example tomorrow. That said, we can also create a custom servo joint in new SP release that bases of a motor joint trough some ruby scripting.

              This if possible would be great.I will wait for this from you.

              1 Reply Last reply Reply Quote 0
              • Y Offline
                youthreewire
                last edited by 29 Jul 2015, 09:16

                I think if we can read angle from a motor and put a proportional controller then we can integrate velocity or use the angle and impose control.

                1 Reply Last reply Reply Quote 0
                • A Offline
                  Anton_S
                  last edited by 29 Jul 2015, 20:29

                  @youthreewire said:

                  I think if we can read angle from a motor and put a proportional controller then we can integrate velocity or use the angle and impose control.

                  You're correct! Here is an example:
                  motor-servo.skp
                  Use W,S virtual keys to control desired angle. The motor will then rotate the arrow to the desired angle.

                  1 Reply Last reply Reply Quote 0
                  • Y Offline
                    youthreewire
                    last edited by 30 Jul 2015, 03:21

                    Impressive...Thanks

                    1 Reply Last reply Reply Quote 0
                    • Y Offline
                      youthreewire
                      last edited by 10 Oct 2015, 10:42

                      Hello,

                      I have been trying to control the motor you scripted through a slider but I want to do an extend range control.The slider value varies only between 0.0 and 1.0 .I want to do a control like -5.0 to 5.0 with the slider.How shall I change the limits of the slider?

                      1 Reply Last reply Reply Quote 0
                      • A Offline
                        Anton_S
                        last edited by 10 Oct 2015, 21:44

                        There are two ways of doing it:

                        1. Change slider min/max parameters. Set slider controller to:
                          slider("range_control", 0, -5, 5)
                        2. Take the current slider ratio, subtract 0.5 from it, and multiply it by 10:
                          (slider("range_control") - 0.5) * 10
                        1 Reply Last reply Reply Quote 0
                        • Y Offline
                          youthreewire
                          last edited by 17 Oct 2015, 03:12

                          Earlier I wrote an API to control the servos from C code.That was working well with sketchup 7 with sketchyphysics 3.2. The example you gave uses the latest version of sketchup and runs in sketchup 8 for me but my C API does not work with sketchy physics 3.5.9. So can you give me the same example with google sketchup 7 running sketchyphysics 3.2 .Please.

                          1 Reply Last reply Reply Quote 0
                          • A Offline
                            Anton_S
                            last edited by 17 Oct 2015, 08:34

                            Here is a SP3.2 compatible example:


                            motor-servo.skp

                            1 Reply Last reply Reply Quote 0
                            • Y Offline
                              youthreewire
                              last edited by 19 Oct 2015, 03:58

                              Thanks I will give it a try and let you know about my progress.

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post
                              Buy SketchPlus
                              Buy SUbD
                              Buy WrapR
                              Buy eBook
                              Buy Modelur
                              Buy Vertex Tools
                              Buy SketchCuisine
                              Buy FormFonts

                              Advertisement