Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 5 additions & 20 deletions src/kpi_rover_ecu/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int main(int argc, char* argv[]) {

// Command-line options
int opt = 0;
while ((opt = getopt(argc, argv, "a:p:l:o:q:w:e:")) != -1) {
while ((opt = getopt(argc, argv, "a:p:l:o:")) != -1) {
switch (opt) {
case 'a':
server_address = optarg;
Expand All @@ -62,15 +62,6 @@ int main(int argc, char* argv[]) {
case 'o':
logging_directory = optarg;
break;
case 'q':
coef_p = strtof(optarg, nullptr);
break;
case 'w':
coef_i = strtof(optarg, nullptr);
break;
case 'e':
coef_d = strtof(optarg, nullptr);
break;
default:
std::cout << "Usage: " << argv[0];
std::cout << " [-a server_address] ";
Expand Down Expand Up @@ -105,17 +96,11 @@ int main(int argc, char* argv[]) {

MotorController motors_processor;
const uint8_t kMotorNumber = 4;
// const std::vector<MotorConfig> kShassisVector = {
// MotorConfig(3, false, {1.5, 0.056, 1.5}),
// MotorConfig(4, false, {1.5, 0.056, 1.5}),
// MotorConfig(1, true, {1.5, 0.056, 1.5}),
// MotorConfig(2, true, {1.5, 0.056, 1.5}),
// };
const std::vector<MotorConfig> kShassisVector = {
MotorConfig(3, false, {coef_p, coef_i, coef_d}),
MotorConfig(4, false, {coef_p, coef_i, coef_d}),
MotorConfig(1, true, {coef_p, coef_i, coef_d}),
MotorConfig(2, true, {coef_p, coef_i, coef_d}),
MotorConfig(3, false, {3.5, 0.2, 21}),
MotorConfig(4, false, {3.5, 0.2, 21}),
MotorConfig(1, true, {3.5, 0.2, 21}),
MotorConfig(2, true, {3.5, 0.2, 21}),
};

motors_processor.Init(kShassisVector, kMotorNumber);
Expand Down
2 changes: 1 addition & 1 deletion src/kpi_rover_ecu/src/motor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int Motor::MotorGo(int newRPM) {
LOG_WARNING << "RPM out of range for motor" << motorNumber_;
newRPM = -kMaxRpm;
}

if (MotorSet(newRPM) == -1) {
LOG_ERROR << "MotorSet failed";
return -1;
Expand Down
Loading