void pre_autonomous(){ SensorType(in8) = sensorNone; //Clearing this should eliminate any drift the gyro builds over time wait1Msec(1000); SensorType(in8) = sensorGyro; wait1Msec(2000); //Needed for stabalization SensorFullCount[in8] = 3600; //sets the gyro to go back to 0 after it hits 3600(a full rotation) bLCDBacklight = true; //Set the LCD light to on SensorValue[in1] = 0; SensorValue[in2] = 0; SensorValue[rightIEM] = 0; SensorValue[leftIEM] = 0; //Clear ALL Sensors }
task main() { while(SensorSetup != 1) { SensorType(Yaw) = sensorNone; wait1Msec(4000); SensorType(Yaw) = sensorGyro; SensorSetup = 1; } while(true) { motor[MiddleLeft] = Flyspeed; motor[TBLeft] = Flyspeed; motor[TMRight] = Flyspeed; motor[BottomRight] = Flyspeed; startTask(FlyWheel); startTask(Drive); //startTask(Position); if(vexRT[Btn5U] == 1) { motor[Feed] = 127; } else if(vexRT[Btn5D] == 1) { motor[Feed] = -127; } else { motor[Feed] = 0; } if(vexRT[Btn6U] == 1) { motor[Intake] = 127; } else if(vexRT[Btn6D] == 1) { motor[Intake] = -127; } else { motor[Intake] = 0; } } }
void OpenNi2Video::AddStream(const OpenNiStreamMode& mode) { sensor_type[numStreams] = mode; openni::Device& device = devices[mode.device]; openni::VideoStream& stream = video_stream[numStreams]; openni::Status rc = stream.create(device, SensorType(mode.sensor_type)); if (rc != openni::STATUS_OK) { throw VideoException( "OpenNI2: Couldn't create stream.", openni::OpenNI::getExtendedError() ); } openni::PlaybackControl* control = device.getPlaybackControl(); if(control && numStreams==0) { total_frames = std::min(total_frames,control->getNumberOfFrames(stream)); } numStreams++; }
virtual void ActorDestroy(ActorDestroyReason aWhy) override { // NB: you *must* unconditionally unregister your observer here, // if it *may* be registered below. hal::UnregisterBatteryObserver(this); hal::UnregisterNetworkObserver(this); hal::UnregisterScreenConfigurationObserver(this); for (int32_t sensor = SENSOR_UNKNOWN + 1; sensor < NUM_SENSOR_TYPE; ++sensor) { hal::UnregisterSensorObserver(SensorType(sensor), this); } hal::UnregisterWakeLockObserver(this); for (int32_t switchDevice = SWITCH_DEVICE_UNKNOWN + 1; switchDevice < NUM_SWITCH_DEVICE; ++switchDevice) { hal::UnregisterSwitchObserver(SwitchDevice(switchDevice), this); } }
std::vector<SensorType> Enums::GetSensorTypes() { if(sensorTypes.empty()) { std::vector<SensorType> v; for(auto const& t : SensorType()) { v.push_back(t); } return v; } else { return sensorTypes; } }
void pre_auton() { // Set bStopTasksBetweenModes to false if you want to keep user created tasks running between // Autonomous and Tele-Op modes. You will need to manage all user created tasks if set to false. bStopTasksBetweenModes = true; //Clearing this should eliminate any drift the gyro builds over time wait1Msec(1000); SensorType(in8) = sensorGyro; wait1Msec(2000); //Needed for stabalization SensorFullCount[in8] = 3600; bLCDBacklight = true; //Set the LCD light to on SensorValue[in1] = 0; SensorValue[in2] = 0; SensorValue[rightIEM] = 0; SensorValue[leftIEM] = 0; autonomousSelection(); // All activities that occur before the competition starts // Example: clearing encoders, setting servo positions, ... }