Skip to content

Commit

Permalink
RSDK-4902: FIX (viamrobotics#2965)
Browse files Browse the repository at this point in the history
  • Loading branch information
martha-johnston committed Sep 21, 2023
1 parent b69664e commit 2416c83
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
14 changes: 6 additions & 8 deletions components/motor/gpio/motor_encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ func newEncodedMotor(
em.maxPowerPct = 1.0
}

rpmDebug = motorConfig.Debug

return em, nil
}

Expand Down Expand Up @@ -270,10 +268,10 @@ func (m *EncodedMotor) makeAdjustments(pos, lastPos float64, now, lastTime int64
}

if rpmDebug {
m.logger.Debug("making adjustments")
m.logger.Debugf("lastPos: %v, pos: %v, goalPos: %v", lastPos, pos, m.state.goalPos)
m.logger.Debugf("lastTime: %v, now: %v", lastTime, now)
m.logger.Debugf("currentRPM: %v, goalRPM: %v", m.state.currentRPM, m.state.goalRPM)
m.logger.Info("making adjustments")
m.logger.Infof("lastPos: %v, pos: %v, goalPos: %v", lastPos, pos, m.state.goalPos)
m.logger.Infof("lastTime: %v, now: %v", lastTime, now)
m.logger.Infof("currentRPM: %v, goalRPM: %v", m.state.currentRPM, m.state.goalRPM)
}

dir := m.directionMovingInLock()
Expand All @@ -284,7 +282,7 @@ func (m *EncodedMotor) makeAdjustments(pos, lastPos float64, now, lastTime int64
powerPct = m.state.lastPowerPct
}
if rpmDebug {
m.logger.Debugf("decreasing powerPct to %v", powerPct)
m.logger.Infof("decreasing powerPct to %v", powerPct)
}
if err := m.setPower(m.cancelCtx, powerPct, true); err != nil {
return err
Expand All @@ -296,7 +294,7 @@ func (m *EncodedMotor) makeAdjustments(pos, lastPos float64, now, lastTime int64
powerPct = m.state.lastPowerPct
}
if rpmDebug {
m.logger.Debugf("increasing powerPct to %v", powerPct)
m.logger.Infof("increasing powerPct to %v", powerPct)
}
if err := m.setPower(m.cancelCtx, powerPct, true); err != nil {
return err
Expand Down
1 change: 0 additions & 1 deletion components/motor/gpio/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ type Config struct {
RampRate float64 `json:"ramp_rate_rpm_per_sec,omitempty"` // how fast to ramp power to motor when using rpm control
MaxRPM float64 `json:"max_rpm,omitempty"`
TicksPerRotation int `json:"ticks_per_rotation,omitempty"`
Debug bool `json:"rpm_debug,omitempty"`
}

// Validate ensures all parts of the config are valid.
Expand Down

0 comments on commit 2416c83

Please sign in to comment.