First time with Sensors

In the previous year we used timing for our autonomous, but with the bump, this year we would like to use sensors for our autonomous. To my understanding, for quadrature encoders do you guess and check values or is there a way to see how many times it turned, same question for potentiometers, can you read the value or is it guess and checking? One more slightly related question, what is the advantage of the orange programming kit and module over an A to A cable? Any help or miscellaneous autonomous related advice would be appreciated.
Thanks, Daniel

The advantage of the orange programming kit and module is that you won’t have to guess and check sensor values. Instead of plugging the cable directly into the cortex, you plug it into the joystick, which is connected to the cortex via VEXnet. Using that cable you can still download code, but can also use the debugger in RobotC, which allows you to read values such as how many times encoders have turned and potentiometer values. This PDF has a lot of useful information about it.

Basically, all you have to do is download the code and click the button that starts the debugger, and then all your sensor values will appear on screen!

I’m sure Aashray can help you with most of it :wink:

Okay, looks like we will be picking up programming hardware kit then.
Thanks for the help, Daniel

First off, easyC or ROBOTC?

Quadrature Encoders:
You can read Quad Encoder values using whichever IDE you use (let me know and I can share more instructions). You can make the robot go x inches, find out how many ticks the encoder has gone. You can now create a conversion factor (divide x inches over y ticks). Personally, I find that you are almost always more accurate to always read the values (rather than running through a conversion process). Whilst they are theoretically correct, you will nearly always have just a tiny bit of error, due to rounding, etc.

Potentiometers:
The gig is the same quadrature encoders. You can read the values off of either IDE. I wouldn’t ever use a conversion process because potentiometers read degrees. Since most applications of a potentiometer would have you moving an arm to a certain number of degrees, just having the value as a constant variable would be much easier.

Programming Module vs USB A-A:
Typically a USB A-A cable is all that is required. A Programming Module is beneficial when you want to download code wirelessly. You use the programming module to connect to your VEXNet Joystick, which is connected to your microcontroller/robot. As I am sure you can imagine, having a programming module can be extremely beneficial in certain circumstances, but the extra cost and hassle may not always be worth it. Also, I’ve noticed that you encounter more errors downloading wireless (with the module) than hardwire (USB A-A).

#protips:

  • Never reposition your robot during autonomous. By this I mean, don’t have the robot go back to the starting tile to be repositioned. It’s a waste of time where you could be scoring. This is especially important this year.
  • Do your best to compensate for original positioning errors. Sensors such as line followers and ultrasonics accomplish this. They rely on the field being set up correctly, rather than the robot in the first place.

Our team uses RobotC, if we were to use line followers and ultra sonic sensors, how many would you need of each? And what positions would they be in? So would we have two ultrasonics saying for instance to continue forward while exactly 2.5inches from the wall, or what would you tell the robot to do regarding the line followers and ultrasonics?

To move the robot exactly 2.5" from the wall would require only one ultrasonic facing the rear of the robot.
Line sensors work best (IMO) when they’re at the center or just in front of the center of rotation. You would use at least three line followers immediately next to each other. Line followers work by acting as a trigger. If the left line follower is on the line, the robot should turn left. If the right line follower is on the line, turn right. If the center line follower is on the line, go straight. It’ll probably be easier for you to sketch it out (rather than by text).

P.S. I would recommend mastering quad encoders/potentiometers before using any other sensor. Quadrature encoders and potentiometers have the widest usage and easiest to master. Getting a robot to stop with line followers can sometimes be tricky, and you simply can’t run an entire autonomous with only ultrasonic sensors (even though they are simple to program).

--------------------Finding Sensor Values on ROBOTC -------------------
After finishing downloading your code to your robot, the debugger will start. Clicking Start runs your program that you just downloaded. On the bottom of the ROBOTC window, there is a pane that has several different tabs. One of those tabs says “Sensors”. Click it. You can now see all of your sensor values that you’ve mapped.
If you can’t see the tab named Sensors, go to the top toolbar click Robot → Debugger Windows → Sensors.

You can see these sensor values in the debugger without the orange module? Just a simple A to A cable?

Yes, you can see them with any kind of connection method.

