You are on page 1of 13

Studica Toolkit Guide

This guide will instruct you on how to install the Studica Toolkit into your LabVIEW and show you how
each VI is set up so that you can use them for your projects with the NI myRIO.

Installing the Toolkit


Start by locating the VI package file

Installing the programming tools


To begin installation, double click the VI package file. If you have not already installed the VI Package
manager software, you will be prompted to so. Simply follow the prompts on the screen to guide your
through the process.

After the VI Package manager software is installed, double click the VI Package file once more to start
the installation of the tools. Follow the prompts on the screen to complete the installation.

After the installation is finished, the installed Studica Toolkit myRIO programming VIs can be located on
the LabVIEW programming palette.

1
Each of these VI tools can be used to construct a LabVIEW program for controlling a WorldSkills robot
with motors, sensors and myRIO. An adapter interface board developed by Digilent and included in each
WorldSkills Robotics Collection with myRIO bundle must be used to ensure proper connection and
communication between the T motor controllers and the myRIO controller.

4 Motor Driver
This vi is used to control up to 4 DC Motors with the myRIO using a PWM and Digital signal.

2
 Motor A0 Duty Cycle: Specifies the percentage of time the PWM signal remains high over one
PWM cycle. This Duty Cycle is connected to APWM 0.
o The Digital Direction port is connected to ADIO6
 Motor A1 Duty Cycle: Specifies the percentage of time the PWM signal remains high over one
PWM cycle. This Duty Cycle is connected to APWM 1.
o The Digital Direction port is connected to ADIO10
 Frequency [Hz]: Specifies the frequency in hertz of the PWM signal. Check H-Bridge data sheet
to figure out recommended Hz. Typical is 1000 Hz, although you can play with this number for
better results.
 Motor B0 Duty Cycle: Specifies the percentage of time the PWM signal remains high over one
PWM cycle. This Duty Cycle is connected to BPWM 0.
o The Digital Direction port is connected to BDIO6
 Error in (no error): Describes error conditions that occur before this node runs.
 Motor B1 Duty Cycle: Specifies the percentage of time the PWM signal remains high over one
PWM cycle. This Duty Cycle is connected to BPWM 1.
o The Digital Direction port is connected to BDIO10
 Error out (no error): contains error information. If error in indicates that an error occurred
before this VI or function ran, error out contains the same error information. Otherwise, it
describes the error status that this VI or function produces. Right-click the error out front panel
indicator and select Explain Error from the shortcut menu for more information about the error.

Duty Cycle Inputs: Use these inputs into the duty cycles to control the motor speed and direction.
Closer the value to 0 the faster the motor spins.
Forward Reverse Stopped
0.01 to 0.99 -0.01 to -0.99 1

2 Motor Driver
This vi is use to control 2 DC Motors with the myRIO using a PWM and Digital signal.

3
 Motor 0 Duty Cycle: Specifies the percentage of time the PWM signal remains high over one
PWM cycle.
 Motor 0 Channel: Specifies what Channel the Motor is plugged into on the myRIO. For Motor 0
it will be either the APWM 0 or BPWM 0. The Driver will automatically change the direction port
to match the MXP side. If using the MXP A side the direction port is ADIO6, if using the MXP B
side the direction port is BDIO6.
 Frequency [Hz]: Specifies the frequency in hertz of the PWM signal. Check H-Bridge data sheet
to figure out recommended Hz. Typical is 1000 Hz, although you can play with this number for
better results
 Motor 1 Duty Cycle: Specifies the percentage of time the PWM signal remains high over one
PWM cycle.
 Error in (no error): Describes error conditions that occur before this node runs.
 Motor 1 Channel: Specifies what Channel the Motor is plugged into on the myRIO. For Motor 1
it will be either the APWM 1 or BPWM 1. The Driver will automatically change the direction port
to match the MXP side. If using the MXP A side the direction port is ADIO10, if using the MXP B
side the direction port is BDIO10.
 Error out (no error): contains error information. If error in indicates that an error occurred
before this VI or function ran, error out contains the same error information. Otherwise, it
describes the error status that this VI or function produces. Right-click the error out front panel
indicator and select Explain Error from the shortcut menu for more information about the error.

