virtual bool initialize(SimpleControllerIO* io) override { ostream& os = io->os(); Body* body = io->body(); root = io->body()->rootLink(); thrusts << body->devices(); DeviceList<Light> lights(body->devices()); if(!lights.empty()){ light = lights.front(); } prevLightButtonState = false; if(!joystick.isReady()){ os << "Joystick is not ready: " << joystick.errorMessage() << endl; } if(joystick.numAxes() < 5){ os << "The number of the joystick axes is not sufficient for controlling the robot." << endl; } if(joystick.numButtons() < 1){ os << "The number of the joystick buttons is not sufficient for controlling the robot." << endl; } return true; }
virtual bool initialize(SimpleControllerIO* io) override { ostream& os = io->os(); Body* body = io->body(); steering = body->link("STEERING_RIGHT"); if(!steering){ os << " The steering_right link is not found." << endl; return false; } steering->setActuationMode(Link::JOINT_TORQUE); io->enableIO(steering); drive = body->link("REAR_WHEEL"); if(!drive){ os << "The rear_wheel link is not found." << endl; return false; } drive->setActuationMode(Link::JOINT_TORQUE); io->enableInput(drive, JOINT_VELOCITY); io->enableOutput(drive); if(!joystick.isReady()){ os << "Joystick is not ready: " << joystick.errorMessage() << endl; } timeStep = io->timeStep(); eold = 0; return true; }
virtual bool initialize() { crawlerL = ioBody()->link("CRAWLER_TRACK_L"); crawlerR = ioBody()->link("CRAWLER_TRACK_R"); if(!crawlerL || !crawlerR){ os() << "Crawlers are not found" << endl; return false; } for(int i=0; i < 2; i++){ qRef[i] = 0; } if(!joystick.isReady()){ os() << "Joystick is not ready: " << joystick.errorMessage() << endl; } if(joystick.numAxes() < 5){ os() << "The number of the joystick axes is not sufficient for controlling the robot." << endl; } return true; }