当前位置: 首页>>代码示例>>C++>>正文


C++ AnalogChannel类代码示例

本文整理汇总了C++中AnalogChannel的典型用法代码示例。如果您正苦于以下问题:C++ AnalogChannel类的具体用法?C++ AnalogChannel怎么用?C++ AnalogChannel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AnalogChannel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetAnalogAverageBits

/**
 * Set the number of averaging bits.
 * This sets the number of averaging bits. The actual number of averaged samples is 2**bits.
 * Use averaging to improve the stability of your measurement at the expense of sampling rate.
 * The averaging is done automatically in the FPGA.
 *
 * @param channel The channel in the module assicated with this analog channel
 * @param bits Number of bits of averaging.
 */
void SetAnalogAverageBits(UINT32 channel, UINT32 bits)
{
	AnalogChannel *analog = AllocateAnalogChannel(AnalogModule::GetDefaultAnalogModule(), channel);
	if (analog != NULL)
	{
		analog->SetAverageBits(bits);
	}
}
开发者ID:Techbrick,项目名称:MainWorkingCode,代码行数:17,代码来源:CAnalogChannel.cpp

示例2: SetAnalogOversampleBits

/**
 * Set the number of oversample bits.
 * This sets the number of oversample bits. The actual number of oversampled values is 2**bits.
 * Use oversampling to improve the resolution of your measurements at the expense of sampling rate.
 * The oversampling is done automatically in the FPGA.
 *
 * @param slot The slot the analog module is plugged into
 * @param channel The channel in the module assicated with this analog channel
 * @param bits Number of bits of oversampling.
 */
void SetAnalogOversampleBits(UINT32 slot, UINT32 channel, UINT32 bits)
{
	AnalogChannel *analog = AllocateAnalogChannel(slot, channel);
	if (analog != NULL)
	{
		analog->SetOversampleBits(bits);
	}
}
开发者ID:Techbrick,项目名称:MainWorkingCode,代码行数:18,代码来源:CAnalogChannel.cpp

示例3: GetAnalogAverageVoltage

/**
 * Get a scaled sample from the output of the oversample and average engine for this channel.
 * The value is scaled to units of Volts using the calibrated scaling data from GetLSBWeight() and GetOffset().
 * Using oversampling will cause this value to be higher resolution, but it will update more slowly.
 * Using averaging will cause this value to be more stable, but it will update more slowly.

 * @param channel The channel in the module assicated with this analog channel
 * @return A scaled sample from the output of the oversample and average engine for this channel.
 */
float GetAnalogAverageVoltage(UINT32 channel)
{
	AnalogChannel *analog = AllocateAnalogChannel(AnalogModule::GetDefaultAnalogModule(), channel);
	if (analog != NULL)
	{
		return analog->GetAverageVoltage();
	}
	return 0.0;
}
开发者ID:Techbrick,项目名称:MainWorkingCode,代码行数:18,代码来源:CAnalogChannel.cpp

示例4: GetAnalogOversampleBits

/**
 * Get the number of oversample bits previously configured.
 * This gets the number of oversample bits from the FPGA. The actual number of oversampled values is
 * 2**bits. The oversampling is done automatically in the FPGA.
 *
 * @param channel The channel in the module assicated with this analog channel
 * @return Number of bits of oversampling previously configured.
 */
UINT32 GetAnalogOversampleBits(UINT32 channel)
{
	AnalogChannel *analog = AllocateAnalogChannel(AnalogModule::GetDefaultAnalogModule(), channel);
	if (analog != NULL)
	{
		return analog->GetOversampleBits();
	}
	return 0;
}
开发者ID:Techbrick,项目名称:MainWorkingCode,代码行数:17,代码来源:CAnalogChannel.cpp

示例5: GetAnalogAverageValue

/**
 * Get a sample from the output of the oversample and average engine for this channel.
 * The sample is 12-bit + the value configured in SetOversampleBits().
 * The value configured in SetAverageBits() will cause this value to be averaged 2**bits number of samples.
 * This is not a sliding window.  The sample will not change until 2**(OversamplBits + AverageBits) samples
 * have been acquired from the module on this channel.
 * Use GetAverageVoltage() to get the analog value in calibrated units.
 *
 * @param slot The slot the analog module is plugged into
 * @param channel the channel for the value being used
 * @return A sample from the oversample and average engine for this channel.
 */
INT32 GetAnalogAverageValue(UINT32 slot, UINT32 channel)
{
	AnalogChannel *analog = AllocateAnalogChannel(slot, channel);
	if (analog != NULL)
	{
		return analog->GetAverageValue();
	}
	return 0;
}
开发者ID:Techbrick,项目名称:MainWorkingCode,代码行数:21,代码来源:CAnalogChannel.cpp

示例6: GetAnalogVoltage

