real-time motion 3d graphical model of an frc robot 2006 first robotics conference 4/27/2006 team...

24
Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony Zurolo Roger

Post on 20-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

Real-Time Motion 3D Graphical Model of an FRC

Robot2006 FIRST Robotics Conference

4/27/2006

Team 176 Aces High

Tony Zurolo Roger Ignazio III

Page 2: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

MotivationMotivation

Hardware is not always available to test ideasThe robot may not be ready until late in the

design / build period.Limited time for control system software checkout

Visualization of sensor data is difficultThis is especially an issue for autonomous period

programming

Page 3: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

Brief Overview of the Project

Brief Overview of the Project

Program to display a 3D graphical model of the robot’s arm

Can select between three data sources:

GUI controlsLive Robot DataRecorded Data file

Can Record the selected data source to a file

Page 4: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

Software ArchitectureSoftware Architecture

Abstract Robot Data Interface

Robot Object Model

Claw / Wrist

Forearm

Upper Arm

View Manager(GUI Event Handler)

wxWindows / OpenGL

GUI Events

Shape-drawing commands

Dashboard PortRecorded File Data

GUI

View Commands

Body

Position Data

Shoulder

Heavy use of Open Source packages

Page 5: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

Software ArchitectureSoftware ArchitectureInter-object linkage

All you have to do is “connect” the parts

Display update is independent of model state

Important for timing considerationsModel parameter update is event-driven

Multi-threaded application

ras1.connect_to(&rasb1);ras2.connect_to(&ras1); claw1.connect_to(&ras2);

Page 6: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

Robot PartsRobot PartsThe parts are concrete

instantiations of an abstract base class.

They respond to change eventsThey know what they are

connected to

SwivelBase

Claw

ArmSection

Page 7: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

Robot PartsRobot Parts

What they’re made of

Normally drawn with OpenGL Quad Strips and Triangle Fans

Page 8: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

Software ArchitectureSoftware ArchitectureClass Hierarchies

RectangularBlock

SolidCylinder PipeShaftBearing AngledBlock

Page 9: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

Software ArchitectureSoftware ArchitectureClass Hierarchies

RobotMovablePart

RobotArmSection

RobotArmSwivelBase

RobotClaw

Page 10: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

Software ArchitectureSoftware ArchitectureEvent notification

Transforms

OptimizationLazy evaluationCachingCPU is swamped without these

if (claw1.set_angle(new_angle) notifier->notify_of_change();

Page 11: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

Software ArchitectureSoftware Architecture

Recorded data formatDelta time, but summed to keep in sync with

absolute time

0 -0.184 -1.93 0.202 0.589 1 0 0130 -0.202 -1.93 0.202 0.589 1 0 0 30 -0.184 -1.93 0.202 0.589 1 0 0 70 -0.202 -1.93 0.202 0.589 1 0 0170 -0.184 -1.93 0.202 0.589 1 0 0100 -0.202 -1.93 0.202 0.589 1 0 0 30 -0.184 -1.93 0.202 0.589 1 0 0

Page 12: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

Hardware ArchitectureHardware ArchitecturePotentiometers connected to

controller A / D inputsLimit Switches connected to

controller digital inputs115kbps Serial link to laptop

Page 13: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

Robot Controller Programming

Robot Controller Programming

Dashboard packet overviewSlots available for user data

Custom packets (for EDU controller)Sync byteChecksumControlling packet timing

Page 14: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

RC Programming:EDU Packet Overview

RC Programming:EDU Packet Overview

Data is sent from the EDU controller to the RoboSim program via the IFI Dashboard packet’s user byte reserves.

Sync packet (0xFF) does not appear anywhere else in the IFI dashboard packet. RoboSim can scan for this, and when found can “sync up” with the Operator Interface.

EDU Program then sends all other bytes for base angle, shoulder angle, etc.As the bytes are sent, they are added to a checksum in the EDU controller.At the end of the packet, all values have been added to the checksum and it

is sent as the final byte of the packet.

Page 15: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

RC Programming:An Excerpt from user_routines.cRC Programming:An Excerpt from user_routines.c

AHPrintChar(0xFF); // start byte AHPrintChar(base_angle); // put the base angle in the packet checksum += base_angle; // include the base angle in the checksum AHPrintChar(shoulder_angle); // put the shoulder angle in the packet checksum += shoulder_angle; // include the shoulder angle in the checksum AHPrintChar(elbow_angle); // put the elbow angle in the packet checksum += elbow_angle; // include the elbow angle in the checksum AHPrintChar(wrist_angle); // put the wrist angle in the packet checksum += wrist_angle; // include the wrist angle in the checksum AHPrintChar(claw_byte); // put the claw bits byte in the packet checksum += claw_byte; // include the claw byte in the checksum AHPrintChar(checksum); // end the packet with the checksum

Page 16: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

RC Programming:Controlling Packet Timing

RC Programming:Controlling Packet Timing

Controlling packet timing is essential to prevent overload on the RoboSim program as well as the transmission between RC and OI.

To do this, we use a counter that will only send a packet every X number of iterations.

We currently use a delay of 2, which means that a packet is sent every other iteration.

After the counter hits 2, it will reset to 0 and begin the process again.

Page 17: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

RC Programming:Controlling Packet Timing (cntd.)RC Programming:Controlling Packet Timing (cntd.)

Excerpt from user_routines.c//Routine starts

++delay_counter;if(delay_counter >= 2)

/* The packet routine goes here */delay_counter = 0;

Page 18: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

“Out-takes”“Out-takes”What’s your sign?

Page 19: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

“Out-takes”“Out-takes”Haste makes waste

Page 20: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

“Out-takes”“Out-takes”Bad Hair Day

Page 21: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

DemoDemo

GUI Control of modelZoom, Pan

Live Robot DataRecorded Data

Page 22: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

Applications of this ProjectApplications of this ProjectVisualization and Prototyping of ideasDriver / Operator Practice“Training films” using the recording featureCan serve as a basis for learning graphics

programming

Page 23: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

Continuing DevelopmentContinuing DevelopmentRapid Prototyping of Robot / Simulation

Robot “construction set”Reconstruction of robot’s sensor view of its worldSensor calibrationTwo-way communication for closed loop control

developmentStudents will have an opportunity to continue the

work

Page 24: Real-Time Motion 3D Graphical Model of an FRC Robot 2006 FIRST Robotics Conference 4/27/2006 Team 176 Aces High Tony ZuroloRoger Ignazio III

AcknowledgementsAcknowledgements“Aces High” team 176 Windsor Locks / Suffield HS

Provided use of the mini-controller and electromechanical parts http://www.aceshigh176.com/

Implementation of a virtual trackballImplemented by Gavin Bell, lots of ideas from Thant Tessman and

the August '88 issue of Siggraph's "Computer Graphics," pp. 121-129.

Open Source Asynchronous com port interfaceThierry Schneider

wxWindows – Open Source GUI frameworkJulian Smart, Robert Roebling, Vadim Zeitlin, Robin Dunn, et al

(http://www.wxwindows.org/)