Shafting coder/quad coder coding issues in latest robot c update. PICTURES INCLUDED PLEASE HELP QUICK

My problem as it sits is simple but complicated are school has a robotics class and are teacher was trying to work the quad coders or shafting coders. We were using the regular 393 model motors and as a brand new lesson never taught before accept to us now we are using these for are first time. The teacher was going to use them last year but there wasnt enough time. So we are all just as confused. We assumed the position is on the shaft similar to a 393 but the code is different since it uses revolutions instead of time but my teacher and even i cant seem to wrap are heads around it. So i came here to message for him since i know how to use forums as i frequent reddit

Picture Of Shafting Coder
shafting%20coder

Picture Of Base Code To Work Around Were Just As Lost As We Sound Here Seriously I Have No Idea If Were Even Close To Being On The Right Track

Oh and for those who respond and wonder why the pictures are discord links. Im on my personal laptop and school and the fastest way to post this was to save it to discord then save the picture from there in a link format

OK, off the top of my head I see two problems with your code.

The first is syntax-related. While statements should look like this:

while (some_condition){
    //do something
}

Note the curly braces around the things you want to do, and the parentheses around the conditional statement.

The second thing is that once the encoder exceeds a value of 720, you have to tell the motors to stop.

Implementing both those suggestions would yield the following code:

while (SensorValue[R.Enc] < 720) {
    motor[Right] = 127;
    motor[Left] = 127;
}
motor[Right] = 0;
motor[Left] = 0;

This should work, assuming you have all the motors and sensors configured correctly in the ROBOTC configuration wizard.

3 Likes

Some slow talking non-programmer made a set of videos 5 years ago that could possibly help you get started. The first part of this video covers simple (non-pid) OSE code. GL

1 Like

Thanks to both of you guys huge help since while my teacher understands this stuff its even his first time messing with shafting coders. The only reason we bothered is for more accuracy since one of are goals is to move three colored vex blocks around a maze. And considering 393 motors with the vex wheels are hardly accurate on shop floor tile as it is we really needed these so you guys are a huge help.

Also yeah since my last fiasco on my third week in the class when we just started coding i now every time even if i know its saved check that the motor and sensors and such are configured as well as making sure every bolt on the physical bot is tightened before any tests since this would lead to a immeasurable amount of variables especially on the physical side

Please call it by it’s correct name, either “Optical shaft encoder” or “Quadrature encoder”.

On the product page

You will find several links including one with some simple ROBOTC example code.

6 Likes

But a shafting coder is more evocative. Why was the programmer so angry, and what did she shaft?

1 Like

They shafted the encoder.

Where I come from it means something pretty rude, I guess that’s why I reacted.

I think they didnt mean it in a rude way. Just was desperate that’s all

Thank you for all the info and replies and to the last two i was not only very desperate and i know in certain places that phrase sounds phalic however i did still abbreviate it as a quad coder

Ok, so we’re still missing something. Have tried even a sample code from robotc that ran our drive train, but did not stop motion at a specified number of ticks. Sensor debugger window shows the quad. encoder counting up, and exceeding the value of the variable placed in our code. So I know the sensor is doing its thing, I know the cortex is seeing it. Is there an update? I read somewhere online there was a specific update version for making this work. Have updated our cortex, with obviously no improvement. Physical wire connections match motor/sensor set up. Very much at a loss of what to try or where to look for a problem.

Thanks all

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