>   Again my apologies to spamming you guys. At least someone's using the
> stuff, yes?

Yes! :)

> I switched machines (still running the same pyro live knoppix CD) and
> now my code works (phew). Though sometimes it appears (and this is true
> with the joystick interface too) that the Hemisson isn't getting the
> command to move.
>
> Specifically:
>
>     * Occasionally I click on the joystick interface to go forward and
>       get no response. Repeat the click and the robot moves
>     * I step through my program. It prints "moving" on the screen but
>       the robot doesn't move
>     * I need to run my robot at an incredibly slow speed to get it to
>       stop before bumping into something. I suspect this is because not
>       all of the "stop" commands are being received.
>
>
> My current code: (have tried permutations of self.robot.ir / self.ir and
> self.robot.move and self.move -- they seem equivalent. Am I missing
> something?)
>
> # robot goes forward and then slows to a stop when it detects something
>
> from pyrobot.brain import Brain
>
> class StopWhenClose(Brain):
>
>
>     def step(self):
>        front = self.robot.ir[0][0].distance()
>        print "front ir: ",front
>
>        if front > 0.488:
>            self.robot.move(0.2,0)
>            print "moving ..."
>        else:
>            print "stopping"
>            self.robot.stop()
>

This code may be a little odd... 10 times a second (at most) you are
either moving forward, or telling it to briefly not move. I suspect that
the sensor readings have enough noise that it is always moving some. That
is, if you take 10 readings, chances are that at least one (per second) is
going to have enough noise to make it move forward. Eventually, it may be
too close to get an accurate reading.

self is a brain, and there is a convenience method for move there. Compare:

pyrobot/robot/__init__.py
pyrobot/brain/__init__.py

-Doug

> def INIT(engine):
>     return StopWhenClose('StopWhenClose', engine)
>
>
> _______________________________________________
> Pyro-users mailing list
> [email protected]
> http://emergent.brynmawr.edu/mailman/listinfo/pyro-users
>

_______________________________________________
Pyro-users mailing list
[email protected]
http://emergent.brynmawr.edu/mailman/listinfo/pyro-users

Reply via email to