I noticed an interesting thing while working on my joystick project.
The stop()
method in EasyGoPiGo3 does not release the motors.
If you do anything using the easygopigo library that runs the motors, the motors still have power applied even after the stop()
method has been called, and even after the program has stopped.
Apparently, the easygopigo stop
method does not put the motor driver “to sleep” in the same way you can turn off power to the servos.
Viz.:
def stop(self):
"""
This method stops the `GoPiGo3`_ from moving.
It brings the `GoPiGo3`_ to a full stop.
.. note::
This method is used in conjuction with the following methods:
* :py:meth:`~easygopigo3.EasyGoPiGo3.backward`
* :py:meth:`~easygopigo3.EasyGoPiGo3.right`
* :py:meth:`~easygopigo3.EasyGoPiGo3.left`
* :py:meth:`~easygopigo3.EasyGoPiGo3.forward`
"""
self.set_motor_dps(self.MOTOR_LEFT + self.MOTOR_RIGHT, 0)
In order to have the stop method turn off power to the motors, you need the following line added at the very end:
self.set_motor_power(self.MOTOR_LEFT + self.MOTOR_RIGHT, -128)
Adding that to the stop method of the easygopigo library should save you serious battery if you have the robot moving around and then stopping.