mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Move CameraServer and WPILib headers into their own folder
The old headers were moved into folders because doing so avoids polluting the system include directories. Folder names were also normalized to lowercase.
This commit is contained in:
committed by
Peter Johnson
parent
31ced30c1e
commit
d89b7dd412
@@ -0,0 +1,25 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "lowfisim/MotorEncoderConnector.h"
|
||||
|
||||
namespace frc {
|
||||
namespace sim {
|
||||
namespace lowfi {
|
||||
|
||||
MotorEncoderConnector::MotorEncoderConnector(MotorSim& motorController,
|
||||
EncoderSim& encoder)
|
||||
: motorSimulator(motorController), encoderSimulator(encoder) {}
|
||||
|
||||
void MotorEncoderConnector::Update() {
|
||||
encoderSimulator.SetPosition(motorSimulator.GetPosition());
|
||||
encoderSimulator.SetVelocity(motorSimulator.GetVelocity());
|
||||
}
|
||||
|
||||
} // namespace lowfi
|
||||
} // namespace sim
|
||||
} // namespace frc
|
||||
@@ -0,0 +1,40 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "lowfisim/motormodel/SimpleMotorModel.h"
|
||||
|
||||
namespace frc {
|
||||
namespace sim {
|
||||
namespace lowfi {
|
||||
|
||||
SimpleMotorModel::SimpleMotorModel(double maxSpeed) : m_maxSpeed(maxSpeed) {}
|
||||
|
||||
void SimpleMotorModel::Reset() {
|
||||
m_position = 0;
|
||||
m_velocity = 0;
|
||||
}
|
||||
|
||||
void SimpleMotorModel::SetVoltage(double voltage) {
|
||||
m_voltagePercentage = voltage / kMaxExpectedVoltage;
|
||||
}
|
||||
|
||||
void SimpleMotorModel::Update(double elapsedTime) {
|
||||
m_velocity = m_maxSpeed * m_voltagePercentage;
|
||||
m_position += m_velocity * elapsedTime;
|
||||
}
|
||||
|
||||
double SimpleMotorModel::GetPosition() const { return m_position; }
|
||||
|
||||
double SimpleMotorModel::GetVelocity() const { return m_velocity; }
|
||||
|
||||
double SimpleMotorModel::GetAcceleration() const { return 0; }
|
||||
|
||||
double SimpleMotorModel::GetCurrent() const { return 0; }
|
||||
|
||||
} // namespace lowfi
|
||||
} // namespace sim
|
||||
} // namespace frc
|
||||
@@ -0,0 +1,27 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "lowfisim/wpisimulators/WpiEncoderSim.h"
|
||||
|
||||
namespace frc {
|
||||
namespace sim {
|
||||
namespace lowfi {
|
||||
|
||||
WpiEncoderSim::WpiEncoderSim(int index) : m_encoderSimulator(index) {}
|
||||
|
||||
void WpiEncoderSim::SetPosition(double position) {
|
||||
m_encoderSimulator.SetCount(
|
||||
static_cast<int>(position / m_encoderSimulator.GetDistancePerPulse()));
|
||||
}
|
||||
|
||||
void WpiEncoderSim::SetVelocity(double velocity) {
|
||||
m_encoderSimulator.SetPeriod(1.0 / velocity);
|
||||
}
|
||||
|
||||
} // namespace lowfi
|
||||
} // namespace sim
|
||||
} // namespace frc
|
||||
@@ -0,0 +1,37 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "lowfisim/wpisimulators/WpiMotorSim.h"
|
||||
|
||||
namespace frc {
|
||||
namespace sim {
|
||||
namespace lowfi {
|
||||
|
||||
WpiMotorSim::WpiMotorSim(int index, MotorModel& motorModelSimulator)
|
||||
: m_motorModelSimulation(motorModelSimulator), m_pwmSimulator(index) {}
|
||||
|
||||
void WpiMotorSim::Update(double elapsedTime) {
|
||||
m_motorModelSimulation.SetVoltage(m_pwmSimulator.GetSpeed() *
|
||||
kDefaultVoltage);
|
||||
m_motorModelSimulation.Update(elapsedTime);
|
||||
}
|
||||
|
||||
double WpiMotorSim::GetPosition() const {
|
||||
return m_motorModelSimulation.GetPosition();
|
||||
}
|
||||
|
||||
double WpiMotorSim::GetVelocity() const {
|
||||
return m_motorModelSimulation.GetVelocity();
|
||||
}
|
||||
|
||||
double WpiMotorSim::GetAcceleration() const {
|
||||
return m_motorModelSimulation.GetAcceleration();
|
||||
}
|
||||
|
||||
} // namespace lowfi
|
||||
} // namespace sim
|
||||
} // namespace frc
|
||||
Reference in New Issue
Block a user