Drive Constructors
Integrated Encoders
This is the standard setup that uses built in motor encoders.
left_motor_ports
a vector of left motor ports, negative reverses the port. first motor is used for sensing
right_motor_ports
a vector of right motor ports, negative reverses the port. first motor is used for sensing
imu_port
the port an imu is in
wheel_diameter
diameter of your drive wheel
ticks
cartridge rpm
ratio
external ratio of your drive. should be wheel gear / motor gear. this is defaulted to 1.0
- Prototype
- Example 1
- Example 2
ez::Drive chassis(
// These are your drive motors, the first motor is used for sensing!
{1, 2, 3}, // Left Chassis Ports (negative port will reverse it!)
{-4, -5, -6}, // Right Chassis Ports (negative port will reverse it!)
7, // IMU Port
4.125, // Wheel Diameter (Remember, 4" wheels without screw holes are actually 4.125!)
343); // Wheel RPM
ez::Drive chassis(
// These are your drive motors, the first motor is used for sensing!
{1, 2, 3}, // Left Chassis Ports (negative port will reverse it!)
{-4, -5, -6}, // Right Chassis Ports (negative port will reverse it!)
7, // IMU Port
4.125, // Wheel Diameter (Remember, 4" wheels without screw holes are actually 4.125!)
600, // Cartridge RPM
// External Gear Ratio (MUST BE DECIMAL) This is WHEEL GEAR / MOTOR GEAR
// eg. if your drive is 84:36 where the 36t is powered, your RATIO would be 84/36 which is 2.333
// eg. if your drive is 36:60 where the 60t is powered, your RATIO would be 36/60 which is 0.6
1.43);
Drive(std::vector<int> left_motor_ports, std::vector<int> right_motor_ports, int imu_port,
double wheel_diameter, double ticks, double ratio);
ADI Encoders in Brain
Only supports parallel trackers.
left_motor_ports
a vector of left motor ports, negative reverses the port
right_motor_ports
a vector of right motor ports, negative reverses the port
imu_port
the port an imu is in
wheel_diameter
diameter of your tracking wheel
ticks
ticks per rotation of your sensor. 360 if using ADI quadrature encoders
ratio
external ratio of your tracking wheel. should be wheel gear / motor gear
left_tracker_ports
vector of left tracker ports, negative will reverse the encoder
right_tracker_ports
vector of right tracker ports, negative will reverse the encoder
- Prototype
- Example
ez::Drive chassis(
// These are your drive motors, the first motor is used for sensing!
{1, 2, 3}, // Left Chassis Ports (negative port will reverse it!)
{-4, -5, -6}, // Right Chassis Ports (negative port will reverse it!)
7, // IMU Port
4.125, // Wheel Diameter (Remember, 4" wheels without screw holes are actually 4.125!)
360, // Ticks per Rotation of Encoder
// External Gear Ratio (MUST BE DECIMAL) This is WHEEL GEAR / SENSOR GEAR
// eg. if your drive is 84:36 where the 36t is sensored, your RATIO would be 84/36 which is 2.333
// eg. if your drive is 36:60 where the 60t is sensored, your RATIO would be 36/60 which is 0.6
1,
{1, 2}, // Left Tracking Wheel Ports (negative port will reverse it!)
{-3, -4}); // Right Tracking Wheel Ports (negative port will reverse it!)
Drive(std::vector<int> left_motor_ports, std::vector<int> right_motor_ports, int imu_port,
double wheel_diameter, double ticks, double ratio, std::vector<int> left_tracker_ports,
std::vector<int> right_tracker_ports);
ADI Encoders in Expander
Only supports parallel trackers.
left_motor_ports
a vector of left motor ports, negative reverses the port
right_motor_ports
a vector of right motor ports, negative reverses the port
imu_port
the port an imu is in
wheel_diameter
diameter of your tracking wheel
ticks
ticks per rotation of your sensor. 360 if using ADI quadrature encoders
ratio
external ratio of your tracking wheel. should be wheel gear / motor gear
left_tracker_ports
vector of left tracker ports, negative will reverse the encoder
right_tracker_ports
vector of right tracker ports, negative will reverse the encoder
expander_smart_port
port of the 3 wire expander
- Prototype
- Example
ez::Drive chassis(
// These are your drive motors, the first motor is used for sensing!
{1, 2, 3}, // Left Chassis Ports (negative port will reverse it!)
{-4, -5, -6}, // Right Chassis Ports (negative port will reverse it!)
7, // IMU Port
4.125, // Wheel Diameter (Remember, 4" wheels without screw holes are actually 4.125!)
360, // Ticks per Rotation of Encoder
// External Gear Ratio (MUST BE DECIMAL) This is WHEEL GEAR / SENSOR GEAR
// eg. if your drive is 84:36 where the 36t is sensored, your RATIO would be 84/36 which is 2.333
// eg. if your drive is 36:60 where the 60t is sensored, your RATIO would be 36/60 which is 0.6
1,
{1, 2}, // Left Tracking Wheel Ports (negative port will reverse it!)
{-3, -4}, // Right Tracking Wheel Ports (negative port will reverse it!)
9); // 3 Wire Port Expander Smart Port
Drive(std::vector<int> left_motor_ports, std::vector<int> right_motor_ports, int imu_port,
double wheel_diameter, double ticks, double ratio, std::vector<int> left_tracker_ports,
std::vector<int> right_tracker_ports, int expander_smart_port);
Rotation Sensor
Only supports parallel trackers.
left_motor_ports
a vector of left motor ports, negative reverses the port
right_motor_ports
a vector of right motor ports, negative reverses the port
imu_port
the port an imu is in
wheel_diameter
diameter of your tracking wheel
ticks
ticks per rotation of your sensor. 360 if using ADI quadrature encoders
ratio
external ratio of your tracking wheel. should be wheel gear / motor gear
left_rotation_port
port for left rotation sensor, negative reverses the port
right_rotation_port
port for right rotation sensor, negative reverses the port
- Prototype
- Example
ez::Drive chassis(
// These are your drive motors, the first motor is used for sensing!
{1, 2, 3}, // Left Chassis Ports (negative port will reverse it!)
{-4, -5, -6}, // Right Chassis Ports (negative port will reverse it!)
7, // IMU Port
4.125, // Wheel Diameter (Remember, 4" wheels without screw holes are actually 4.125!)
// External Gear Ratio (MUST BE DECIMAL) This is WHEEL GEAR / SENSOR GEAR
// eg. if your drive is 84:36 where the 36t is sensored, your RATIO would be 84/36 which is 2.333
// eg. if your drive is 36:60 where the 60t is sensored, your RATIO would be 36/60 which is 0.6
1,
8, // Left Rotation Port (negative port will reverse it!)
-9); // Right Rotation Port (negative port will reverse it!)
Drive(std::vector<int> left_motor_ports, std::vector<int> right_motor_ports, int imu_port,
double wheel_diameter, double ratio, int left_rotation_port, int right_rotation_port);