Upload
trantuyen
View
231
Download
1
Embed Size (px)
Citation preview
FTC Programming with App Inventor
David Austin
Allendale Robotics
HexaSonics, FTC Team 7023
David Austin FTC Programming with App Inventor
Point-to-point wireless communication
There is no longer a Field Control System.
Advantage: Running at an event is just like running in yourpractice space.
David Austin FTC Programming with App Inventor
Point-to-point wireless communication
There is no longer a Field Control System.
Advantage: Running at an event is just like running in yourpractice space.
David Austin FTC Programming with App Inventor
Driver Station
Set up one time:Download FTC Driver Station app from Google Play
“Forget” any wireless networksPhone in airplane modeRename under WiFi Direct: e.g. “7023-DS”Update app later in the seasonVery useful: the driver station app displays telemetry datawe can send back from the robot.
David Austin FTC Programming with App Inventor
Driver Station
Set up one time:Download FTC Driver Station app from Google Play“Forget” any wireless networks
Phone in airplane modeRename under WiFi Direct: e.g. “7023-DS”Update app later in the seasonVery useful: the driver station app displays telemetry datawe can send back from the robot.
David Austin FTC Programming with App Inventor
Driver Station
Set up one time:Download FTC Driver Station app from Google Play“Forget” any wireless networksPhone in airplane mode
Rename under WiFi Direct: e.g. “7023-DS”Update app later in the seasonVery useful: the driver station app displays telemetry datawe can send back from the robot.
David Austin FTC Programming with App Inventor
Driver Station
Set up one time:Download FTC Driver Station app from Google Play“Forget” any wireless networksPhone in airplane modeRename under WiFi Direct: e.g. “7023-DS”
Update app later in the seasonVery useful: the driver station app displays telemetry datawe can send back from the robot.
David Austin FTC Programming with App Inventor
Driver Station
Set up one time:Download FTC Driver Station app from Google Play“Forget” any wireless networksPhone in airplane modeRename under WiFi Direct: e.g. “7023-DS”Update app later in the season
Very useful: the driver station app displays telemetry datawe can send back from the robot.
David Austin FTC Programming with App Inventor
Driver Station
Set up one time:Download FTC Driver Station app from Google Play“Forget” any wireless networksPhone in airplane modeRename under WiFi Direct: e.g. “7023-DS”Update app later in the seasonVery useful: the driver station app displays telemetry datawe can send back from the robot.
David Austin FTC Programming with App Inventor
Driver Station
Before each match:Connect gamepads through a USB hub
Register gamepads with the Driver Station app“Start” + “A” for Driver 1“Start” + “B” for Driver 2
David Austin FTC Programming with App Inventor
Driver Station
Before each match:Connect gamepads through a USB hubRegister gamepads with the Driver Station app
“Start” + “A” for Driver 1“Start” + “B” for Driver 2
David Austin FTC Programming with App Inventor
Driver Station
Before each match:Connect gamepads through a USB hubRegister gamepads with the Driver Station app“Start” + “A” for Driver 1
“Start” + “B” for Driver 2
David Austin FTC Programming with App Inventor
Driver Station
Before each match:Connect gamepads through a USB hubRegister gamepads with the Driver Station app“Start” + “A” for Driver 1“Start” + “B” for Driver 2
David Austin FTC Programming with App Inventor
Robot Controller
The main task of the programming team is to write an FTCRobot Controller app.
Download a minimal version from Google Play
“Forget” wireless network, airplane modeRename under WiFi Direct: e.g. “7023-DC”Pair the Driver Station and Robot Controller:From the Driver Station: Settings −→ Pair with RobotControllerAccept the invitation on the controllerThe Driver Station and Robot Controller can nowcommunicate
David Austin FTC Programming with App Inventor
Robot Controller
The main task of the programming team is to write an FTCRobot Controller app.
Download a minimal version from Google Play“Forget” wireless network, airplane mode
Rename under WiFi Direct: e.g. “7023-DC”Pair the Driver Station and Robot Controller:From the Driver Station: Settings −→ Pair with RobotControllerAccept the invitation on the controllerThe Driver Station and Robot Controller can nowcommunicate
David Austin FTC Programming with App Inventor
Robot Controller
The main task of the programming team is to write an FTCRobot Controller app.
Download a minimal version from Google Play“Forget” wireless network, airplane modeRename under WiFi Direct: e.g. “7023-DC”
Pair the Driver Station and Robot Controller:From the Driver Station: Settings −→ Pair with RobotControllerAccept the invitation on the controllerThe Driver Station and Robot Controller can nowcommunicate
David Austin FTC Programming with App Inventor
Robot Controller
The main task of the programming team is to write an FTCRobot Controller app.
Download a minimal version from Google Play“Forget” wireless network, airplane modeRename under WiFi Direct: e.g. “7023-DC”Pair the Driver Station and Robot Controller:From the Driver Station: Settings −→ Pair with RobotController
Accept the invitation on the controllerThe Driver Station and Robot Controller can nowcommunicate
David Austin FTC Programming with App Inventor
Robot Controller
The main task of the programming team is to write an FTCRobot Controller app.
Download a minimal version from Google Play“Forget” wireless network, airplane modeRename under WiFi Direct: e.g. “7023-DC”Pair the Driver Station and Robot Controller:From the Driver Station: Settings −→ Pair with RobotControllerAccept the invitation on the controller
The Driver Station and Robot Controller can nowcommunicate
David Austin FTC Programming with App Inventor
Robot Controller
The main task of the programming team is to write an FTCRobot Controller app.
Download a minimal version from Google Play“Forget” wireless network, airplane modeRename under WiFi Direct: e.g. “7023-DC”Pair the Driver Station and Robot Controller:From the Driver Station: Settings −→ Pair with RobotControllerAccept the invitation on the controllerThe Driver Station and Robot Controller can nowcommunicate
David Austin FTC Programming with App Inventor
Robot Controller
More specifically, the main task of the programming team is towrite OpModes within the FTC Robot Controller app. But first,we need to configure the hardware within the controller app.With the phone connected to the robot, open the Controller app:
Settings −→ Configure Robot
Choose New and then Scan. This should detect the motorcontrollers and sensor module.Give each motor and sensor a name. You will need toremember these names so you may want to write themdown.Save the configuration and give it a nameSelect Activate to use this configuration in the controllerapp.
David Austin FTC Programming with App Inventor
Robot Controller
More specifically, the main task of the programming team is towrite OpModes within the FTC Robot Controller app. But first,we need to configure the hardware within the controller app.With the phone connected to the robot, open the Controller app:
Settings −→ Configure RobotChoose New and then Scan. This should detect the motorcontrollers and sensor module.
Give each motor and sensor a name. You will need toremember these names so you may want to write themdown.Save the configuration and give it a nameSelect Activate to use this configuration in the controllerapp.
David Austin FTC Programming with App Inventor
Robot Controller
More specifically, the main task of the programming team is towrite OpModes within the FTC Robot Controller app. But first,we need to configure the hardware within the controller app.With the phone connected to the robot, open the Controller app:
Settings −→ Configure RobotChoose New and then Scan. This should detect the motorcontrollers and sensor module.Give each motor and sensor a name. You will need toremember these names so you may want to write themdown.
Save the configuration and give it a nameSelect Activate to use this configuration in the controllerapp.
David Austin FTC Programming with App Inventor
Robot Controller
More specifically, the main task of the programming team is towrite OpModes within the FTC Robot Controller app. But first,we need to configure the hardware within the controller app.With the phone connected to the robot, open the Controller app:
Settings −→ Configure RobotChoose New and then Scan. This should detect the motorcontrollers and sensor module.Give each motor and sensor a name. You will need toremember these names so you may want to write themdown.Save the configuration and give it a name
Select Activate to use this configuration in the controllerapp.
David Austin FTC Programming with App Inventor
Robot Controller
More specifically, the main task of the programming team is towrite OpModes within the FTC Robot Controller app. But first,we need to configure the hardware within the controller app.With the phone connected to the robot, open the Controller app:
Settings −→ Configure RobotChoose New and then Scan. This should detect the motorcontrollers and sensor module.Give each motor and sensor a name. You will need toremember these names so you may want to write themdown.Save the configuration and give it a nameSelect Activate to use this configuration in the controllerapp.
David Austin FTC Programming with App Inventor
OpModes
Except for registering the gamepads and connecting thephones, everything we’ve seen so far only needs to bedone once.
Most of your programming time will be spent creatingopmodes. You will probably want to create a couple. Forinstance, one for teleop and at least one for autonomous.OpModes are created using an event-driven model, similarto how an Arduino is programmed.
David Austin FTC Programming with App Inventor
OpModes
Except for registering the gamepads and connecting thephones, everything we’ve seen so far only needs to bedone once.Most of your programming time will be spent creatingopmodes. You will probably want to create a couple. Forinstance, one for teleop and at least one for autonomous.
OpModes are created using an event-driven model, similarto how an Arduino is programmed.
David Austin FTC Programming with App Inventor
OpModes
Except for registering the gamepads and connecting thephones, everything we’ve seen so far only needs to bedone once.Most of your programming time will be spent creatingopmodes. You will probably want to create a couple. Forinstance, one for teleop and at least one for autonomous.OpModes are created using an event-driven model, similarto how an Arduino is programmed.
David Austin FTC Programming with App Inventor
The life cycle of an opmode
There are a small number of methods you need to construct todefine an opmode. (A method simply means a set ofinstructions grouped together.)
start(): This is executed once after you press the Startbutton on the Driver Station. Do some initialization in here;e.g. configure motors.
loop(): While the opmode is running, this method isexecuted roughly every 25 milliseconds. This is where youlisten for input from the gamepads and sensors and set themotors’ power levels. Most of your work will go in here.stop(): Instructions to perform when the Stop button ispressed; e.g. set the power of all the motors to zero.
David Austin FTC Programming with App Inventor
The life cycle of an opmode
There are a small number of methods you need to construct todefine an opmode. (A method simply means a set ofinstructions grouped together.)
start(): This is executed once after you press the Startbutton on the Driver Station. Do some initialization in here;e.g. configure motors.loop(): While the opmode is running, this method isexecuted roughly every 25 milliseconds. This is where youlisten for input from the gamepads and sensors and set themotors’ power levels. Most of your work will go in here.
stop(): Instructions to perform when the Stop button ispressed; e.g. set the power of all the motors to zero.
David Austin FTC Programming with App Inventor
The life cycle of an opmode
There are a small number of methods you need to construct todefine an opmode. (A method simply means a set ofinstructions grouped together.)
start(): This is executed once after you press the Startbutton on the Driver Station. Do some initialization in here;e.g. configure motors.loop(): While the opmode is running, this method isexecuted roughly every 25 milliseconds. This is where youlisten for input from the gamepads and sensors and set themotors’ power levels. Most of your work will go in here.stop(): Instructions to perform when the Stop button ispressed; e.g. set the power of all the motors to zero.
David Austin FTC Programming with App Inventor
The life cycle of an opmode
Soon, there will be a new button Init that can be used to, say,initialize servos or calibrate a gyro before Start is pressed. Youcan use these methods.
init(): Called once after Init is pressed.
init loop(): Called every 25 milliseconds after Init ispressed.
David Austin FTC Programming with App Inventor
The life cycle of an opmode
Soon, there will be a new button Init that can be used to, say,initialize servos or calibrate a gyro before Start is pressed. Youcan use these methods.
init(): Called once after Init is pressed.init loop(): Called every 25 milliseconds after Init ispressed.
David Austin FTC Programming with App Inventor
App Inventor
Let’s get started with App Inventor! You will:
Create code graphically in a web browser
Compile and download it as an .apk file onto your computerTransfer the .apk file to the phone and install the app (youmust first delete any earlier versions)Start the app and then connect to the driver station
David Austin FTC Programming with App Inventor
App Inventor
Let’s get started with App Inventor! You will:
Create code graphically in a web browserCompile and download it as an .apk file onto your computer
Transfer the .apk file to the phone and install the app (youmust first delete any earlier versions)Start the app and then connect to the driver station
David Austin FTC Programming with App Inventor
App Inventor
Let’s get started with App Inventor! You will:
Create code graphically in a web browserCompile and download it as an .apk file onto your computerTransfer the .apk file to the phone and install the app (youmust first delete any earlier versions)
Start the app and then connect to the driver station
David Austin FTC Programming with App Inventor
App Inventor
Let’s get started with App Inventor! You will:
Create code graphically in a web browserCompile and download it as an .apk file onto your computerTransfer the .apk file to the phone and install the app (youmust first delete any earlier versions)Start the app and then connect to the driver station
David Austin FTC Programming with App Inventor
App Inventor
You will need:
Google Chrome (Firefox works for me too)
VirtualBox. The instructions say it needs administrativeprivileges to install, but I was able to within them.Download the App Inventor appliance for VirtualBox.Start VirtualBox and import the appliance
David Austin FTC Programming with App Inventor
App Inventor
You will need:
Google Chrome (Firefox works for me too)VirtualBox. The instructions say it needs administrativeprivileges to install, but I was able to within them.
Download the App Inventor appliance for VirtualBox.Start VirtualBox and import the appliance
David Austin FTC Programming with App Inventor
App Inventor
You will need:
Google Chrome (Firefox works for me too)VirtualBox. The instructions say it needs administrativeprivileges to install, but I was able to within them.Download the App Inventor appliance for VirtualBox.
Start VirtualBox and import the appliance
David Austin FTC Programming with App Inventor
App Inventor
You will need:
Google Chrome (Firefox works for me too)VirtualBox. The instructions say it needs administrativeprivileges to install, but I was able to within them.Download the App Inventor appliance for VirtualBox.Start VirtualBox and import the appliance
David Austin FTC Programming with App Inventor
Using the legacy motor controllers
Returning teams may wish to re-use the motor controllersfrom last year. You may do this by connecting the motorcontrollers to the Legacy Module, which connects to thePower Module.
There are some complications since the controllers use theI2C communications protocol, which can only sendinformation in one direction at a time.The controllers need to be set in write mode to set thepower and read mode to read encoders. It takes a coupleof cycles for the switch to occur.Don’t worry about this if you are using the new motorcontrollers.
David Austin FTC Programming with App Inventor
Using the legacy motor controllers
Returning teams may wish to re-use the motor controllersfrom last year. You may do this by connecting the motorcontrollers to the Legacy Module, which connects to thePower Module.There are some complications since the controllers use theI2C communications protocol, which can only sendinformation in one direction at a time.
The controllers need to be set in write mode to set thepower and read mode to read encoders. It takes a coupleof cycles for the switch to occur.Don’t worry about this if you are using the new motorcontrollers.
David Austin FTC Programming with App Inventor
Using the legacy motor controllers
Returning teams may wish to re-use the motor controllersfrom last year. You may do this by connecting the motorcontrollers to the Legacy Module, which connects to thePower Module.There are some complications since the controllers use theI2C communications protocol, which can only sendinformation in one direction at a time.The controllers need to be set in write mode to set thepower and read mode to read encoders. It takes a coupleof cycles for the switch to occur.
Don’t worry about this if you are using the new motorcontrollers.
David Austin FTC Programming with App Inventor
Using the legacy motor controllers
Returning teams may wish to re-use the motor controllersfrom last year. You may do this by connecting the motorcontrollers to the Legacy Module, which connects to thePower Module.There are some complications since the controllers use theI2C communications protocol, which can only sendinformation in one direction at a time.The controllers need to be set in write mode to set thepower and read mode to read encoders. It takes a coupleof cycles for the switch to occur.Don’t worry about this if you are using the new motorcontrollers.
David Austin FTC Programming with App Inventor
Resources
http://ftcforum.usfirst.org/forumdisplay.php?156-FTC-Technology
http://ftc.edu.intelitek.com
David Austin, [email protected]
David Austin FTC Programming with App Inventor
Resources
http://ftcforum.usfirst.org/forumdisplay.php?156-FTC-Technology
http://ftc.edu.intelitek.com
David Austin, [email protected]
David Austin FTC Programming with App Inventor
Resources
http://ftcforum.usfirst.org/forumdisplay.php?156-FTC-Technology
http://ftc.edu.intelitek.com
David Austin, [email protected]
David Austin FTC Programming with App Inventor