Closed rqi14 closed 7 months ago
most of the calls yields an return code. could you please check those in order to narrow down the issue ?
most of the calls yields an return code. could you please check those in order to narrow down the issue ?
Thank for the hint! I found I understood it wrong.. It seems the definitions of acceleration for setAcceleration and moveByAcceleration are different. For setAceleration, it cannot be negative and for moveByAcceleration, it can be negative for backward movement.
Hi. I tried the following code. I found that when the motor is asked to move backward. It doesn't respond to setSpeedInHz(). It uses the old speed set before an instruction telling it to move forward.
I tried applySpeedAcceleration();. It didn't help.
For example, if the motor is set to move forward at 10hz, 20hz, 30hz using the above code, you can see the speed change. If the motor is set to move backward, at 10hz, 20hz, 30hz, there is no speed change. If the board is reset and the motor hasn't been moved before, the motor doesn't move. If the motor is set to move forward at 10hz, then backward at 20hz, it moves backward at 10hz. If the motor is set to move forward at 10hz, then backward at 30hz, it moves backward at 10hz. If it is further set to move at other speeds for backward movement, it will keep moving at 10hz. Unless a new speed is set with forward movement instruction, followed by a new backward movement call.
In short, setSpeedInHz doesn't work if followed by a backward movement call, evenif apply speed acceleration is called. Only setSpeedInHz followed by a forward movement call changes the speed.