I’m controller a stepper using the TIC T834 motor driver. I’m using a Raspbery Pi 3B+ for a microcontroller and communicating to the driver over i2c. The problem I’m seeing is I can either set the target velocity and not have position control, or I can set the target position and not have velocity control.
It looks like there is either a bug or I’m doing something wrong. According to the manual (https://www.pololu.com/docs/0J71/5.1):
“[in target position mode] the Tic will plan steps for the stepper motor with the goal of making its current position equal to the target position and its current velocity equal to zero, while maintaining the speed/acceleration/deceleration limits described later in this section.”
I’ve set speed, accel and decel limits in my code and have confirmed with ticcmd that they are being honored. However, once I invoke the setTargetPosition command the target velocity gets set to -1000000, instead of max speed.
How can one control the velocity while using setTargetPosition through i2c?
I have an update here in case it helps anyone. I found that TIC’s “Position Uncertain” flag was set to Yes and this seemed to be the source of the fixed velocity when trying to run in position mode. I called “HaltandSetPosition” first thing in my program and that sets the position uncertain flag to “no” and the current position to a known value. Now the maxspeed, accel, and decel values are honored when I call setTargetPosition. I’m not sure if this behavior is documented anywhere. If not you might want to add it to the user guide.
Do you have the automatic homing feature enabled in the “Advanced settings” tab of the Tic Control Center? If so, the homing procedure will automatically start when the following 3 conditions are met:
- The “Position uncertain” flag is set.
- The “Operation state” is “Normal”.
- The “Input state” variable (which is set either by the control mode or by serial commands) is “Target position”.
This is described in the “Enable automatic homing” entry of the “Setting reference” section in the Tic user’s guide.
Thanks Brandon, I did have automatic homing enabled. It all makes sense now. This driver has a ton of features and it takes a minute to understand the intent of the system and how all the features work together. Guess I should have read the whole manual first.