Skip to content

Instantly share code, notes, and snippets.

#include "RectangleTracker.h"
static void TrackTask(RectangleTracker *t) {
while (true) {
if (!t->Enabled()) continue;
if (!t->camera->IsFreshImage()) continue;
t->GetRectangles();
if (t->MatchesFound()) {
t->SelectTarget();
#include "TrackingImage.h"
static bool HeightSort(RectangleMatch a, RectangleMatch b) {
return a.corner[0].y < b.corner[0].y;
}
TrackingImage::TrackingImage(AxisCamera &camera) {
ColorImage *rawImage = new ColorImage(IMAQ_IMAGE_RGB);
camera.GetImage(rawImage);
grayscaleImage = rawImage->GetLuminancePlane();
#include "Camera.h"
#include "../Configuration.h"
#include <math.h>
#define fuzzy(a, b) static Camera::FuzzyDistance *(a) = new Camera::FuzzyDistance;\
*(a) = (b);
Camera::Camera():
Subsystem("Camera"),
panValue(0),
# Access child peripherals with ::
# peripheral::child_peripheral::another_peripheral
# Access events with the dot operator
# peripheral.periodic
# Write to a peripherals property value with the assignment operator
# peripheral = value
left_joystick::x_axis.periodic:
window.streamCallback = (data) ->
if $.streams is undefined or data.version >= $.streams.version
$.streams = data
executeStreams()
executeStreams = ->
for stream in $.streams.streams
elm = $("#blank-stream").clone()
elm.attr("id", "stream-#{stream.id}")
elm.html(stream.embed)
require "gosu"
class Character
def initialize(window)
@window = window
@sprite = Gosu::Image.new(@window, "sprite.gif", false)
@x, @y = 100, @window.floor
@counter = 0
@angle = 0
@basicxman
basicxman / robot_classes.cpp
Created December 1, 2011 18:00
MMRambotics OOP Lessons
// RobotClasses.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
class Robot {
@basicxman
basicxman / logic.cpp
Created December 1, 2011 04:56
Boolean Logic Conditionals [MMRambotics Training Material]
IsArmInButtonPressed()
previousArmInButton && !currentValue
clawState == OUT
distance > 0
degreesToTurn < 0
SELECT days.*, name, SUM(value) AS total_points FROM "days" LEFT JOIN points ON points.day_id = days.id LEFT JOIN tasks ON tasks.id = points.task_id WHERE "days"."user_id" = 2 AND (value IS NOT NULL) GROUP BY task_id, date ORDER BY date;
<tr id="<%= dom_id(@task) %>">
<input type="hidden" class="achieved" value="<%= @task.achieved_points %>" />
<input type="hidden" class="quota" value="<%= @task.required_points %>" />
<td class="task-controls">
<div class="graph-hidden"><%= image_tag image_path("graph_hidden.png"), :width => "30", :class => "graph-hidden graph-button", "data-task" => @task.name %></div>
<div class="graph-visible"><%= image_tag image_path("graph_visible.png"), :width => "30", :class => "graph-visible graph-button", "data-task" => @task.name %></div>
</td>
<td class="task-name"><span class="name"><%= @task.name %></span> (<span class="achieved"><%=n @task.achieved_points %></span> / <span class="quota"><%=n @task.required_points %></span>)</td>
<td class="task-bar pointer">
<%= render :partial => "progress", :locals => { :task => @task } %>