From 86139b997e36807b42d959e23d2eacd926764607 Mon Sep 17 00:00:00 2001 From: workshop2 Date: Sat, 9 May 2020 20:37:15 +0100 Subject: [PATCH] Clean up front arm --- experiments/servos.ts | 6 ++--- psybot-lib/components/frontarm.ts | 37 +++---------------------------- psybot-lib/psybot.ts | 3 +-- 3 files changed, 7 insertions(+), 39 deletions(-) diff --git a/experiments/servos.ts b/experiments/servos.ts index 3576550..a8f2c55 100644 --- a/experiments/servos.ts +++ b/experiments/servos.ts @@ -4,16 +4,16 @@ var config = require('../config/config'); const run = async () => { var psybot = await Psybot.Create(config.settings.usbConnection); await psybot.frontArm.centerAsync(); - await psybot.frontArm.faceUpAsync(); + //await psybot.frontArm.faceUpAsync(); await psybot.frontArm.centerAsync(); - await psybot.frontArm.faceDownAsync(); + //await psybot.frontArm.faceDownAsync(); await psybot.frontArm.centerAsync(); await psybot.frontArm.faceLeftAsync(); await psybot.frontArm.centerAsync(); await psybot.frontArm.faceRightAsync(); await psybot.frontArm.centerAsync(); await psybot.frontArm.sweepLeftAsync(); - await psybot.frontArm.sweepUpDownAsync(); + //await psybot.frontArm.sweepUpDownAsync(); } run(); \ No newline at end of file diff --git a/psybot-lib/components/frontarm.ts b/psybot-lib/components/frontarm.ts index 29d706b..a86ad08 100644 --- a/psybot-lib/components/frontarm.ts +++ b/psybot-lib/components/frontarm.ts @@ -3,57 +3,31 @@ import delay from "../delay" export class FrontArm { private bottomServo: Servo; - //private topServo: Servo; - private operationTimeout: number = 400; + private operationTimeout: number = 600; - constructor(bottomServoPin: number, topServoPin: number) { + constructor(bottomServoPin: number) { this.bottomServo = new Servo({ pin: bottomServoPin, range: [40, 180], center: true }); - // this.topServo = new Servo({ - // pin: topServoPin, - // range: [40, 140], - // center: true - // }); - this.centerAsync(); } public async stopAsync(): Promise { - //this.topServo.stop(); this.bottomServo.stop(); await delay(this.operationTimeout); } - public async stopBottomAsync(): Promise { + private async stopBottomAsync(): Promise { this.bottomServo.stop(); await delay(this.operationTimeout); } - public async stopTopAsync(): Promise { - //this.topServo.stop(); - await delay(this.operationTimeout); - } - public async centerAsync(): Promise { this.bottomServo.center(); - //this.topServo.center(); - - await delay(this.operationTimeout); - } - - public async faceUpAsync(): Promise { - //this.topServo.min(); - - await delay(this.operationTimeout); - } - - public async faceDownAsync(): Promise { - //this.topServo.max(); await delay(this.operationTimeout); } @@ -68,11 +42,6 @@ export class FrontArm { await delay(this.operationTimeout); } - public async sweepUpDownAsync(sweepOptions?: ServoSweepOpts): Promise { - await this.stopTopAsync(); - //this.topServo.sweep(sweepOptions); - } - public async sweepLeftAsync(sweepOptions?: ServoSweepOpts): Promise { await this.stopBottomAsync(); this.bottomServo.sweep(sweepOptions); diff --git a/psybot-lib/psybot.ts b/psybot-lib/psybot.ts index 90039a4..e9b5dd5 100644 --- a/psybot-lib/psybot.ts +++ b/psybot-lib/psybot.ts @@ -61,8 +61,7 @@ export class Psybot { get frontArm(): FrontArm { if (!this._frontArm) { this._frontArm = new FrontArm( - this.armPins.bottomServoPin, - this.armPins.topServoPin); + this.armPins.bottomServoPin); } return this._frontArm;