diff --git a/libs/chassis/_locales/chassis-jsdoc-strings.json b/libs/chassis/_locales/chassis-jsdoc-strings.json index 95696473..c9a373d5 100644 --- a/libs/chassis/_locales/chassis-jsdoc-strings.json +++ b/libs/chassis/_locales/chassis-jsdoc-strings.json @@ -1,12 +1,9 @@ { "chassis.Chassis": "A differential drive robot", "chassis.Chassis.drive": "Makes a differential drive robot move with a given speed (cm/s) and rotation rate (deg/s)\nusing a unicycle model.", - "chassis.Chassis.driveFor": "Makes a differential drive robot move with a given speed (cm/s) and rotation rate (deg/s)\nusing a unicycle model.", - "chassis.Chassis.driveFor|param|rotationSpeed": "rotation of the robot around the center point, eg: 30", - "chassis.Chassis.driveFor|param|speed": "speed of the center point between motors, eg: 10", - "chassis.Chassis.driveFor|param|value": "the amount of movement, eg: 2", "chassis.Chassis.drive|param|rotationSpeed": "rotation of the robot around the center point, eg: 30", "chassis.Chassis.drive|param|speed": "speed of the center point between motors, eg: 10", + "chassis.Chassis.drive|param|value": "the amount of movement, eg: 2", "chassis.Chassis.setMotors": "Sets the motors used by the chassis, default is B+C", "chassis.Chassis.setProperty": "Sets a property of the robot", "chassis.Chassis.setProperty|param|property": "the property to set", diff --git a/libs/chassis/_locales/chassis-strings.json b/libs/chassis/_locales/chassis-strings.json index 45b84814..3ca1aed1 100644 --- a/libs/chassis/_locales/chassis-strings.json +++ b/libs/chassis/_locales/chassis-strings.json @@ -1,7 +1,6 @@ { "ChassisProperty.BaseLength|block": "base length (cm)", "ChassisProperty.WheelRadius|block": "wheel radius (cm)", - "chassis.Chassis.driveFor|block": "drive %chassis|at %speed|cm/s|turning %rotationSpeed|deg/s|for %value|%unit", "chassis.Chassis.drive|block": "drive %chassis|at %speed|cm/s|turning %rotationSpeed|deg/s", "chassis.Chassis.setMotors|block": "set %chassis|motors to %motors", "chassis.Chassis.setProperty|block": "set %chassis|%property|to %value", diff --git a/libs/chassis/chassis.ts b/libs/chassis/chassis.ts index 845cbb7c..03155949 100644 --- a/libs/chassis/chassis.ts +++ b/libs/chassis/chassis.ts @@ -24,19 +24,6 @@ namespace chassis { 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 - */ - //% blockId=motorDrive block="drive %chassis|at %speed|cm/s|turning %rotationSpeed|deg/s" - //% inlineInputMode=inline - //% weight=99 blockGap=8 - drive(speed: number, rotationSpeed: number) { - this.driveFor(speed, rotationSpeed, 0, MoveUnit.Degrees); - } - /** * Makes a differential drive robot move with a given speed (cm/s) and rotation rate (deg/s) * using a unicycle model. @@ -45,10 +32,10 @@ namespace chassis { * @param value the amount of movement, eg: 2 * @param unit */ - //% blockId=motorDriveFor block="drive %chassis|at %speed|cm/s|turning %rotationSpeed|deg/s|for %value|%unit" + //% blockId=motorDrive block="drive %chassis|at %speed|cm/s|turning %rotationSpeed|deg/s" //% inlineInputMode=inline //% weight=95 blockGap=8 - driveFor(speed: number, rotationSpeed: number, value: number, unit: MoveUnit) { + drive(speed: number, rotationSpeed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) { // speed is expressed in % const R = this.wheelRadius; // cm const L = this.baseLength; // cm @@ -65,7 +52,7 @@ namespace chassis { const sr = vr / maxw * 100; // % const sl = vl / maxw * 100; // % - this.motors.tankFor(sr, sl, value, unit) + this.motors.tank(sr, sl, value, unit) } /**