The programming module is technically a legacy product. It was the only way to connect to the old 0.5 Microcontrollers (PIC). Today, the only major reasons they’re around is because a) PICs are still popular in the classroom and b) the reasons discussed above. I’m sure VEX (and others) have other reasoning, but these are the big two I can think of.

Okay, you have been very helpful, thank you.
Daniel

How do you plan on using line follower sensors with the bump. I don’t see them being useful when 2.5 inches away from the ground.

huh? I think you misread. Besides, so long as you’re not doing a 4-wheel chassis, you would generally be OK with not hitting the bump. As far as going over the bump without line follower guidance, I prefer to think of that as a challenge that I will leave up to others to find a solution :slight_smile: That further reinforces my point that line followers should be the last thing to add to your autonomous.

Quadrature encoders work great, if you are using 4" wheels it works out to 28.6 pulses per inch, if you do your initial programming using around 24 per inch it will compensate for some of the over-run you get before the robot comes to a complete stop. That will get you in the ballpark and allow you to tweak your code.

Make sure you put this math in your notebook, working your autonomous out with a flow chart and some simple algebra might be your ticket to worlds :wink:

I believe the 2.5 is from the random example I used above regarding ultrasonic sensors.

No, he’s talking about keeping them clear of the bump.

They can be right on the ground as usual, but they need to be directly lined up front to back with a wheel so the wheel will keep them off the bump.

That is what I was wondering about. I might give it a shot but the required clearance on the chasis should affect were the line follower can go

The line followers just need to line up with the wheels front to back so that they are only over the bump when a wheel is over the bump… Wouldn’t be hard at all.

in sack attack i only just started using sensors, i bought the following …

-programming hardware kit

  • 2 sets of potentiometers
  • 1 set of quad encoders
  • sonar (ultrasonic sensor) (1)
    i found the above items ok for a medium routine

this year, i am investing in three sets of integrated motor encoders so i can basically have an encoder on all my motors, this is to b used to upgrade our programming skills match as we did a very basic one last year and it failed alot

i find that sensors like encoders, potentiometers, IME’s and sonar sensors work well ! my advice … buy these sensors !

good luck with VRC :smiley:

This has been brought up but there is a slight difference between regular shaft encoders and quadrature encoders (other than obviously 1 & 2 PWM cables). Quadrature encoders are able to sense in 2 directions. That is to say, if your robot drives forward a foot, and then back a foot, the two sensors will read differently:

Regular Shaft Encoders will give a value of say, 800. 400 forward, and another 400 ticks back.

Quadrature Encoders will have a value of 0 at the end of the program. They will increase forward to 400, and then decrease back to 0 as the robot drives backwards. (The embedded encoders are quadrature)

However, despite these differences, in 95% of applications there is no advantage to using quadrature encoders. You will always know when your robot is driving backwards, and when it is driving forwards, as you are giving the commands. Quadrature encoders are useful in very advanced programming to account for things like other robots pushing you. I have never seen a VEX application for encoders where regular encoders to be used.

My personal recommendation is to purchase the advanced sensor kit, found here: Advanced Sensor Kit - VEX Robotics

The quadrature encoders are purchased separately, and are more expensive (http://www.vexrobotics.com/276-2156.html). Save yourself the money and buy regular shaft encoders.. Save yourself the money and buy regular shaft encoders.)

Perhaps I am mistaken for I have the red plastic encoders found in your first link, I am probably just referring to them as the wrong thing.

Edit: if you click the shaft encoder link from the kit contents on the first link, you end up at the same place as the second link.

). Save yourself the money and buy regular shaft encoders.

Actually, VEX no longer sells the old single-wire encoders. There seems to be some confusion as to the naming convention on the Product Pages.

On the Advanced Sensor Kit Product Page, the list calls the encoders “Optical Shaft Encoders,” which I believe is what the old single-wire encoders used to be called, whereas the new ones were originally named “Quadrature Encoders.”

However, under “Kit Contents” on the same page, while it says it includes the kit [Optical Shaft Encoder kit, it says that kit includes two “Optical Shaft Quadrature Encoders.” This is also the name listed in the kit contents on the Optical Shaft Encoder’s Product Page.

Either way, the only sensor that VEX sells anymore is the two-wire encoder, and that is what comes with the Advanced Sensor Kit.

~Jordan](“Optical Shaft Encoder (2-pack) - VEX Robotics”)