Tic t834 c code to start motor

I am writting a code in c to determine the time it takes a motor to accelarate to a certain velocity and then to decelarate to 0. The problem is that when i start the code the tic energizes for a second and then it stops. I have used tic.setTargetvelocity() and then tic.energize. After using this controls to start the motor i need a do while loop but whenever this loop starts the tic shuts down. I have tried it without the loop and the tic keeps going well. Is there another way to know how much time it takes for it to accelarate and decelarate without this loops? I would appreciate if someone could help me fix this problem.

Hello.

From your description (i.e. the tic energizes for a second and then it stops), it sounds like you’re probably getting a command timeout error. By default, the Tic will trigger this error if it does not receive certain commands for a full second. The time it takes to trigger the command timeout error can be configured in the “Input and motor settings” tab of the Tic Control Center. To prevent the error from happening, you could send the “Reset command timeout command” repeatedly while the Tic is connected (which is what the Tic Control Center does). Alternatively, you could disable the command timeout feature by unchecking the box in that same “Input and motor settings” tab. If that does not fix the problem, could you post a copy of your code?

Separately from that, you should be able to estimate how long the Tic will take to accelerate or decelerate fairly easily. The approximate time it takes T (in seconds) to accelerate to a higher velocity will be:

T = 100 \cdot \lvertΔv\rvert/a

Where Δv is the difference between the target velocity and the current velocity and a is the maximum acceleration.

Similarly, when decelerating, the equation becomes:

T = 100 \cdot \lvertΔv\rvert/d

Where d is the maximum deceleration.

Brandon

This code was made within a diferent code that had already been configured and had already fix the timeout problem. When i set the target velocity to a certain value the tic stops working and in the tic control center it says that the Safe Start Violation is stopping the motor. How do i fix this error?

In the “Serial / I²C / USB” control mode. the Tic will generally trigger the “Safe start violation” error whenever it is not in the normal operation state (which can include when other non-latched errors have been triggered). After it occurs, can you check the “Status” tab of the Tic Control Center, under the “Errors” box to see if any other errors have a non-zero “Count”?

Additionally, could you tell me more about your setup and post your complete code (preferably simplified down as much as possible while still exhibiting the problem)? Also, could you post a copy of your Tic settings file? You can save a copy of your Tic settings file from the “File” drop-down menu of the Tic Control Center while the controller is connected.

Brandon