Duty Cycle Inputs: Use these inputs into the duty cycles to control the motor speed and direction.
Closer the value to 0 the faster the motor spins.
Forward Reverse Stopped
0.01 to 0.99 -0.01 to -0.99 1

Parallax PING Read Distance


This vi is used to read the distance from a Parallax Ping sensor on a myRIO.

4
 myRIO DIO Channel: is the digital channel that the signal port of the Ping sensor is connected to
on the myRIO.

 Temperature (deg C): The ping sensor uses ultrasonic sound waves to detect distance adding
the temperature to the calculations allows for a more accurate read. Input the current
temperature into this input in deg Celsius.

 Error in (no error): Describes error conditions that occur before this node runs.

 Error out (no error): contains error information. If error in indicates that an error occurred
before this VI or function ran, error out contains the same error information. Otherwise, it
describes the error status that this VI or function produces. Right-click the error out front panel
indicator and select Explain Error from the shortcut menu for more information about the error.

 Distance (m): returns the distance in front of the Ping sensor in meters. If the distance is out of
range or there is something wrong the output will read -1.

Parallax Gyroscope L3G4200D


These vi’s allow for the reading of the Parallax Gyroscope L3G4200D. In order to read the values, the
Gyroscope needs to be opened first.

Parallax Gyroscope L3G4200D Open

5
 I2C Channel: Specifies the I2C channel you want to use for writing data to or reading data from
the I2C slave device.

 SDO pin high? (T): Serial Data Output. Should always be true no need to put an indicator on it.

 Full Scale Selection: Select from 250/500/2000 degrees/sec accuracy of the gyro. Smaller the
robot smaller the scale.

 Error in (no error): Describes error conditions that occur before this node runs.

 Error out (no error): contains error information. If error in indicates that an error occurred
before this VI or function ran, error out contains the same error information. Otherwise, it
describes the error status that this VI or function produces. Right-click the error out front panel
indicator and select Explain Error from the shortcut menu for more information about the error.

 Gyroscope Ref Out: gives the I2C channel and all other information data in a cluster to the
Gyroscope read vi.

Parallax Gyroscope L3G4200D Read


After the Gyroscope is opened it is possible to read data from it.

6
 Gyroscope Ref in: is the reference data coming from the open vi.

 Gyroscope Ref out: sends the reference data to the close vi.

 X angular velocity (dps): gives you the X axis velocity in degrees per second.

 Y angular velocity (dps): gives you the Y axis velocity in degrees per second.

 Z angular velocity (dps): gives you the Z axis velocity in degrees per second.

 Raw Data: Gives the raw data coming from the gyroscope.

 Error in (no error): Describes error conditions that occur before this node runs.

 Error out (no error): contains error information. If error in indicates that an error occurred
before this VI or function ran, error out contains the same error information. Otherwise, it
describes the error status that this VI or function produces. Right-click the error out front panel
indicator and select Explain Error from the shortcut menu for more information about the error.

Parallax Gyroscope L3G4200D Close


After you are done reading the gyroscope you can shut it down by using the close vi.

 Gyroscope Ref in: gyroscope reference coming in from the read vi

 Close I2C ref? (F): Close the I2C reference, yes closing the reference is what you want so make
this true by using a True constant. This will cause a I2C dump.

7
 Error in (no error): Describes error conditions that occur before this node runs.

 Error out (no error): contains error information. If error in indicates that an error occurred
before this VI or function ran, error out contains the same error information. Otherwise, it
describes the error status that this VI or function produces. Right-click the error out front panel
indicator and select Explain Error from the shortcut menu for more information about the error.

Basic Diagram All Together

As you can see the Open.vi gets initialized outside of the while loop before it starts. Inside the while loop
the read.vi will constantly be giving you the data until you press the stop button. After the loop has met
its stop condition it will travel to the close.vi and the gyroscope will power down successfully.

Encoders
Natively the myRIO has 4 encoder inputs. 1 on each MXP and 2 on the DAQ side.

A & B MXP Connections

DAQ EN0 Connections

8
DAQ EN1 Connections

