OCCRA
Go to Post Your not a robot (and they aren't perfect either) - Conor Ryan [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

 
Reply
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #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
  #2   Spotlight this post!  
Unread 03-23-2008, 05:09 PM
Greg Marra's Avatar Unsung FIRST Hero
Greg Marra Greg Marra is offline
[automate(a) for a in tasks_to_do]
no team (The Blue Alliance)
Team Role: RoboCoach
 
Join Date: Oct 2004
Rookie Year: 2005
Location: San Francisco, CA
Posts: 2,030
Greg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond repute
Re: [TBA]: Example Code Addition

Quote:
Originally Posted by SamSofa330 View Post
Heres is an example of it in action, here
This is an awesome extension of the demo code. I will add it to the examples with the next API revision.

The link doesn't work for me unless I delete the 'www' though, like this: working demo link
__________________
Formerly Bobcat Robotics - Team 177 and X-Factor - Team 2124, now The Blue Alliance
Reply With Quote
  #3   Spotlight this post!  
Unread 07-12-2011, 05:32 AM
walkershane123 walkershane123 is offline
Registered User
FRC #1111
 
Join Date: Jul 2011
Location: usa
Posts: 1
walkershane123 is an unknown quantity at this point
Re: [TBA]: Example Code Addition

just check out this one. i found new examples



Code:
Matrics Addition

#include<iostream.h>
#include<conio.h>
#include<stdio.h>

struct matrics
{
int a[4][4], m, n;
};

matrics add_mat(matrics m1, matrics m2);		//prototype declared

int main()
{
matrics x1, x2, x3;
int i, j;
cout<<"
Enter the size of matrics
";
cout<<"
Enter rows 
";
cin>>x1.m;
cout<<"
Enter columns 
";
cin>>x1.n;
cout<<"
Enter the elements (Row-wise & Column-wise)
	for(i=0; i<x1.m; i++)
	{
		for(j=0; j<x1.n; j++)
		cin>>x1.a[i][j];
	}
cout<<"
Enter the size of 2nd matrics
";
cout<<"
Enter rows
";
cin>>x2.m;
cout<<"
Enter columns
";
cin>>x2.n;
cout<<"
Enter the elements (Row-wise & column-wise)
	for(i=0; i<x2.m; i++)
	{
		for(j=0; j<x2.n; j++)
		cin>>x2.a[i][j];
	}
x3=add_mat(x1,x2);
cout<<"
The added matrics is
";
	for(i=0; i<x3.m; i++)
	{
		for(j=0; j<x3.n; j++)
		cout<<x3.a[i][j]<<" ";
	}

matrics add_mat(matrics m1, matrics m2)
{
matrics m3;		//object of matrics type
int k, l;
if((m1.m==m2.m) && (m1.n==m2.n))
	{  m3.m=m1.m+m2.m;
	   m3.n=m1.n+m2.n;
	}

	for(k=0; k<m1.m; k++)
	{
		for(l=0; l<m1.n; l++)
		m3.a[k][l]=m1.a[k][l]+m2.a[k][l];
	return (m3);
	}
}//		end of If loop

else
cout<<"
Addition is not possible
";
}

i need your feedback plz
Reply With Quote
  #4   Spotlight this post!  
Unread 07-12-2011, 03:16 PM
Andrew Schreiber's Avatar
Andrew Schreiber Andrew Schreiber is offline
Data Nerd
FRC #0125 (NUTRONS) (EWCP)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2000
Location: Misplaced Michigander
Posts: 3,177
Andrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond repute
Re: [TBA]: Example Code Addition

Reported.
__________________

Planning to top a 4 banner year...
Reply With Quote
  #5   Spotlight this post!  
Unread 07-12-2011, 03:32 PM
R.C.'s Avatar
R.C. R.C. is offline
2014... Hella Parts
AKA: Owner, WestCoast Products
FRC #1323 (MadTown Robotics)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2006
Location: Madera, CA
Posts: 1,913
R.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond repute
Re: [TBA]: Example Code Addition

Both links don't seem to work for me atm.

-RC
__________________
R.C.
Owner, WestCoast Products || Twitter
MadTown Robotics Team 1323
Reply With Quote
  #6   Spotlight this post!  
Unread 07-15-2011, 03:11 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
Re: [TBA]: Example Code Addition

Quote:
Originally Posted by R.C. View Post
Both links don't seem to work for me atm.

-RC
Hasn't been updated since originally posting it, but http://team330.net/?q=content/team-competition-history works. I don't think the API has changed much since then, so it should still work with some minor changes.
Reply With Quote
Reply


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 08:28 PM.

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