diff --git a/src/autonomous/AutonomousTask.cpp b/src/autonomous/AutonomousTask.cpp index e3067abe..82fb8839 100644 --- a/src/autonomous/AutonomousTask.cpp +++ b/src/autonomous/AutonomousTask.cpp @@ -36,7 +36,7 @@ void AutonomousTask::navigate() { SLOW_DRIVE_THRESHOLD, DONE_THRESHOLD, CLOSE_TO_TARGET_DUR_VAL); - DiffDriveKinematics diffDriveKinematics(Constants::EFF_WHEEL_BASE); + kinematics::DiffDriveKinematics diffDriveKinematics(Constants::EFF_WHEEL_BASE); auto sleepUntil = std::chrono::steady_clock().now(); while (!cmd.isDone()) { @@ -50,8 +50,8 @@ void AutonomousTask::navigate() { cmd.setState(latestPos, robot::types::dataclock::now()); commands::command_t output = cmd.getOutput(); auto scaledVels = diffDriveKinematics.ensureWithinWheelSpeedLimit( - DiffDriveKinematics::PreferredVelPreservation::PreferThetaVel, output.xVel, - output.thetaVel, Constants::MAX_WHEEL_VEL); + kinematics::DiffDriveKinematics::PreferredVelPreservation::PreferThetaVel, + output.xVel, output.thetaVel, Constants::MAX_WHEEL_VEL); navtypes::point_t relTarget = util::toTransform(latestPos) * _waypoint_coords; LOG_F(INFO, "Relative Target: (%lf, %lf)", relTarget(0), relTarget(1)); LOG_F(INFO, "thetaVel: %lf", scaledVels(2)); diff --git a/src/control_interface.cpp b/src/control_interface.cpp index 79c91242..15b139cd 100644 --- a/src/control_interface.cpp +++ b/src/control_interface.cpp @@ -24,7 +24,7 @@ using namespace std::chrono_literals; namespace robot { namespace { -jointpos_t commandedWristPos{0, 0}; +kinematics::jointpos_t commandedWristPos{0, 0}; std::mutex wristPosMutex; void setJointMotorPower(robot::types::jointid_t joint, double power); @@ -57,7 +57,7 @@ double setCmdVel(double dtheta, double dx) { } } - wheelvel_t wheelVels = driveKinematics().robotVelToWheelVel(dx, dtheta); + kinematics::wheelvel_t wheelVels = driveKinematics().robotVelToWheelVel(dx, dtheta); double lPWM = wheelVels.lVel / Constants::MAX_WHEEL_VEL; double rPWM = wheelVels.rVel / Constants::MAX_WHEEL_VEL; double maxAbsPWM = std::max(std::abs(lPWM), std::abs(rPWM)); @@ -92,7 +92,7 @@ double setTankCmdVel(double left, double right) { if (!Globals::swerveController.checkWheelRotation(DriveMode::Normal, curr_wheel_rots)) return 0; - wheelvel_t wheelVels = {left, right}; + kinematics::wheelvel_t wheelVels = {left, right}; double lPWM = wheelVels.lVel / Constants::MAX_WHEEL_VEL; double rPWM = wheelVels.rVel / Constants::MAX_WHEEL_VEL; double maxAbsPWM = std::max(std::abs(lPWM), std::abs(rPWM)); diff --git a/src/kinematics/SwerveDriveKinematics.h b/src/kinematics/SwerveDriveKinematics.h index 05173719..2c282621 100644 --- a/src/kinematics/SwerveDriveKinematics.h +++ b/src/kinematics/SwerveDriveKinematics.h @@ -3,7 +3,6 @@ #include "../navtypes.h" namespace kinematics { -using namespace navtypes; /** * Represents robot wheel velocities in robot reference frame, @@ -61,7 +60,7 @@ class SwerveDriveKinematics { * robot's reference frame. * @return the robot's translational and angular velocity in the robot's reference frame. */ - pose_t wheelVelToRobotVel(swervewheelvel_t wheelVel) const; + navtypes::pose_t wheelVelToRobotVel(swervewheelvel_t wheelVel) const; /** * Calculate the pose update in the local reference frame given the velocities of the diff --git a/src/world_interface/simulator_interface.cpp b/src/world_interface/simulator_interface.cpp index f8348baf..cbeb1ae4 100644 --- a/src/world_interface/simulator_interface.cpp +++ b/src/world_interface/simulator_interface.cpp @@ -249,10 +249,10 @@ void initSimServer(net::websocket::SingleClientWSServer& ws) { namespace robot { namespace { -DiffDriveKinematics drive_kinematics(Constants::EFF_WHEEL_BASE); +kinematics::DiffDriveKinematics drive_kinematics(Constants::EFF_WHEEL_BASE); } // namespace -const DiffDriveKinematics& driveKinematics() { +const kinematics::DiffDriveKinematics& driveKinematics() { return drive_kinematics; } diff --git a/src/world_interface/world_interface.h b/src/world_interface/world_interface.h index e9044802..b9507cf9 100644 --- a/src/world_interface/world_interface.h +++ b/src/world_interface/world_interface.h @@ -11,7 +11,6 @@ #include #include -using namespace kinematics; // forward declare cam::CameraParams instead of including it // we do this to avoid unnecessarily including OpenCV in all build targets namespace cam {