FIRST Tech Challenge Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use 4 encoder at the same time?

I'm using a set of macanum wheels so I want to control four wheels at the same time to achieve omni-direction moving. But the distence moving always work one by one, so there are only two wheels working at the same time. How can I deal with it?

0 Kudos
Message 1 of 8
(6,126 Views)

hi Jerry,

We are playing around with a holonomic (omni-direction) robot chassis this season also.

Are you talking about this when writing autonmomy? I have a attached a screen shot of what I think you want to know how to do.

Each vi can only work with one motor controller at a time.So to operate 4 motors at the same time you will need 2 instances of the vi linked to the sequence of events (NXT pink wire) as shown.

0 Kudos
Message 2 of 8
(5,153 Views)

I tried this way last time, and it didn't work, too.

0 Kudos
Message 3 of 8
(5,153 Views)

In that case I would try to put the vi's into a structure in the stream.

Some structure where a pink strand feeds in and out.

Maybe a while loop that runs one time - exiting based on completion of both vi's?

r

0 Kudos
Message 4 of 8
(5,153 Views)

If it is code related maybe you could try putting the movement in some kind of structure that is pink-stranded (NXT) in your autonomy sequence.

Maybe a while loop that runs one time, and exits when both 'distance moves' are completed.

It may be motor controller related. There are some posts in the FIRST FTC forum about the 2nd motor controller in the daisy chain not working right.

You could try controlling 3 lego motors individually using the 'distance vi' in whatever LabVIEW code 'pink-stranded set-up' you have. This might point toward a MC issue, and not a software structure issue.

We have been testing our systems with a single motor controller so far (waiting on parts). This weekend we will be working with 3 motor controllers daisy chained. I'll share what we find out.

0 Kudos
Message 5 of 8
(5,153 Views)

Hi jerry_dcjx and Lori,

I just wanted to follow up and see how things were going with this. Were you able to accomplish what you were trying to do? If not, let us and we'll see what we can do (althought it probably won't be until after Thanksgiving since most of us will be out of the office next week).

- Aaron

0 Kudos
Message 6 of 8
(5,153 Views)

well, I have tried many ways, I think it might only works when i creat two sub vi and make them run together, but i haven't try it.

I just use a structure in the picture to read the encoder, though there might be some error between wheels.

Actrually the atunomous program is finished now, and it works really good. we can now do both the ir becon block and the stop on ramp missions.

捕获.PNG

0 Kudos
Message 7 of 8
(5,153 Views)

Jerry:

Is this a sample of code that is working for you? or is NOT working the way you want?

What is the goal of that piece of code (diagonal movement)?

We spent the weekend working out the 'teleop', and came up with an approach we like. We did have a few struggles. We are able to have all 4 wheels moving at one time, and can have the robot move in all sorts of directions (the wheels are operated as matched pairs).

Our next step is to employ a 'compass sensor' to keep the controls oriented to the driver and the field (instead of the robot).

I like to here that you were able to write autonomy that works well. That is our next step.

0 Kudos
Message 8 of 8
(5,153 Views)