void Coach::update(SSL_DetectionFrame newFrame) { //update memory if(_memory.size() < 5) { _memory.push_back(newFrame); } else { _memory.push_back(newFrame); _memory.erase(_memory.begin()); //update FieldState fs.bBots.clear(); fs.yBots.clear(); fs.ball = Movable(newFrame.balls(0).x(), newFrame.balls(0).y(), 0, 0); //velocity calculated in analysis for(int i = 0; i < _memory[4].robots_blue_size(); i++) { fs.bBots.push_back(Robot(_memory[4].robots_blue(i).robot_id(), _memory[4].robots_blue(i).orientation(), _memory[4].robots_blue(i).x(), _memory[4].robots_blue(i).y())); } for(int i = 0; i < _memory[4].robots_yellow_size(); i++) { fs.yBots.push_back(Robot(_memory[4].robots_yellow(i).robot_id(), _memory[4].robots_yellow(i).orientation(), _memory[4].robots_yellow(i).x(), _memory[4].robots_yellow(i).y())); } //call analysis to update velocity Analysis(); } }
//block execution until an update is received //in each update we want to clear and then repopulate our vectors of temperatures and robots void MainWindow::mpiWaitForUpdates() { Factories<Command>& command_factories = Factories<Command>::getInstance(); robots.clear(); pointTemps.clear(); Communicators& myCommunicator = Communicators::getInstance(); SerialObject object; myCommunicator.run(); while(!myCommunicator.isEmpty()){ object = myCommunicator.popObject(); if(object.type == "Beep"){ Stateful beep; beep.load(object.JSON); int x = beep.getState("x"); int y = beep.getState("y"); Robot tempRobot = Robot(x, y); robots.push_back(tempRobot); } else if(object.type == "DataPoint"){ DataPoint tempPoints; tempPoints.load(object.JSON); int x = tempPoints.getX(); int y = tempPoints.getY(); int value = tempPoints.getValue(); pointTemps.push_back(std::make_pair(std::make_pair(x,y), value)); }else if(command_factories.find(object.type) != command_factories.end()){ Command* command = command_factories[object.type]->create(); command->load(object.JSON); command->run(); delete command; } } return; }
void GeneralizedRobot::GetMegaRobot(Robot& robot) const { vector<string> prefix; vector<Robot*> robotsAndObjects; list<Robot> convertedObjects; for(map<int,Element>::const_iterator i=elements.begin();i!=elements.end();i++) { if(i->second.robot) robotsAndObjects.push_back(i->second.robot); else { convertedObjects.push_back(Robot()); ObjectToRobot(*i->second.object,convertedObjects.back()); robotsAndObjects.push_back(&convertedObjects.back()); } if(i->second.name.empty()) { stringstream ss; ss<<"element_"<<i->first; prefix.push_back(ss.str()); } else prefix.push_back(i->second.name); } robot.Merge(robotsAndObjects); //fix up the names size_t nl = 0; for(size_t i=0;i<robotsAndObjects.size();i++) { for(size_t j=0;j<robotsAndObjects[i]->links.size();j++) robot.linkNames[nl+j] = prefix[i]+"["+robot.linkNames[nl+j]+"]"; nl += robotsAndObjects[i]->links.size(); } }
VREP_DLLEXPORT simChar* v_repImportUrdf(simChar* filenameOrUrdf, simBool hideCollisionLinks, simBool hideJoints, simBool convexDecomposeNonConvexCollidables, simBool createVisualIfNone, simBool showConvexDecompositionDlg, simBool centerAboveGround, simBool makeModel, simBool noSelfCollision, simBool positionCtrl) { robot Robot(filenameOrUrdf, hideCollisionLinks, hideJoints, convexDecomposeNonConvexCollidables, createVisualIfNone, showConvexDecompositionDlg, centerAboveGround, makeModel, noSelfCollision, positionCtrl); simChar* result = (simChar*)simCreateBuffer(Robot.name.length()+1); memcpy((void*) result, (void*) Robot.name.c_str(), Robot.name.length()+1); return result; }
int main() { Machine* machine = new Truck(); machine->make_noise(); machine->transform_to(Robot()); machine->make_noise(); machine->transform_to(Truck()); machine->make_noise(); }
Controller() { robot = Robot(); navigator = Navigator(); if(Collision::occuredWithUpdate()){ startOnOppositePath = true; Actuators::openClaw(); delay(OPEN_FINGERS_FOR_PASSENGER_DROP_OFF_DURATION); //lift hand off! Actuators::closeClaw(); while(Collision::occuredWithUpdate()){} delay(300); } }
Robot::Robot() { Robot ( 0,0,0,teamUnknown,0,0,0 ); }
int main(void) { int i; clock_t start, end; Matrix initrob(6,15), thomo, temp2; ColumnVector q(6), qs(6), temp; Robot robot; initrob << PUMA560_data; robot = Robot(initrob); q = M_PI/6.0; q = M_PI/4.0; printf("Begin compute Forward Kinematics\n"); start = clock(); for (i = 1; i <= NTRY; i++) { robot.set_q(q); temp2 = robot.kine(); } end = clock(); printf("MilliSeconds %6.2f\n", ((end - start) / (Real)CLOCKS_PER_SEC)*1000.0/NTRY); printf("end \n"); qs = 1.0; qs(1) = M_PI/16.0; robot.set_q(q); thomo = robot.kine(); printf("Begin compute Inverse Kinematics\n"); start = clock(); for (i = 1; i <= NTRY; i++) { robot.set_q(qs); temp = robot.inv_kin(thomo); } end = clock(); printf("MilliSeconds %6.2f\n", ((end - start) / (Real)CLOCKS_PER_SEC)*1000.0/NTRY); printf("end \n"); printf("Begin compute Jacobian\n"); start = clock(); for (i = 1; i <= NTRY; i++) { robot.set_q(q); temp2 = robot.jacobian(); } end = clock(); printf("MilliSeconds %6.2f\n", ((end - start) / (Real)CLOCKS_PER_SEC)*1000.0/NTRY); printf("end \n"); printf("Begin compute Torque\n"); start = clock(); for (i = 1; i <= NTRY; i++) { temp = robot.torque(q,q,q); } end = clock(); printf("MilliSeconds %6.2f\n", ((end - start) / (Real)CLOCKS_PER_SEC)*1000.0/NTRY); printf("end \n"); printf("Begin acceleration\n"); start = clock(); for (i = 1; i <= NTRY; i++) { temp = robot.acceleration(q,q,q); } end = clock(); printf("MilliSeconds %6.2f\n", ((end - start) / (Real)CLOCKS_PER_SEC)*1000.0/NTRY); printf("end \n"); return 0; }
void Init() { oRobot = Robot(1, 1, DIRECTION::DOWN); // Create a player character at (1, 1) facing downwards }
Robot A2BDatabase::getRobot() { return Robot(9600, 1, 50, 75, cv::imread("true_robot.png")); }
int main(void) { Bureaucrat bob("bob", 45); Bureaucrat jim("jim", 150); Bureaucrat zac("zac", 2); Form A4("A4", 45, 45); Form A5("A5", 150, 21); ShrubberyCreationForm Creation("home"); PresidentialPardonForm Pardon("Amedy Coulibaly"); RobotomyRequestForm Robot("Zaz"); try { Form a("fifi", 0, 2); } catch (std::exception const& e) { std::cout << "Form a: " << e.what() << std::endl; } try { Form b("fifi", 42, 151); } catch (std::exception const& e) { std::cout << "Form b: " << e.what() << std::endl; } std::cout << A4 << std::endl << A5 << std::endl << std::endl; std::cout << bob << std::endl << jim << std::endl << std::endl; try { A4.beSigned(jim); } catch (std::exception const& e) { std::cout << "Form A4: " << e.what() << std::endl; } std::cout << A4 << std::endl << std::endl; try { A4.beSigned(bob); } catch (std::exception const& e) { std::cout << "Form A4: " << e.what() << std::endl; } std::cout << A4 << std::endl << std::endl; bob.signForm(A4); bob.signForm(A5); jim.signForm(A4); jim.executeForm(Creation); bob.executeForm(Creation); zac.signForm(Pardon); zac.executeForm(Pardon); jim.executeForm(Pardon); zac.signForm(Robot); zac.executeForm(Robot); zac.executeForm(Robot); zac.executeForm(Robot); zac.executeForm(Robot); jim.executeForm(Robot); }