mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
guh
This commit is contained in:
@@ -80,8 +80,6 @@ export function ControlSystemProvider({ children }) {
|
||||
|
||||
const setDriveVector = useCallback(
|
||||
(vector, meta = {}) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('[control] setDriveVector', vector, meta);
|
||||
const computed = computeDifferentialSpeeds(vector);
|
||||
dispatch({
|
||||
type: 'control/update-drive',
|
||||
@@ -94,8 +92,6 @@ export function ControlSystemProvider({ children }) {
|
||||
|
||||
const setAuxMotors = useCallback(
|
||||
(values = {}) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('[control] setAuxMotors', values);
|
||||
const payload = pipeline.sendAuxMotors(values) ?? values;
|
||||
dispatch({
|
||||
type: 'control/set-aux-motors',
|
||||
|
||||
@@ -42,8 +42,6 @@ export function useCommandPipeline() {
|
||||
left: clampRange(speeds?.left ?? 0, [-500, 500]),
|
||||
right: clampRange(speeds?.right ?? 0, [-500, 500]),
|
||||
};
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('[pipeline] sendDriveDirect', payload);
|
||||
emitCommand({
|
||||
type: 'drive',
|
||||
data: { driveDirect: payload },
|
||||
@@ -61,8 +59,6 @@ export function useCommandPipeline() {
|
||||
side: clampRange(side, AUX_LIMITS.side),
|
||||
vacuum: clampRange(vacuum, AUX_LIMITS.vacuum),
|
||||
};
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('[pipeline] sendAuxMotors', payload);
|
||||
emitCommand({
|
||||
type: 'motors',
|
||||
data: { motorPwm: payload },
|
||||
|
||||
@@ -115,8 +115,6 @@ export default function KeyboardInputManager() {
|
||||
vector.y !== lastVectorRef.current.y ||
|
||||
vector.boost !== lastVectorRef.current.boost
|
||||
) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('[keyboard] drive vector', Array.from(tokensSnapshot), vector);
|
||||
lastVectorRef.current = vector;
|
||||
setDriveVector(vector, { source: SOURCE });
|
||||
}
|
||||
@@ -125,8 +123,6 @@ export default function KeyboardInputManager() {
|
||||
aux.side !== lastAuxRef.current.side ||
|
||||
aux.vacuum !== lastAuxRef.current.vacuum
|
||||
) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('[keyboard] aux state', Array.from(tokensSnapshot), aux);
|
||||
lastAuxRef.current = aux;
|
||||
setAuxMotors(aux);
|
||||
}
|
||||
@@ -154,26 +150,18 @@ export default function KeyboardInputManager() {
|
||||
const ensureServoLoop = useCallback(() => {
|
||||
const direction = computeServoDirection();
|
||||
if (direction === 0) {
|
||||
if (servoIntervalRef.current) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('[keyboard] servo loop stop');
|
||||
}
|
||||
stopServoLoop();
|
||||
return;
|
||||
}
|
||||
if (servoIntervalRef.current) {
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('[keyboard] servo loop start', direction);
|
||||
const tick = () => {
|
||||
const nextDirection = computeServoDirection();
|
||||
if (nextDirection === 0) {
|
||||
stopServoLoop();
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('[keyboard] servo tick', nextDirection);
|
||||
nudgeServo(nextDirection * servoStep);
|
||||
servoIntervalRef.current = setTimeout(tick, SERVO_REPEAT_MS);
|
||||
};
|
||||
@@ -197,8 +185,6 @@ export default function KeyboardInputManager() {
|
||||
if (tokens.some((token) => actionTokens.has(token))) {
|
||||
event.preventDefault();
|
||||
}
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('[keyboard] keydown', { key: event.key, code: event.code, tokens });
|
||||
const newlyPressed = tokens.filter((token) => !activeTokensRef.current.has(token));
|
||||
newlyPressed.forEach((token) => activeTokensRef.current.add(token));
|
||||
|
||||
@@ -218,8 +204,6 @@ export default function KeyboardInputManager() {
|
||||
|
||||
function handleKeyUp(event) {
|
||||
const tokens = tokensForEvent(event);
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('[keyboard] keyup', { key: event.key, code: event.code, tokens });
|
||||
tokens.forEach((token) => activeTokensRef.current.delete(token));
|
||||
ensureServoLoop();
|
||||
driveFromKeys();
|
||||
|
||||
Reference in New Issue
Block a user