项目:Robot_2017
文件:NavX.java
public NavX() {
try {
/***********************************************************************
* navX-MXP:
* - Communication via RoboRIO MXP (SPI,I2C,TTL UART) and USB.
* - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
*
* navX-Micro:
* - Communication via I2C (RoboRIO MXP or Onboard) and USB.
* - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
*
* Multiple navX-model devices on a single robot are supported.
************************************************************************/
ahrs = new AHRS(SerialPort.Port.kUSB);
} catch (RuntimeException ex ) {
DriverStation.reportError("Error instantiating navX MXP: " + ex.getMessage(),true);
}
}
项目:Robot_2016
文件:IMU.java
/**
* Constructs the IMU class,overriding the default update rate
* with a custom rate which may be from 4 to 100,representing
* the number of updates per second sent by the nav6 IMU.
*
* Note that increasing the update rate may increase the
* cpu utilization.
* @param serial_port BufferingSerialPort object to use
* @param update_rate_hz Custom Update Rate (Hz)
*/
public IMU(SerialPort serial_port,byte update_rate_hz) {
ypr_update_data = new IMUProtocol.YPRUpdate();
this.update_rate_hz = update_rate_hz;
flags = 0;
accel_fsr_g = DEFAULT_ACCEL_FSR_G;
gyro_fsr_dps = DEFAULT_GYRO_FSR_DPS;
this.serial_port = serial_port;
yaw_history = new float[YAW_HISTORY_LENGTH];
yaw = (float) 0.0;
pitch = (float) 0.0;
roll = (float) 0.0;
try {
serial_port.reset();
} catch (RuntimeException ex) {
ex.printstacktrace();
}
initIMU();
m_thread = new Thread(this);
m_thread.start();
}
项目:2016Robot
文件:IMU.java
public IMU(SerialPort serial_port,byte update_rate_hz) {
ypr_update_data = new IMUProtocol.YPRUpdate();
this.update_rate_hz = update_rate_hz;
flags = 0;
accel_fsr_g = DEFAULT_ACCEL_FSR_G;
gyro_fsr_dps = DEFAULT_GYRO_FSR_DPS;
this.serial_port = serial_port;
yaw_history = new float[YAW_HISTORY_LENGTH];
yaw = (float) 0.0;
pitch = (float) 0.0;
roll = (float) 0.0;
try {
serial_port.reset();
} catch (RuntimeException e) {
}
initIMU();
m_thread = new Thread(this);
m_thread.start();
}
项目:Stronghold2016
文件:SerialIO.java
public SerialIO( SerialPort.Port port_id,byte update_rate_hz,boolean processed_data,IIOCompleteNotification notify_sink,IBoardCapabilities board_capabilities ) {
this.serial_port_id = port_id;
ypr_update_data = new IMUProtocol.YPRUpdate();
gyro_update_data = new IMUProtocol.GyroUpdate();
ahrs_update_data = new AHRSProtocol.AHRSUpdate();
ahrspos_update_data = new AHRSProtocol.AHRSPosUpdate();
board_id = new AHRSProtocol.BoardID();
board_state = new IIOCompleteNotification.BoardState();
this.notify_sink = notify_sink;
this.board_capabilities = board_capabilities;
serial_port = getMaybeCreateSerialPort();
this.update_rate_hz = update_rate_hz;
if ( processed_data ) {
update_type = AHRSProtocol.MsgiD_AHRSPOS_UPDATE;
} else {
update_type = IMUProtocol.MsgiD_GYRO_UPDATE;
}
}
项目:Bernie
文件:AHRS.java
/**
* Constructs the AHRS class,overriding the default update rate
* with a custom rate which may be from 4 to 60,representing
* the number of updates per second sent by the navX MXP.
*
* Note that increasing the update rate may increase the
* cpu utilization.
* @param serial_port SerialPort object to use
* @param update_rate_hz Custom Update Rate (Hz)
*/
public AHRS(SerialPort serial_port,byte update_rate_hz) {
super(serial_port,update_rate_hz);
ahrs_update_data = new AHRSProtocol.AHRSUpdate();
update_type = AHRSProtocol.MsgiD_AHRS_UPDATE;
world_linear_accel_x =
world_linear_accel_y =
world_linear_accel_z =
mpu_temp_c =
fused_heading =
altitude =
barometric_pressure =
baro_sensor_temp_c =
mag_field_norm_ratio = 0.0f;
cal_mag_x =
cal_mag_y =
cal_mag_z = 0;
is_moving =
is_rotating =
altitude_valid =
is_magnetometer_calibrated =
magnetic_disturbance = false;
resetdisplacement();
}
项目:Bernie
文件:IMU.java
/**
* Constructs the IMU class,representing
* the number of updates per second sent by the nav6 IMU.
*
* Note that increasing the update rate may increase the
* cpu utilization.
* @param serial_port BufferingSerialPort object to use
* @param update_rate_hz Custom Update Rate (Hz)
*/
public IMU(SerialPort serial_port,byte update_rate_hz) {
ypr_update_data = new IMUProtocol.YPRUpdate();
this.update_rate_hz = update_rate_hz;
flags = 0;
accel_fsr_g = DEFAULT_ACCEL_FSR_G;
gyro_fsr_dps = DEFAULT_GYRO_FSR_DPS;
this.serial_port = serial_port;
yaw_history = new float[YAW_HISTORY_LENGTH];
yaw = (float) 0.0;
pitch = (float) 0.0;
roll = (float) 0.0;
try {
serial_port.reset();
} catch (RuntimeException ex) {
ex.printstacktrace();
}
initIMU();
m_thread = new Thread(this);
m_thread.start();
}
项目:FRCStronghold2016
文件:SerialIO.java
public SerialIO( SerialPort.Port port_id,IBoardCapabilities board_capabilities ) {
this.serial_port_id = port_id;
ypr_update_data = new IMUProtocol.YPRUpdate();
gyro_update_data = new IMUProtocol.GyroUpdate();
ahrs_update_data = new AHRSProtocol.AHRSUpdate();
ahrspos_update_data = new AHRSProtocol.AHRSPosUpdate();
board_id = new AHRSProtocol.BoardID();
board_state = new IIOCompleteNotification.BoardState();
this.notify_sink = notify_sink;
this.board_capabilities = board_capabilities;
serial_port = getMaybeCreateSerialPort();
this.update_rate_hz = update_rate_hz;
if ( processed_data ) {
update_type = AHRSProtocol.MsgiD_AHRSPOS_UPDATE;
} else {
update_type = IMUProtocol.MsgiD_GYRO_UPDATE;
}
}
项目:scorpion
文件:IMU.java
/**
* Constructs the IMU class,byte update_rate_hz) {
ypr_update_data = new IMUProtocol.YPRUpdate();
this.update_rate_hz = update_rate_hz;
flags = 0;
accel_fsr_g = DEFAULT_ACCEL_FSR_G;
gyro_fsr_dps = DEFAULT_GYRO_FSR_DPS;
this.serial_port = serial_port;
yaw_history = new float[YAW_HISTORY_LENGTH];
yaw = (float) 0.0;
pitch = (float) 0.0;
roll = (float) 0.0;
try {
serial_port.reset();
} catch (RuntimeException ex) {
ex.printstacktrace();
}
initIMU();
m_thread = new Thread(this);
m_thread.start();
}
项目:turtleshell
文件:SerialIO.java
public SerialIO( SerialPort.Port port_id,IBoardCapabilities board_capabilities ) {
this.serial_port_id = port_id;
is_usb = ((port_id == SerialPort.Port.kUSB) ||
(port_id == SerialPort.Port.kUSB1)||
(port_id == SerialPort.Port.kUSB2));
ypr_update_data = new IMUProtocol.YPRUpdate();
gyro_update_data = new IMUProtocol.GyroUpdate();
ahrs_update_data = new AHRSProtocol.AHRSUpdate();
ahrspos_update_data = new AHRSProtocol.AHRSPosUpdate();
ahrspos_ts_update_data = new AHRSProtocol.AHRSPosTSUpdate();
board_id = new AHRSProtocol.BoardID();
board_state = new IIOCompleteNotification.BoardState();
this.notify_sink = notify_sink;
this.board_capabilities = board_capabilities;
serial_port = getMaybeCreateSerialPort();
this.update_rate_hz = update_rate_hz;
if ( processed_data ) {
update_type = AHRSProtocol.MsgiD_AHRSPOS_TS_UPDATE;
} else {
update_type = IMUProtocol.MsgiD_GYRO_UPDATE;
}
}
项目:Robot_2015
文件:IMU.java
/**
* Constructs the IMU class,byte update_rate_hz) {
ypr_update_data = new IMUProtocol.YPRUpdate();
this.update_rate_hz = update_rate_hz;
flags = 0;
accel_fsr_g = DEFAULT_ACCEL_FSR_G;
gyro_fsr_dps = DEFAULT_GYRO_FSR_DPS;
this.serial_port = serial_port;
yaw_history = new float[YAW_HISTORY_LENGTH];
yaw = (float) 0.0;
pitch = (float) 0.0;
roll = (float) 0.0;
try {
serial_port.reset();
} catch (RuntimeException ex) {
ex.printstacktrace();
}
initIMU();
m_thread = new Thread(this);
m_thread.start();
}
项目:Steamworks2017Robot
文件:Lights.java
/**
* Creates a new Lights subsystem.
*/
public Lights() {
teensyCommunication = new SerialPort(9600,SerialPort.Port.kMXP);
teensyCommunication.enableTermination();
Thread serialThread = new Thread(this::serialThread);
serialThread.setName("LED UART Thread");
serialThread.setDaemon(true);
serialThread.start();
setLedLight(Type.SIGN_FUEL,pulse.soLID,Color.OFF);
setLedLight(Type.SIGN_GEAR,Color.OFF);
}
项目:El-Jefe-2017
文件:Vision.java
public Vision(){
serial = new SerialPort(115200,SerialPort.Port.kMXP,8,SerialPort.Parity.kNone,SerialPort.StopBits.kOne);
serial.disableTermination();
serial.setTimeout(1);
serial.setFlowControl(SerialPort.FlowControl.kNone);
serial.setReadBufferSize(32);
serial.setWriteBufferSize(8);
serial.setWriteBufferMode(SerialPort.WriteBufferMode.kFlushOnAccess);
}
项目:Stronghold2016
文件:SerialIO.java
protected SerialPort resetSerialPort()
{
if (serial_port != null) {
try {
serial_port.free();
} catch (Exception ex) {
// This has been seen to happen before....
}
serial_port = null;
}
serial_port = getMaybeCreateSerialPort();
return serial_port;
}
项目:FRC2016
文件:ArduPilotAthenaInputStream.java
public ArduPilotAthenaInputStream() {
try {
sp = new SerialPort(115200,Port.kUSB);
} catch (Exception e) {
;
}
}
项目:FRCStronghold2016
文件:SerialIO.java
protected SerialPort resetSerialPort()
{
if (serial_port != null) {
try {
serial_port.free();
} catch (Exception ex) {
// This has been seen to happen before....
}
serial_port = null;
}
serial_port = getMaybeCreateSerialPort();
return serial_port;
}
public PixyVision(
final String instanceName,Robot robot,int signature,int brightness,Orientation orientation,SerialPort.Port port)
{
pixyCamera = new FrcPixyCam(instanceName,port,RobotInfo.PIXY_BAUD_RATE,RobotInfo.PIXY_DATA_BITS,RobotInfo.PIXY_PARITY,RobotInfo.PIXY_STOP_BITS);
commonInit(robot,signature,brightness,orientation);
}
/**
* Constructor: Creates an instance of the object.
*
* @param instanceName specifies the instance name.
* @param port specifies the serial port (on-board or on the MXP).
* @param baudrate specifies the serial baud rate.
* @param dataBits specifies the number of data bits.
* @param parity specifies the parity type.
* @param stopBits specifies the number of stop bits.
*/
public FrcSerialPortDevice(
final String instanceName,Port port,int baudrate,int dataBits,Parity parity,StopBits stopBits)
{
super(instanceName);
if (debugEnabled)
{
dbgTrace = new TrcDbgTrace(moduleName + "." + instanceName,tracingEnabled,traceLevel,msgLevel);
}
device = new SerialPort(baudrate,dataBits,parity,stopBits);
}
/**
* Constructor: Create an instance of the object.
*
* @param instanceName specifies the instance name.
* @param port specifies the serial port on the RoboRIO.
* @param baudrate specifies the baud rate.
* @param dataBits specifies the number of data bits.
* @param parity specifies the parity type.
* @param stopBits specifies the number of stop bits.
*/
public FrcPixyCam(
final String instanceName,SerialPort.Port port,SerialPort.Parity parity,SerialPort.StopBits stopBits)
{
super(instanceName);
if (debugEnabled)
{
dbgTrace = new TrcDbgTrace(moduleName + "." + instanceName,msgLevel);
}
pixyCam = new FrcSerialPortDevice(instanceName,baudrate,stopBits);
start();
}
/**
* Constructor: Create an instance of the object.
*
* @param instanceName specifies the instance name.
* @param port specifies the serial port on the RoboRIO.
* @param baudrate specifies the baud rate.
* @param dataBits specifies the number of data bits.
* @param parity specifies the parity type.
* @param stopBits specifies the number of stop bits.
*/
public FrcEmic2TextToSpeech(
final String instanceName,msgLevel);
}
tts = new FrcSerialPortDevice(instanceName,stopBits);
}
项目:turtleshell
文件:SerialIO.java
protected SerialPort resetSerialPort()
{
if (serial_port != null) {
try {
serial_port.free();
} catch (Exception ex) {
// This has been seen to happen before....
}
serial_port = null;
}
serial_port = getMaybeCreateSerialPort();
return serial_port;
}
项目:StormRobotics2017
文件:LEDz.java
/**
* @return the ledOut
*/
public static SerialPort getLedOut() {
return ledOut;
}
项目:StormRobotics2017
文件:LEDz.java
/**
* @param ledOut the ledOut to set
*/
public static void setLedOut(SerialPort ledOut) {
LEDz.ledOut = ledOut;
}
项目:2016Robot
文件:IMU.java
public IMU(SerialPort serial_port) {
this(serial_port,DEFAULT_UPDATE_RATE_HZ);
}
项目:FRC2016
文件:SerialPortInputStream.java
public SerialPortInputStream(SerialPort sp) {
this.sp = sp;
}
项目:turtleshell
文件:Robot.java
@Override
public void robotinit() {
l = new LIDARLite(SerialPort.Port.kMXP);
}
项目:Stronghold2016
文件:AHRS.java
/**
* Constructs the AHRS class using serial communication,overriding the
* default update rate with a custom rate which may be from 4 to 60,* representing the number of updates per second sent by the sensor.
* <p>
* This constructor should be used if communicating via either TTL UART or
* USB Serial interface.
* <p>
* Note that the serial interfaces can communicate either processed data,or
* raw data,but not both simultaneously. If simultaneous processed and raw
* data are needed,use one of the register-based interfaces (SPI or I2C).
* <p>
* Note that increasing the update rate may increase the cpu utilization.
* <p>
*
* @param serial_port_id
* SerialPort to use
* @param data_type
* either kProcessedData or kRawData
* @param update_rate_hz
* Custom Update Rate (Hz)
*/
public AHRS(SerialPort.Port serial_port_id,SerialDataType data_type,byte update_rate_hz) {
commonInit(update_rate_hz);
boolean processed_data = (data_type == SerialDataType.kProcessedData);
io = new SerialIO(serial_port_id,update_rate_hz,processed_data,io_complete_sink,board_capabilities);
io_thread.start();
}
项目:FRCStronghold2016
文件:AHRS.java
/**
* Constructs the AHRS class using serial communication,overriding the
* default update rate with a custom rate which may be from 4 to 60,* representing the number of updates per second sent by the sensor.
*<p>
* This constructor should be used if communicating via either
* TTL UART or USB Serial interface.
*<p>
* Note that the serial interfaces can communicate either
* processed data,or raw data,but not both simultaneously.
* If simultaneous processed and raw data are needed,use
* one of the register-based interfaces (SPI or I2C).
*<p>
* Note that increasing the update rate may increase the
* cpu utilization.
*<p>
* @param serial_port_id SerialPort to use
* @param data_type either kProcessedData or kRawData
* @param update_rate_hz Custom Update Rate (Hz)
*/
public AHRS(SerialPort.Port serial_port_id,board_capabilities);
io_thread.start();
}
项目:turtleshell
文件:AHRS.java
/**
* Constructs the AHRS class using serial communication,overriding the
* default update rate with a custom rate which may be from 4 to 200,board_capabilities);
io_thread.start();
}
项目:Robot_2016
文件:IMU.java
/**
* Constructs the IMU class,using the default update rate.
*
* @param serial_port BufferingSerialPort object to use
*/
public IMU(SerialPort serial_port) {
this(serial_port,DEFAULT_UPDATE_RATE_HZ);
}
项目:Robot_2016
文件:IMUAdvanced.java
/**
* Constructs the IMUAdvanced class,representing
* the number of updates per second sent by the nav6 IMU.
*
* Note that increasing the update rate may increase the
* cpu utilization. Note that calculation of some
* advanced values utilizes additional cpu cycles,when compared
* to the IMU class.
* @param serial_port BufferingSerialPort object to use
* @param update_rate_hz Custom Update Rate (Hz)
*/
public IMUAdvanced(SerialPort serial_port,update_rate_hz);
quaternion_update_data = new IMUProtocol.QuaternionUpdate();
update_type = IMUProtocol.MsgiD_QUATERNION_UPDATE;
}
项目:Robot_2016
文件:IMUAdvanced.java
/**
* Constructs the IMUAdvanced class,using the default update rate.
*
* Note that calculation of some advanced values utilizes additional
* cpu cycles,when compared to the IMU class.
* @param serial_port BufferingSerialPort object to use
*/
public IMUAdvanced(SerialPort serial_port) {
this(serial_port,DEFAULT_UPDATE_RATE_HZ);
}
项目:Stronghold2016
文件:AHRS.java
/**
* Constructs the AHRS class using serial communication and the default
* update rate,and returning processed (rather than raw) data.
* <p>
* This constructor should be used if communicating via either TTL UART or
* USB Serial interface.
* <p>
*
* @param serial_port_id
* SerialPort to use
*/
public AHRS(SerialPort.Port serial_port_id) {
this(serial_port_id,SerialDataType.kProcessedData,NAVX_DEFAULT_UPDATE_RATE_HZ);
}
项目:Bernie
文件:AHRS.java
/**
* Constructs the AHRS class,using the default update rate.
*
* Note that calculation of some advanced values utilizes additional
* cpu cycles,when compared to the IMU class.
* @param serial_port BufferingSerialPort object to use
*/
public AHRS(SerialPort serial_port) {
this(serial_port,NAVX_MXP_DEFAULT_UPDATE_RATE_HZ);
}
项目:Bernie
文件:IMU.java
/**
* Constructs the IMU class,using the default update rate.
*
* @param serial_port BufferingSerialPort object to use
*/
public IMU(SerialPort serial_port) {
this(serial_port,DEFAULT_UPDATE_RATE_HZ);
}
项目:Bernie
文件:IMUAdvanced.java
/**
* Constructs the IMUAdvanced class,representing
* the number of updates per second sent by the nav6 IMU.
*
* Note that increasing the update rate may increase the
* cpu utilization. Note that calculation of some
* advanced values utilizes additional cpu cycles,update_rate_hz);
quaternion_update_data = new IMUProtocol.QuaternionUpdate();
update_type = IMUProtocol.MsgiD_QUATERNION_UPDATE;
}
项目:Bernie
文件:IMUAdvanced.java
/**
* Constructs the IMUAdvanced class,DEFAULT_UPDATE_RATE_HZ);
}
项目:FRCStronghold2016
文件:AHRS.java
/**
* Constructs the AHRS class using serial communication and the default update rate,* and returning processed (rather than raw) data.
*<p>
* This constructor should be used if communicating via either
* TTL UART or USB Serial interface.
*<p>
* @param serial_port_id SerialPort to use
*/
public AHRS(SerialPort.Port serial_port_id) {
this(serial_port_id,NAVX_DEFAULT_UPDATE_RATE_HZ);
}
/**
* Constructor: Create an instance of the object.
*
* @param instanceName specifies the instance name.
* @param port specifies the serial port on the RoboRIO.
* @param baudrate specifies the baud rate.
*/
public FrcPixyCam(final String instanceName,int baudrate)
{
this(instanceName,DEF_DATA_BITS,DEF_PARITY,DEF_STOP_BITS);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。