Encoder Express

 Error in (no error): Describes error conditions that occur before this node runs.

 Error out (no error): contains error information. If error in indicates that an error occurred
before this VI or function ran, error out contains the same error information. Otherwise, it
describes the error status that this VI or function produces. Right-click the error out front panel
indicator and select Explain Error from the shortcut menu for more information about the error.

9
 Reset Counter: Specifies whether to reset the encoder tick counter to zero. The default is FALSE.

 Counter Value: Returns the number of ticks that this Express VI reads from the encoder since
the last counter reset. Counter Value can be in the range from -2,147,483,648 to 2,147,483,647.

 Counter Direction: Returns the direction of the counter between the last two ticks that the
encoder receives.

 Overflow: Returns whether the counter value wraps back to zero. Overflow? returns TRUE
when the value of the counter goes from the maximum value to the minimum value or from the
minimum value to the maximum value. After this Express VI reads the count value once,
Overflow? changes to FALSE until the counter value wraps back to zero again.

Getting the Encoder to read distance traveled in inches

The express vi will give the ticks per revolution and with some math you can convert that into inches or
cm.

To start we divide the counter value by the known ticks per


revolution. To find the ticks per revolution refer to you data
sheet for the encoder you are using. By dividing we then know
how many times the wheel has rotated.

10
Then we take the circumference of our wheels (in inches) and
multiply it by pi. *Notice how the Ticks per Rev and the Wheel
Circumference are controls as you may decide you change encoders
with a different tick per rev count or put on bigger or smaller wheels

Then multiply both those together. By doing this we are taking


the circumference and multiplying it by the amount of rotations
giving you the distance traveled. If you were to add an indicator
here you will have the distance traveled in inches.

To find the distance in cm we


have to multiply the value by 2.54
which is how many cm are in a m.

11
This only works if the encoders are on a 1:1 ratio with the shaft of the motor. If not you have to multiply
in the gear ratio you have it at. For example if we have a 1440 tick encoder, and our gear ratio is 30:1.
Meaning that the motor shaft will spin 30 times for one wheel rotation. So in order to get an accurate
count we would multiply 30 by 1440 and we get 43200. So in the Tick per rev we would have 43200
instead of 1440.

Encoders on Toolkit
An easier way then using the express is to just use the encoder vi’s on the Studica Toolkit.

2 Encoders

This vi allows for the use of two encoders and gives back distance in inches

 Wheel Circumference (inches): input for the diameter of your wheels in inches.

 Ticks per Rev: Is the pulses per revolution on the encoder. Check your data sheet.

 Encoder 0 Channel: Is the channel for the first encoder.

 Encoder 1 Channel: is the channel for the second encoder

 Encoder 0 Distance: is the distance the encoder has traveled in inches.

 Encoder 1 Distance: is the distance the encoder has traveled in inches.

 Reset Counter: Resets the encoder counts to 0.

 Error in (no error): Describes error conditions that occur before this node runs.

 Error out (no error): contains error information. If error in indicates that an error occurred
before this VI or function ran, error out contains the same error information. Otherwise, it

12
describes the error status that this VI or function produces. Right-click the error out front panel
indicator and select Explain Error from the shortcut menu for more information about the error.

4 Encoders

This vi allows for the use of 4 Encoders.

 Wheel Circumference (inches): input for the diameter of your wheels in inches.

 Ticks per Rev: Is the pulses per revolution on the encoder. Check your data sheet.

 Reset Counter: Resets the encoder counts to 0.

 A Encoder Distance (inches): is the distance traveled on the MXP A Encoder in inches.

 B Encoder Distance (inches): is the distance traveled on the MXP B Encoder in inches.

 C Encoder 0 Distance (inches): is the distance traveled on the DAQ C0 Encoder in inches.

 C Encoder 1 Distance (inches): is the distance traveled on the DAQ C1 Encoder in inches.

 Error in (no error): Describes error conditions that occur before this node runs.

 Error out (no error): contains error information. If error in indicates that an error occurred
before this VI or function ran, error out contains the same error information. Otherwise, it
describes the error status that this VI or function produces. Right-click the error out front panel
indicator and select Explain Error from the shortcut menu for more information about the error.

13

You might also like