OCCRA
Go to Post Think about the other teams...today your opponent, today your teammate. - Al Skierkiewicz [more]
Home
Go Back   Chief Delphi > Other > FIRST-related Organizations > The Blue Alliance
CD-Events   CD-Media   CD-Spy   FRC-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 03-23-2008, 04:50 PM
SamC SamC is offline
.
AKA: Sam Couch
FRC #0103 (Cybersonics)
Team Role: Programmer
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Philadelphia, PA
Posts: 583
SamC has a reputation beyond reputeSamC has a reputation beyond reputeSamC has a reputation beyond reputeSamC has a reputation beyond reputeSamC has a reputation beyond reputeSamC has a reputation beyond reputeSamC has a reputation beyond reputeSamC has a reputation beyond reputeSamC has a reputation beyond reputeSamC has a reputation beyond reputeSamC has a reputation beyond repute
[TBA]: Example Code Addition

Here is a recreation of the example code that comes with the new TBA API. Basically it will generate the performance history of your team as well as videos from the year you indicate. Here's the code,
PHP Code:
<?
//this file demonstrates the use of four core functions in The Blue Alliance API.
//CONFIGURATION
//Change to your path to tba_api_client_PHP5.php
include 'tba_api_client_PHP5.php';

$teamnumber 330;
$season 2007;
$colorA '0033FF';
$colorB 'FFFF00';
$colorC '0033FF';

//get team
$teams make_array(get_teams($teamnumber));

//show team data
$overall_record make_array(get_official_record($teamnumber));

//introduction and basic information
echo "<p>Below is some information about our team, {$teams[0]["informalname"]}, from {$teams[0]["city"]}{$teams[0]["state"]}. Our overall record at official events is {$overall_record[0]["string"]}.</p>";

echo 
"<table id=\"list_events\">";
echo 
"<tr><th>Year</th><th>Event</th><th>Record</th><th>Wins</th></tr>";
$future "";
$team_events make_array(get_attendance(NULL$teamnumber));

foreach (
$team_events as $attendance)
{
  echo 
"<tr>";
  
//get event record
  
$event make_array(get_events($attendance["eventid"]));
  
  
//show the user some data about this event
  
if ($event[0]["official"] == false) {
    
$official_text "*";
  }
  
  
//get team's record at event
  
$record make_array(get_official_record($teamnumber$event[0]["eventid"]));
  
  
//show data to user
  
if ($record[0]["sum"] != 0) { $percent round(($record[0]["win"] / $record[0]["sum"]) * 100) . "%"; } else { $percent "0%"; }
  echo 
"<td><a target=\"_blank\" href=\"http://www.thebluealliance.net/tbatv/eventlist.php?year={$event[0]["year"]}\">{$event[0]["year"]} </a></td>";
  echo 
"<td><a target=\"_blank\" href=\"{$event[0]["tba_link"]}\">{$event[0]["name"]}</a>{$official_text}</td>";
  echo 
"<td>({$record[0]["string"]})</td>";
  echo 
"<td>Won {$percent}</td>";
  echo 
"</tr>";
}
  
echo 
"</table>";

?>

Here are also some videos from our <?php print $season ?> season.
<iframe src="http://www.thebluealliance.net/tbatv/iframe_playlist.php?frontcolor=<?php print $colorA ?>&backcolor=<?php print $colorB ?>&lightcolor=<?php print $colorC ?>&year=<?php print $season ?>&team=<?php print $teamnumber ?>" frameborder="0" height="470" width="395" scrolling="no"></iframe>

Content courtesy TheBlueAlliance.net
Heres is an example of it in action, here

Last edited by SamC : 03-23-2008 at 04:56 PM.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Example code TEAM1949 Programming 10 03-15-2006 03:00 PM
Updated: Example Gyro Interface Code Kevin Watson Programming 2 03-28-2005 03:36 AM
Example gyro code released. Kevin Watson Programming 60 03-17-2005 05:32 PM
Example accelerometer code released. Kevin Watson Programming 0 01-20-2005 02:45 AM
Autonomous Code Example Matthew_H Robotics Education and Curriculum 24 11-21-2003 09:02 AM


All times are GMT -5. The time now is 01:46 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi