Skip to content

Commit

Permalink
restore prev namespace stuff, need to define driveTrainSwerve in Glob…
Browse files Browse the repository at this point in the history
…als.cpp
  • Loading branch information
clowdur committed Aug 6, 2023
1 parent 42dcb1a commit 6664fa5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/world_interface/kinematic_common_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ using util::toTransform;
using std::chrono::duration_cast;
using std::chrono::milliseconds;
using namespace std::chrono_literals;
//using Globals::driveTrainSwerve;
using Globals::driveTrainSwerve;

namespace robot {
namespace {
Expand Down Expand Up @@ -98,18 +98,18 @@ double setCmdVelSwerve(double j1x, double j1y, double j2x, double j2y, int drive

}
}
Globals::driveTrainSwerve.driveMode = (uint8_t)drivemode;
DriveFromHandController(&Globals::driveTrainSwerve, j1x, j1y, j2x, j2y);

setMotorPower(motorid_t::frontLeftWheel, (double)(Globals::driveTrainSwerve.wh[0]).control.wheelSpeed);
setMotorPower(motorid_t::rearLeftWheel, (double)(Globals::driveTrainSwerve.wh[3]).control.wheelSpeed);
setMotorPower(motorid_t::frontRightWheel, (double)(Globals::driveTrainSwerve.wh[1]).control.wheelSpeed);
setMotorPower(motorid_t::rearRightWheel, (double)(Globals::driveTrainSwerve.wh[2]).control.wheelSpeed);

setMotorPos(motorid_t::frontLeftSteer, (double)(Globals::driveTrainSwerve.wh[0]).control.steeringTarget * 180.0 / 3.14159);
setMotorPos(motorid_t::rearLeftSteer, (double)(Globals::driveTrainSwerve.wh[3]).control.steeringTarget * 180.0 / 3.14159);
setMotorPos(motorid_t::frontRightSteer, (double)(Globals::driveTrainSwerve.wh[1]).control.steeringTarget * 180.0 / 3.14159);
setMotorPos(motorid_t::rearRightSteer, (double)(Globals::driveTrainSwerve.wh[2]).control.steeringTarget * 180.0 / 3.14159);
driveTrainSwerve.driveMode = (uint8_t)drivemode;
DriveFromHandController(&driveTrainSwerve, j1x, j1y, j2x, j2y);
// TODO: define driveTrainSwerve in Globals.cpp
setMotorPower(motorid_t::frontLeftWheel, (double)(driveTrainSwerve.wh[0]).control.wheelSpeed);
setMotorPower(motorid_t::rearLeftWheel, (double)(driveTrainSwerve.wh[3]).control.wheelSpeed);
setMotorPower(motorid_t::frontRightWheel, (double)(driveTrainSwerve.wh[1]).control.wheelSpeed);
setMotorPower(motorid_t::rearRightWheel, (double)(driveTrainSwerve.wh[2]).control.wheelSpeed);

setMotorPos(motorid_t::frontLeftSteer, (double)(driveTrainSwerve.wh[0]).control.steeringTarget * 180.0 / 3.14159);
setMotorPos(motorid_t::rearLeftSteer, (double)(driveTrainSwerve.wh[3]).control.steeringTarget * 180.0 / 3.14159);
setMotorPos(motorid_t::frontRightSteer, (double)(driveTrainSwerve.wh[1]).control.steeringTarget * 180.0 / 3.14159);
setMotorPos(motorid_t::rearRightSteer, (double)(driveTrainSwerve.wh[2]).control.steeringTarget * 180.0 / 3.14159);

return 0.0;
}
Expand Down

0 comments on commit 6664fa5

Please sign in to comment.