Can not reset encoders in Labview during auto

I’m posting a question from one of my programming students about issues while using encoders in Falcon 500 motors during autonomous. We’d appreciate help if anyone can spot this issue in this Labview code! Relevant photos are attached.

I am trying to get my robot to drive in a box but am having problems resetting the encoders. I can drive forward, stop, and reset the encoders. Drive backwards, stop, and reset the encoders. Turn, and stop, but for some reason after the robot turns I can not get the encoders to reset. Because of this I think the problem arrises from the but I have not been able to figure out the problem.

You are resetting the encoders in your stop VI, but you are also resetting before starting your turn and you drive VI’s. I see no reason that those resets won’t work - so I’m wondering what behavior you’re seeing that makes you think they aren’t resetting.

Have you removed all the VI’s except your turn and one stop VI, and see if the encoders are zero after the stop VI?

This is the danger of sending images instead of VIs. (You’re also more likely to find programming guidance in the LabVIEW sub-forum).

We can look at one of three+ possible scenarios here. We don’t know what happens when the outer Case Structure is True. We don’t know what happens when the inner Case Structure is False. Here’s what we can tell:

If “turny:)” is greater than zero, we get to the outer Case Structure (It may be worth showing your programmers there’s a native “greater than zero” so they don’t have to wire the 0. Though, we’d also have to invert the False/True. Alternatively, we can use the current “less than zero” in the same logic to keep the cases the same)

The second check is only required because the first is inverted. Unless you’re doing something different in the True case of the outer Case Structure, we can delete that outer one entirely and only use the inner making the code easier to read/debug.

That gets us into the inner case structure. One logical test: is turny;) greater than zero?

The inner case structure uses three values of note:
A = turny:) - 5
B = turny:) +5
C = -Yaw

We check two logical things: A<C? B>C? If BOTH of these are true, we stop the loop and move on. If either (or both) are false, we continue.

Let’s give turny:) a number of 10 just to do some checks. A=5. B = 15. As long as Yaw fits in between those two values, it’ll stop. Until it fits in between, the loop will continue.

I’m not familiar with pigeon. Does this read the encoders? I don’t see why, or how, it would. If it doesn’t, where are you reading the encoders (and getting value from resetting them?)

It appears what you’d want to do is read the yaw when you come in and turn until the desired yaw. I believe the reset up top would set the initial value. What are you seeing it change to?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.