Shop OBEX P1 Docs P2 Docs Learn Events
S2 not going exact distance — Parallax Forums

S2 not going exact distance

RuturajRuturaj Posts: 19
edited 2014-09-08 16:24 in General Discussion
Hello guys,

I am new to robotics and using s2 for the first time. I am getting most of the help from this forum and http://www.parallax.com/s2help/english/s2_doc.html#lbl69

I have three questions.

1. My s2 used to turn little extra (in degrees) so I tried setting wheel calibration and and it worked. I changed both values circle and space, for circle 937 worked out pretty well for my robot, I changed space to 145 (I calculated distance using tape from tier (as defined in s2 start up guide) on one wheel to other)[h=4]set_wheel_calibration(circle, space)[/h]2. But I couldn't find anywhere how to set the distance it travels. When I want it to move 8 feets it goes 1.5 inch short. I am using the right calculations, I might need to set calibration for it as well (I guess). Can someone guide me how to?


3. The box says s2 have wheel encoders, can I have access to them using spin?

Comments

  • trookstrooks Posts: 228
    edited 2014-09-08 15:56
    If you are running servo motors using batteries then change will be your only certainty.

    As the batteries discharge the speed of the motors to the same commands will begin to vary. Not all servos will change the same either. What this means is that the robot will not stay on a straight line or move as fast as the batteries get weaker.

    You will have to rely on sensors to maintain a course and expect that the bot will get slower until it stops and you have to replace the batteries.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-09-08 16:24
    trooks wrote: »
    You will have to rely on sensors to maintain a course and expect that the bot will get slower until it stops and you have to replace the batteries.

    The S2 has encoders and the I'm pretty sure the voltage to the motors is regulated and not powered straight from the batteries.

    IMO, 1.5 inches over 8 feet is pretty good.

    It should be possible to access the S2's encoders with Spin but Spin is too slow to monitor the encoders directly. You'd need to create your own custom drivers to control the motors and read the encoders if you didn't want to let the s2.spin object do this for you. IIRC, someone has done this and I think they posted the code. If I can find the post about creating a custom driver for the S2, I'll add a link to this thread.

    Edit: I found the thread about creating a custom driver for the S2 (the code is attached to post #33). The S2's motors are powered directly from the batteries but the maximum speed is adjusted to correspond to the maximum speed possible when the batteries are low. The battery voltage shouldn't effect the S2's performance.
Sign In or Register to comment.