Shop OBEX P1 Docs P2 Docs Learn Events
How does s2 knows it is stuck — Parallax Forums

How does s2 knows it is stuck

RuturajRuturaj Posts: 19
edited 2014-09-01 20:05 in General Discussion
I wrote obstacle avoidance code for s2 using spin. But sometimes it doesn't detect objects and gets stuck, that's ok but when in factory obstacle avoidance mode it gets stuck it just goes back a little and makes a turn. Any idea how it know that its not moving anymore even though wheels are moving?

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-09-01 15:10
    Are you programming with the GUI or in Spin?
  • RuturajRuturaj Posts: 19
    edited 2014-09-01 15:14
    I am using spin
  • W9GFOW9GFO Posts: 4,010
    edited 2014-09-01 16:50
    There is an encoder for the caster wheel. It can deduce that it is stuck when the main wheels are moving but it isn't.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-09-01 17:32
    There's a function in the S2.spin object called stalled. It returns true if the S2 has stalled; false, otherwise. It takes into consideration the idelr wheel encoder and other factors.

    -Phil
  • RuturajRuturaj Posts: 19
    edited 2014-09-01 20:05
    Thank you W9GFO and Phil
Sign In or Register to comment.