I have noticed that if I call rosbot.initROSbot, my motors and delays do not work properly: Once the sys.delay is called, power seems to be cut off from the motors, resulting in very the motors being powered for a very short time.
Is there a way to fix this, for instance, to dynamically “uninit” ROSbot when willing to use the hMotor interface?
ROSbot class is using
hMotor interface internally, thus when you call
rosbot.initROSbot() it takes control over all motors.
To control motors of ROSbot, you should rather use
ROSbot::setSpeed(), it will adjust individual motors power to drive ROSbot with desired speed.
There is no method for uninitialization of
ROSbot, such process would break odometry functionality.