/**
 * Get a scaled sample straight from this channel on the module.
 * The value is scaled to units of Volts using the calibrated scaling data from GetLSBWeight() and GetOffset().
 * @param slot The slot the analog module is plugged into
 * @param channel The channel in the module assicated with this analog channel
 * @return A scaled sample straight from this channel on the module.
 */
float GetAnalogVoltage(UINT32 slot, UINT32 channel)
{
	AnalogChannel *analog = AllocateAnalogChannel(slot, channel);
	if (analog != NULL)
	{
		return analog->GetVoltage();
	}
	return 0.0;
}
开发者ID:Techbrick,项目名称:MainWorkingCode,代码行数:16,代码来源:CAnalogChannel.cpp

示例7: GetAnalogValue

/**
 * Get a sample straight from this channel on the module.
 * The sample is a 12-bit value representing the -10V to 10V range of the A/D converter in the module.
 * The units are in A/D converter codes.  Use GetVoltage() to get the analog value in calibrated units.

 * @param channel The channel in the module assicated with this analog channel
 * @return A sample straight from this channel on the module.
 */
INT16 GetAnalogValue(UINT32 channel)
{
	AnalogChannel *analog = AllocateAnalogChannel(AnalogModule::GetDefaultAnalogModule(), channel);
	if (analog != NULL)
	{
		return analog->GetValue();
	}
	return 0;
}
开发者ID:Techbrick,项目名称:MainWorkingCode,代码行数:17,代码来源:CAnalogChannel.cpp

示例8: OperatorControl

	void OperatorControl(void)
	{
		NetTest();
		return;
		myRobot.SetSafetyEnabled(true);
		digEncoder.Start();
		const double ppsTOrpm = 60.0/250.0;   //Convert from Pos per Second to Rotations per Minute by multiplication
                                              // (See the second number on the back of the encoder to replace 250 for different encoders)
        const float VoltsToIn = 41.0;         // Convert from volts to cm by multiplication (volts from ultrasonic).
                                              // This value worked for distances between 1' and 10'.
		
		while (IsOperatorControl())
		{
			if (stick.GetRawButton(4)) {
				myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), -1);
			} 
			else if (stick.GetRawButton(5))
			{
				myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), 1);
			}
			else 
			{
				myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), 0);
			}
			
			myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), 0);
			
			SmartDashboard::PutNumber("Digital Encoder RPM", abs(digEncoder.GetRate()*ppsTOrpm));
			SmartDashboard::PutNumber("Ultrasonic Distance inch", (double) ultra.GetAverageVoltage()*VoltsPerInch);
			SmartDashboard::PutNumber("Ultrasonic Voltage", (double) ultra.GetAverageVoltage());

			Wait(0.1);
		}
		digEncoder.Stop();
	}
开发者ID:Techbrick,项目名称:MainWorkingCode,代码行数:35,代码来源:MyRobot.cpp

示例9: TeleopPeriodic

	void TeleopPeriodic() {
		if(m_driver->GetRawButton(BUTTON_LB)) {
			// PYRAMID
			m_PIDController->SetSetpoint(PLATE_PYRAMID_THREE_POINT);
			m_PIDController->Enable();
		} else if(m_driver->GetRawButton(BUTTON_RB)) {
			// FEEDER
			m_PIDController->SetSetpoint(PLATE_FEEDER_THREE_POINT);
			m_PIDController->Enable();
		} else if(m_driver->GetRawAxis(TRIGGERS) > 0.5) {
			m_PIDController->SetSetpoint(PLATE_TEN_POINT_CLIMB);
			m_PIDController->Enable();
		} else {
			// MANUAL CONTROL
			m_PIDController->Disable();
			
			m_plate1->Set(-deadband(m_driver->GetRawAxis(LEFT_Y)));
			m_plate2->Set(-deadband(m_driver->GetRawAxis(LEFT_Y)));
		}
		
		// ----- PRINT -----
		SmartDashboard::PutNumber("Plate Position: ", m_plateSensor->GetVoltage());
		SmartDashboard::PutNumber("PID GET: ", m_plateSensor->PIDGet());
		
	} // TeleopPeriodic()
开发者ID:hal7df,项目名称:further-suggestions,代码行数:25,代码来源:Main.cpp

示例10: OperatorControl

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void) {

		while (IsOperatorControl()) {
			dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, "Voltage: %f",
					signal.GetVoltage());
			dsLCD->PrintfLine(DriverStationLCD::kUser_Line3, "CVoltage: %f",
					signalControlVoltage.GetVoltage());
			dsLCD->UpdateLCD();
			Wait(0.005); // wait for a motor update time
		}
	}
开发者ID:2202Programming,项目名称:OldCode,代码行数:14,代码来源:Sonar.cpp

示例11: ResetHomePosition

    void ResetHomePosition(void){
    	
    	if(Operator_Control_Stick.GetRawButton(HOME_RESET_BUTTON) == true){
    		homePositionInOhms = armPotentiometer1.GetValue();
		}
    	
    }
