Set “Motor” position to ( ) degrees

Hi all,

I am new to this forum so I hope I am posting on the right place.
I have seen a post from August in the News category stating that this bug was fixed in the new release of VexcodeIQ Blocks, but it does not appear to be.

I am spinning a couple of motors to move to them to an initial position, then I call “set Motor position to 0 degrees" to reset the positions to 0, but unfortunately this has no effect.

Do you know how to fix that issue? Any work around?

Many thanks!

1 Like

I don’t have much experience with VexIQ but i think setting the motor position to 0 degrees does not spin it but it sets the current value of the motor to 0. For example, the motor is at 3000 degrees and you run set Motor position to 0 degrees. It will change the 3000 degrees of the motor to 0. Essentially it is resetting the motor. Is there a “spin Motor to 0 degrees” or something like that?

2 Likes

Yes, sorry if I have not been clear.
I trigger a spin of the motors to move them to the positions I want then to be initialized to.

Then I call the “set Motor position” to set that position to 0. But this has no effect. When I read the position of the motor, it remains non-zero.

1 Like

Have you tried making it rotate to a point after calling the set Motor Position Function? Try making the motor rotate To 0 degrees and see if it spins all the way back or if it does nothing. If it is reset properly before making it spin to 0 degrees it shouldn’t move at all.

2 Likes

Good catch! Yes, the motors do not spin when I make then rotate to position 0 after the position reset.

So it looks like my issue is when I read the position using “Motor position in degrees”. This variable is not reset after I set Motor Position to 0.

1 Like

Try printing the Motor Position to the brain and see if the number resets along with the motor reset

2 Likes

Thanks thorstenl312! That’s what I did. Printing that variable would not show 0.

I am using code that was generated from a previous version of IQ Blocks. I remember seeing reported issues with devices not being updated properly when renamed. Maybe there are some incorrect references somewhere in the code.

I will try to rebuild the code to see if that helps.

1 Like

We noticed the same issue – it only seems to apply to motors that are reversed. See this simple test program

72160693_835118856948429_1173756889175949312_n

you would expect for it to print 0, but it does not.

2 Likes

Per this thread:

We identified the bug in question and will have it fixed for the next release in a few weeks.

2 Likes