When you set up the Robotics Starter Kit robot, the printed Quick Start Guide in the kit instructs you to use the Robotics Project Wizard to create and deploy a ready-to-run application to the robot. If you want to program the robot to behave differently, you can modify the VIs in the LabVIEW project the wizard creates or create a new project for the Starter Kit robot.
|Note You must install all software on the LabVIEW Robotics Starter Kit DVD before you can use the Starter Kit VIs with a real Starter Kit robot.|
An important part of programming the Starter Kit robot is communicating with the FPGA on the Single-Board RIO (sbRIO) to control the motors and distance sensor. When you want to program the FPGA on National Instruments RIO hardware targets, such as the sbRIO on the robot, you typically must develop a real-time application with FPGA components that directly interface with FPGA I/O. With the Robotics Starter Kit, instead of writing an FPGA VI to directly control the FPGA, you can use the Starter Kit VIs to control the motors and sensor wired to the FPGA. The following table describes how the two methods for communicating with the FPGA on the robot differ.
|Programming method||Writing an FPGA VI||Using the Starter Kit VIs in a real-time host VI|
|API to use in RT host VI
to communicate with FPGA
|Starter Kit VIs|
|Note If you modify or expand the I/O on the FPGA, you might need to write an FPGA VI instead of using the Starter Kit VIs.|
The Starter Kit VIs communicate with the FPGA on the robot similarly to how sensor drivers communicate with sensors. For example, as described in the following sections, typical Starter Kit applications start a communication session with the FPGA, read from and write to the FPGA, and then close the communication session.
|Note (Starter Kit 2.0) You must configure the sbRIO-9632 chassis to use the LabVIEW FPGA Interface programming mode or the Starter Kit VIs do not run on the sbRIO. To configure the programming mode, right-click the sbRIO chassis in the Project Explorer window and select Properties from the shortcut menu to display the Single-Board RIO Chassis Properties dialog box. Select LabVIEW FPGA Interface in the Programming Mode section.|
The Starter Kit initialization VIs return a reference to the interface with the FPGA, which you use throughout the host VI to access I/O on the FPGA. For example, you can wire the reference to the Write DC Motor Velocity Setpoints VI to write the velocities at which you want the DC drive motors to move.
The Starter Kit robot is designed to move autonomously, without direct control by an operator. To program the robot to operate continuously, place code to control the robot inside a loop that runs and then repeats itself. For example, if you want the robot to continuously move forward until the distance finder detects an obstacle, place a loop that reads from the distance sensor and writes velocities to the drive motors based on the presence of obstacles. You also might want to program the sensor servo to pan back and forth so the distance finder scans a wider radius around the robot. In this example, you can use a loop to supply a new angle to the Write Sensor Servo Angle VI on each new loop iteration to implement a panning motion. Use shift registers to pass values and the FPGA interface reference between loop iterations.
|Tip Use a Timed Loop to implement precise control of timing in the loop, such as the period of loop iterations and the priority at which to run the code in the loop relative to other block diagram code.|
Refer to the Starter Kit 1.0.lvproj in the labview\examples\robotics\Starter Kit 1.0 directory for an example of using the Starter Kit VIs to control the Starter Kit 1.0 robot.
Refer to the Starter Kit 2.0.lvproj in the labview\examples\robotics\Starter Kit 2.0 directory for an example of using the Starter Kit VIs to control the Starter Kit 2.0 robot.
Use the Close Starter Kit VI to end the communication session with the FPGA. When this VI ends the communication session, the drive motors, sensor, and sensor servo stop moving.
As mentioned previously, the Starter Kit VIs are designed to communicate with the sensor and motors wired to the FPGA on the robot. However, an important part of controlling the robot is calculating values to write to those devices. The following sections describe methods for implementing code that does not directly relate to communication with the FPGA.
In a Starter Kit application, you might want to control the speed of the robot by specifying one overall velocity value. However, because the left and right drive motors on the robot connect to separate lines on the FPGA, the Write DC Motor Velocity Setpoints VI requires you to write the desired velocity for each motor. You can use the Steering VIs to convert between an overall velocity value and individual motor velocities and perform other functions related to controlling the steering of the robot.
To integrate the Steering VIs with a Starter Kit application, use the Create Starter Kit Steering Frame 1.0 VI or Create Starter Kit Steering Frame 2.0 VI from the Starter Kit palette to generate a steering frame object for the robot. The object contains information required to calculate velocity values, such as the types and locations of wheels on the robot. Use the object with the Steering VIs to calculate appropriate velocities for the motors. The following block diagram shows an example of integrating the Steering VIs with the Starter Kit VIs to drive a robot.
To complement the Starter Kit VIs, use other LabVIEW VIs and functions to calculate values you want to write to the sensors and actuators on the robot. The Angle VIs and the Scaling VIs allow you to convert between units commonly used in robotics applications. For example, you can use the Degrees to Radians VI to convert angles expressed in degrees to angles expressed in radians.
The Robotics palette provides other VIs for designing robotics-related algorithms.
Although the Starter Kit VIs abstract the interface between VIs and the FPGA, you still can access certain unused analog and digital I/O on the FPGA. Use the Direct Input and Output VIs with the reference to the FPGA interface to read from or write to these analog and digital lines on the FPGA. Like the Starter Kit VIs, the Direct Input and Output VIs allow you to interact with the FPGA without writing an FPGA VI.
|Note To modify the default configuration of the FPGA or connect devices to I/O lines that the Direct Input and Output VIs do not support, you must write an FPGA VI to access the I/O instead of using the Starter Kit VIs.|
You can use the Starter Kit VIs in an application that controls a simulated Starter Kit robot. Then, you can use the same LabVIEW project and VIs to deploy the application to the sbRIO on a real Starter Kit robot.