From 022a6765bfd2134343b8d58a71910cd035680b24 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Mon, 21 May 2018 15:19:26 -0700 Subject: [PATCH] removing libs/automation, libs/chassis --- libs/automation/pxt.json | 6 --- libs/chassis/README.md | 3 -- libs/chassis/chassis.ts | 97 ---------------------------------------- libs/chassis/pxt.json | 15 ------- libs/chassis/test.ts | 1 - 5 files changed, 122 deletions(-) delete mode 100644 libs/automation/pxt.json delete mode 100644 libs/chassis/README.md delete mode 100644 libs/chassis/chassis.ts delete mode 100644 libs/chassis/pxt.json delete mode 100644 libs/chassis/test.ts diff --git a/libs/automation/pxt.json b/libs/automation/pxt.json deleted file mode 100644 index e0eec278..00000000 --- a/libs/automation/pxt.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "additionalFilePath": "../../node_modules/pxt-common-packages/libs/automation", - "dependencies": { - "ev3": "file:../ev3" - } -} \ No newline at end of file diff --git a/libs/chassis/README.md b/libs/chassis/README.md deleted file mode 100644 index 4d4eea72..00000000 --- a/libs/chassis/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Chassis - -A library to control a chassis. \ No newline at end of file diff --git a/libs/chassis/chassis.ts b/libs/chassis/chassis.ts deleted file mode 100644 index af450310..00000000 --- a/libs/chassis/chassis.ts +++ /dev/null @@ -1,97 +0,0 @@ -/** - * A differential drive robot - */ -//% weight=50 color=#cf00cf -namespace chassis { - /** - * A differential drive robot - */ - //% fixedInstances - export class Chassis { - // the motor pair - public motors: motors.SynchedMotorPair; - // the radius of the wheel (cm) - public wheelRadius: number; - // the distance between the wheels (cm) - public baseLength: number; - - constructor() { - this.motors = motors.largeBC; - this.wheelRadius = 3; - this.baseLength = 12; - } - - /** - * Makes a differential drive robot move with a given speed (cm/s) and rotation rate (deg/s) - * using a unicycle model. - * @param speed speed of the center point between motors, eg: 10 - * @param rotationSpeed rotation of the robot around the center point, eg: 30 - * @param distance - **/ - //% blockId=motorDrive block="drive %chassis|at %speed|cm/s|turning %rotationSpeed|deg/s" - //% inlineInputMode=inline - //% weight=95 blockGap=8 - drive(speed: number, rotationSpeed: number, distance: number = 0) { - if (!speed) { - this.motors.stop(); - return; - } - - // speed is expressed in % - const R = this.wheelRadius; // cm - const L = this.baseLength; // cm - const PI = 3.14; - const maxw = 170 / 60 * 2 * PI; // rad / s - const maxv = maxw * R; // cm / s - // speed is cm / s - const v = speed; // cm / s - const w = rotationSpeed / 360 * 2 * PI; // rad / s - - const vr = (2 * v + w * L) / (2 * R); // rad / s - const vl = (2 * v - w * L) / (2 * R); // rad / s - - const sr = vr / maxw * 100; // % - const sl = vl / maxw * 100; // % - - // cm / (cm/s) = s - const seconds = distance / speed; - - this.motors.tank(sr, sl, seconds, MoveUnit.Seconds) - } - - /** - * Sets the wheel radius in centimeters - * @param cm - */ - //% blockId=chassisSetWheelRadius block="set %chassis|wheel radius to %cm|(cm)" - setWheelRadius(cm: number) { - this.wheelRadius = cm; - } - - /** - * Sets the base length in centimeters - * @param cm - */ - //% blockId=chassisSetBaseLength block="set %chassis|base length to %cm|(cm)" - setBaseLength(cm: number) { - this.baseLength = cm; - } - - /** - * Sets the motors used by the chassis, default is B+C - * @param motors - */ - //% blockId=chassisSetMotors block="set %chassis|motors to %motors" - //% weight=10 - setMotors(motors: motors.SynchedMotorPair) { - this.motors = motors; - } - - toString(): string { - return `chassis base ${this.baseLength}, wheel ${this.wheelRadius}`; - } - } - - //% fixedInstance whenUsed - export const chassis = new Chassis(); -} \ No newline at end of file diff --git a/libs/chassis/pxt.json b/libs/chassis/pxt.json deleted file mode 100644 index 936aed4e..00000000 --- a/libs/chassis/pxt.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "chassis", - "description": "Chassis robot support", - "files": [ - "README.md", - "chassis.ts" - ], - "testFiles": [ - "test.ts" - ], - "public": true, - "dependencies": { - "core": "file:../core" - } -} \ No newline at end of file diff --git a/libs/chassis/test.ts b/libs/chassis/test.ts deleted file mode 100644 index 8b137891..00000000 --- a/libs/chassis/test.ts +++ /dev/null @@ -1 +0,0 @@ -