Posts Tagged ‘Sensors


FRC build week 2 musings

I hope everyone’s Robot planning is going well. I’m also hoping all the teams have their strategy down and have a plan to fit the Robot to the strategy. Make sure whatever strategy is chosen is done well. If it’s a defensive strategy make sure the Robot is built to push other Robots around or to be the best blocker possible. If you have a scoring robot, make sure you can score quickly and efficiently.

The Kit Of Parts (KOP) came with many sensors, everyone should try to make use of them where they can. The sensors can be used to aid the driver in Robot operation and to help in autonomous mode. Some of the sensors like the wheel encoders can let you know the distance you move. The linear encoder can help the Robot tell the distance an actuator moves. The gyro can help your robot tell which direction it is pointing. All the sensors have examples that are runnable. To get to them, open LabVIEW and in the lower right hand corner of the opening screen are the FRC examples. All examples have diagrams of how to hookup the sensor. Also, all the data sheets are located on the site Make sure you scroll down.

Right now is a very important time in the build, some parts of the Robot are coming together well, some parts are not coming together and are in need of redesigned. Don’t get discouraged, just keep working at it. There are only four weeks left in the build season but it is plenty of time to get things together.

One thing people should think about is Prototyping. Prototyping is to build a quick and dirty model of whatever you are prototyping. One example is the kicker on last year’s robot. We (team 704) built a wooden frame, screwed it down to the floor and then used different things to kick a soccer ball. We made a kicker and tried various pneumatics, surgical tubing, and bungee cords. We made prototypes of different ways to kick a soccer ball. This year you might prototype various ways to put the game pieces on the scoring pegs. Come up with a way to score the game pieces and build something to try out your ideas.

It’s important to get your robot to a point you can test it before the ship date. Getting out there and running it through its paces is a key to success. Last year’s FRC challenge contained humps the robot had to go over. Our robot was ready somewhat early (a week early) and so we did some testing on a practice field.

During testing last year, after a couple of test runs our chains started to fall off and this bent axle is what we discovered. This along with a torn aluminum pan holding the battery. You don’t want to find out about this during the competition.

Good luck to all. Figure out what to do and do it.


FRC Touch Sensor

Sensor’s come in handy in Robots. Sensors can be used when the robot is autonomous or when the driver needs some help. In the breakaway game, to help the driver we used the camera to see the ball on the far end of the field and to line up on the target from the middle area. Touch sensors could have been used to sense when the ball was in place and ready to be kicked or distance sensors on each side to help go through the tunnel. And I’ve already talked about encoders to move specific distances.
For next year’s FRC game who knows what sensors can be used. So you need to be ready and understand how sensors work and how you get information from them.
I’ve put in these links before but they are important learning about sensors. National Instruments has some good papers on sensors and their effective use. They have some basic sensor information and their basic paradigm is ”Sense Think Act”.
Digital I/O (DIO) is one of the simplest Sensor inputs. This can be used for touch sensor to tell when you’re against a wall or when something is in place. To get to the Digital IO go to the WPI Robotics Library >> IO >> Digital IO >> DigitalInput pallet.
> IO >> DIO” />
In the DIO example it show’s on the blue digital sidecar that there’s a signal diagram showing three connections, a positive, power, and a signal. For a simple touch sensor, electronics store have some touch sensor switches. Or a simple switch for touch can be built with some stiff wire going through a loop as shown below.

The resistor should be a 2.5 Kohm. The 5Volts will make the value hi when the wire through the loop is not touching. When the ground wire touches the loop it will ground the signal to a 0.

The LabVIEW code from the example is shown below.

The block diagram shows the Digital IO is opened according to the slot the DIO module is in and the DIO line. This example will simply show the value coming in from the digital IO line on the front panel. However, this can be used to sense when something is being touched, a wall, a ball is in the right place, or you’re in contact with a tower. It’s simple but very useful.
More about sensor’s next week.


FRC – Sensor basics – Encoder

Sensors are the way the robots interact with the world when not being controlled by the driver. NI has some basic sensor information.
They can also help the driver with operations for control. The basic paradigm for using sensors is Sense Think Act. This link has some good information on the Sense Think Act paradigm.
Think Sense Act means to use the Sensors to sense the world, distance, objects, orientation. Process and integrate the data from the various sensors. And then act on it, move in the direction or do an action based on that data.
The first thing to do is understand the sensors, how they’re used, and how to communicate with them. Some of the easiest sensor communication is digital I/O. Sensors like limit use digital I/O (DIO). The compressor pressure switch also uses DIO. DIO indicates on or off, it’d that simple. From there some thinking has to occur. “Are we at a limit?” “How many times has a DIO turned on?” Things like that.
Another easy to use interface is Analog Input. Analog input measures the input voltage of a sensor. Distance sensors are a good example of how an Analog Input can operate. Some distance sensor output a higher voltage when an object is close and a lower voltage when an object is farther away. The voltage would have to be calibrated to distance. Just note that not all Distance sensors are analog input.
Some sensors have serial communications. This can be a little more complicated than the simple DIO or Analog In data but you can get a lot more information from sensors and data can be sent to the sensor for various reasons.

Blocks for sensor communication

There many different serial communications protocols. A protocol is the process for sending and receiving data. Who sends what, when, and in what order. Serial, I2C, and SPI are two of the protocols supported by the robot code. There are blocks for standard serial communications, I2C communications, and SPI communications in the WPI Robotics library
Each device that uses serial communications has individual commands and responses based on the sensor. The user’s manual should have information on how to communicate.
The WPI Robotics Library has interfaces to most of the sensors used by the FRC robots. This makes it easy to interface with the standard sensors.

In my opinion, one of the more useful sensors are the wheel encoders. There are examples, sample code, and blocks to support them. Encoders can tell how far your robot has moved. It’s based on the number of DIO “ticks” happen. Ticks are each time a DIO line goes high then low. Each tick represents a distance. The number of ticks for a distance is determined by seeing how many ticks it is for one rotation of the wheels and figure the distance traveled with one rotation of a wheel. After that, if you want to go a certain distance, divide the distance to go by wheel rotation distance and multiply by ticks. That will give you the number of ticks it takes to go a distance.
# ticks = (D / Cw) * tick per rotation
D is distance to go
Cw is Circumference of wheel (wheel base)

If you want to turn, you have to have one wheel encoder go more than the other wheel encoder. To do a turn where one side wheels don’t turn and the other turns the robot you need to have the wheel encoders on one side move while the others stay in place.
There is a good encoder example for the encoders that come in the Kit Of Parts. From the LabVIEW opening screen, in the lower right hand corner, there is an examples area. At the bottom of that, there is a “more…” folder. Click on that and look for the encoder example. Below are some pictures of the encoder example.

Encoder example front panel

Encoder example block diagram

On the front panel there is a picture of how to hook up the encoder and a ready to use block diagram for deploying to the robot. Hookup the motor encoder leads according to the picture and then hit the run arrow. This will deploy and run the example. The driver station must also be hooked up over the network, running, and enabled.
Notice in the block diagram there is an open, configure, and start blocks outside the while loop. The encoder get is inside the while loop and so that it will execute over and over. There is a 100 hooked up to a timer which means the loop will execute every 100 ms.
Before you run the code, if you click on the “highlight” execution button, in red above, you can follow the execution.
Encoders are an easy to use sensor that can really help, especially during autonomous mode.
More on sensors next week.

February 2018
« Jan