开发者ID:zxsq,项目名称:PastSeasons,代码行数:7,代码来源:MyRobot.cpp

示例12: HandleArmInputs

	void HandleArmInputs(void)
	{
		if (gamepad.GetLeftY() < -0.1)
		{
			if (potentiometer.GetVoltage() < 4.5)
			{
				armMotor.Set(1.0);
			}
			else
			{
				armMotor.Set(0.0);
			}
		}
		else if (gamepad.GetLeftY() > 0.1)
		{
			if (potentiometer.GetVoltage() > .5)
			{
				armMotor.Set(-1.0);
			}
			else
			{
				armMotor.Set(0.0);
			}	
		}
		else
		{
			armMotor.Set(0.0);
		}
		
		if (gamepad.GetEvent(BUTTON_CLAW_1_LOCKED) == kEventClosed)
		{
			greenClaw.Set(DoubleSolenoid::kForward);
		}
		else if (gamepad.GetEvent(BUTTON_CLAW_1_UNLOCKED) == kEventClosed)
		{
			greenClaw.Set(DoubleSolenoid::kReverse);
		}
		else if (gamepad.GetEvent(BUTTON_CLAW_2_LOCKED) == kEventClosed)
		{
			yellowClaw.Set(DoubleSolenoid::kForward);
		}
		else if (gamepad.GetEvent(BUTTON_CLAW_2_UNLOCKED) == kEventClosed)
		{
			yellowClaw.Set(DoubleSolenoid::kReverse);
		}
	}
开发者ID:StWilliam,项目名称:Wham-O,代码行数:46,代码来源:FRC2994_2013.cpp

示例13: OperatorControl

	/**
	 * Runs the motors with arcade steering.
	 */
	void OperatorControl(void)
	{
       encoder.Start();
		while (IsEnabled())
		{
			float controlv = control.GetVoltage();
			motor.Set(controlv/5); //get's voltage from control and divides it by 5
			double rate = encoder.GetRate();
			double distance = encoder.GetDistance();
			printf ("%f %f \n", rate, distance);

		}
	}
开发者ID:frc1334,项目名称:TestBot,代码行数:16,代码来源:BenHosein.cpp

示例14: Autonomous

	void Autonomous(void)
	{
		myRobot.SetSafetyEnabled(false);
		
		// Move the arm to a level position
		armMotor.Set(ARM_FWD);
		while (!((potentiometer.GetVoltage() > 2.4) && (potentiometer.GetVoltage() < 2.6))) 
		{
			// Check to make sure we don't overrotate the arm in either direction
			if (potentiometer.GetVoltage() > 4.5 || potentiometer.GetVoltage() < 0.5)
			{
				armMotor.Set(0.0);
				return;
			}
			Wait(0.2);
			UpdateStatusDisplays();
		}
		armMotor.Set(0.0);
		
		// Drive robot 
		
		DoAutonomousMoveStep(&m_autoForward[0], "Moving...");
		DoAutonomousMoveStep(&m_autoForward[1], "Moving...");
		
		//Shoot for five seconds
		Timer* t = new Timer();
		t->Start();
		
		shooterMotor.Set(SHOOTER_FWD);
		indexerMotor.Set(INDEXER_FWD);

		while(!t->HasPeriodPassed(5.0))
		{
			Wait(0.02);
		}
		shooterMotor.Set(0.0);
		indexerMotor.Set(0.0);
	}
开发者ID:aitrean,项目名称:Wham-O,代码行数:38,代码来源:FRC2994_2013.cpp

示例15: GetUserInputs

	/** Function to retrieve the user inputs
	 * Inputs (For all user input modes):
	 * * Potentiometers 
	 * * Limit switches
	 * * the requested state for the robot (from the joystick buttons)
	 * For manual mode only:
	 * * The intake and ejection wheel speeds - based on the operator joystick throttle
	 * * The arm position - based on the operator joystick Y axis  
	 */
    void GetUserInputs(RobotStates_t &requestedState)
    {
    	float throttleRaw = 0.0;
        //Read potentiometer goes from -5 to 28
        potentiometerValueRight = armPotentiometer1.GetValue();
        //potentiometerValueLeft = armPotentiometer2.GetValue();
        ballCaughtLimitSwitch1 = limitSwitch1.Get(); //TODO 0 is no ball 1 is ball 
        //Read Joystick state buttons
        requestedState = ReadJoystickButtons();
        throttleRaw = DeadZone(Operator_Control_Stick.GetTwist(), EJWHEEL_MM_DEADZONE_VAL);
        manualModeThrottlePosition = (throttleRaw * -1); //invert throttle value to match the joystick
		manualModeArmPosition = DeadZone(Operator_Control_Stick.GetY(), ARM_MM_DEADZONE_VAL);
		
    }
开发者ID:zxsq,项目名称:PastSeasons,代码行数:23,代码来源:MyRobot.cpp


注:本文中的AnalogChannel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。