removing measured overloads until blocks support (#215)
This commit is contained in:
parent
85263fb84d
commit
a27a7fcd55
@ -71,29 +71,21 @@
|
|||||||
"motors.MotorBase.setBrake": "Sets the automatic brake on or off when the motor is off",
|
"motors.MotorBase.setBrake": "Sets the automatic brake on or off when the motor is off",
|
||||||
"motors.MotorBase.setBrake|param|brake": "a value indicating if the motor should break when off",
|
"motors.MotorBase.setBrake|param|brake": "a value indicating if the motor should break when off",
|
||||||
"motors.MotorBase.setReversed": "Reverses the motor polarity",
|
"motors.MotorBase.setReversed": "Reverses the motor polarity",
|
||||||
"motors.MotorBase.setSpeed": "Sets the speed of the motor.",
|
"motors.MotorBase.setSpeed": "Sets the motor speed for limited time or distance",
|
||||||
"motors.MotorBase.setSpeedFor": "Sets the motor speed for limited time or distance",
|
|
||||||
"motors.MotorBase.setSpeedFor|param|speed": "the speed from ``100`` full forward to ``-100`` full backward, eg: 50",
|
|
||||||
"motors.MotorBase.setSpeedFor|param|unit": "the meaning of the value",
|
|
||||||
"motors.MotorBase.setSpeedFor|param|value": "the move quantity, eg: 2",
|
|
||||||
"motors.MotorBase.setSpeed|param|speed": "the speed from ``100`` full forward to ``-100`` full backward, eg: 50",
|
"motors.MotorBase.setSpeed|param|speed": "the speed from ``100`` full forward to ``-100`` full backward, eg: 50",
|
||||||
|
"motors.MotorBase.setSpeed|param|unit": "(optional) unit of the value",
|
||||||
|
"motors.MotorBase.setSpeed|param|value": "(optional) measured distance or rotation",
|
||||||
"motors.MotorBase.stop": "Stops the motor(s).",
|
"motors.MotorBase.stop": "Stops the motor(s).",
|
||||||
"motors.SynchedMotorPair.steer": "Turns the motor and the follower motor by a number of rotations",
|
"motors.SynchedMotorPair.steer": "Turns the motor and the follower motor by a number of rotations",
|
||||||
"motors.SynchedMotorPair.steerFor": "Turns the motor and the follower motor by a number of rotations",
|
|
||||||
"motors.SynchedMotorPair.steerFor|param|speed": "the speed from ``100`` full forward to ``-100`` full backward, eg: 50",
|
|
||||||
"motors.SynchedMotorPair.steerFor|param|turnRatio": "the ratio of power sent to the follower motor, from ``-200`` to ``200``, eg: 0",
|
|
||||||
"motors.SynchedMotorPair.steerFor|param|unit": "the meaning of the value",
|
|
||||||
"motors.SynchedMotorPair.steerFor|param|value": "the move quantity, eg: 2",
|
|
||||||
"motors.SynchedMotorPair.steer|param|speed": "the speed from ``100`` full forward to ``-100`` full backward, eg: 50",
|
"motors.SynchedMotorPair.steer|param|speed": "the speed from ``100`` full forward to ``-100`` full backward, eg: 50",
|
||||||
"motors.SynchedMotorPair.steer|param|turnRatio": "the ratio of power sent to the follower motor, from ``-200`` to ``200``, eg: 0",
|
"motors.SynchedMotorPair.steer|param|turnRatio": "the ratio of power sent to the follower motor, from ``-200`` to ``200``, eg: 0",
|
||||||
|
"motors.SynchedMotorPair.steer|param|unit": "(optional) unit of the value",
|
||||||
|
"motors.SynchedMotorPair.steer|param|value": "(optional) move duration or rotation",
|
||||||
"motors.SynchedMotorPair.tank": "The Move Tank block can make a robot drive forward, backward, turn, or stop. \nUse the Move Tank block for robot vehicles that have two Large Motors, \nwith one motor driving the left side of the vehicle and the other the right side. \nYou can make the two motors go at different speeds or in different directions \nto make your robot turn.",
|
"motors.SynchedMotorPair.tank": "The Move Tank block can make a robot drive forward, backward, turn, or stop. \nUse the Move Tank block for robot vehicles that have two Large Motors, \nwith one motor driving the left side of the vehicle and the other the right side. \nYou can make the two motors go at different speeds or in different directions \nto make your robot turn.",
|
||||||
"motors.SynchedMotorPair.tankFor": "The Move Tank block can make a robot drive forward, backward, turn, or stop. \nUse the Move Tank block for robot vehicles that have two Large Motors, \nwith one motor driving the left side of the vehicle and the other the right side. \nYou can make the two motors go at different speeds or in different directions \nto make your robot turn.",
|
|
||||||
"motors.SynchedMotorPair.tankFor|param|speedLeft": "the speed on the left motor, eg: 50",
|
|
||||||
"motors.SynchedMotorPair.tankFor|param|speedRight": "the speed on the right motor, eg: 50",
|
|
||||||
"motors.SynchedMotorPair.tankFor|param|unit": "the unit of the value",
|
|
||||||
"motors.SynchedMotorPair.tankFor|param|value": "the amount of movement, eg: 2",
|
|
||||||
"motors.SynchedMotorPair.tank|param|speedLeft": "the speed on the left motor, eg: 50",
|
"motors.SynchedMotorPair.tank|param|speedLeft": "the speed on the left motor, eg: 50",
|
||||||
"motors.SynchedMotorPair.tank|param|speedRight": "the speed on the right motor, eg: 50",
|
"motors.SynchedMotorPair.tank|param|speedRight": "the speed on the right motor, eg: 50",
|
||||||
|
"motors.SynchedMotorPair.tank|param|unit": "(optional) unit of the value",
|
||||||
|
"motors.SynchedMotorPair.tank|param|value": "(optional) move duration or rotation",
|
||||||
"motors.SynchedMotorPair.toString": "Returns the name(s) of the motor",
|
"motors.SynchedMotorPair.toString": "Returns the name(s) of the motor",
|
||||||
"motors.mkCmd": "Allocates a message buffer",
|
"motors.mkCmd": "Allocates a message buffer",
|
||||||
"motors.mkCmd|param|addSize": "required additional bytes",
|
"motors.mkCmd|param|addSize": "required additional bytes",
|
||||||
|
@ -57,11 +57,8 @@
|
|||||||
"motors.MotorBase.pauseUntilReady|block": "%motor|pause until ready",
|
"motors.MotorBase.pauseUntilReady|block": "%motor|pause until ready",
|
||||||
"motors.MotorBase.setBrake|block": "set %motor|brake %brake",
|
"motors.MotorBase.setBrake|block": "set %motor|brake %brake",
|
||||||
"motors.MotorBase.setReversed|block": "set %motor|reversed %reversed",
|
"motors.MotorBase.setReversed|block": "set %motor|reversed %reversed",
|
||||||
"motors.MotorBase.setSpeedFor|block": "set %motor|speed to %speed=motorSpeedPicker|%|for %value|%unit",
|
|
||||||
"motors.MotorBase.setSpeed|block": "set %motor|speed to %speed=motorSpeedPicker|%",
|
"motors.MotorBase.setSpeed|block": "set %motor|speed to %speed=motorSpeedPicker|%",
|
||||||
"motors.SynchedMotorPair.steerFor|block": "steer %chassis|turn ratio %turnRatio|speed %speed=motorSpeedPicker|%|for %value|%unit",
|
|
||||||
"motors.SynchedMotorPair.steer|block": "steer %chassis|turn ratio %turnRatio|speed %speed=motorSpeedPicker|%",
|
"motors.SynchedMotorPair.steer|block": "steer %chassis|turn ratio %turnRatio|speed %speed=motorSpeedPicker|%",
|
||||||
"motors.SynchedMotorPair.tankFor|block": "tank %motors|%speedLeft=motorSpeedPicker|%|%speedRight=motorSpeedPicker|%|for %value|%unit",
|
|
||||||
"motors.SynchedMotorPair.tank|block": "tank %motors|%speedLeft=motorSpeedPicker|%|%speedRight=motorSpeedPicker|%",
|
"motors.SynchedMotorPair.tank|block": "tank %motors|%speedLeft=motorSpeedPicker|%|%speedRight=motorSpeedPicker|%",
|
||||||
"motors.largeAB|block": "large A+B",
|
"motors.largeAB|block": "large A+B",
|
||||||
"motors.largeAD|block": "large A+D",
|
"motors.largeAD|block": "large A+D",
|
||||||
@ -94,7 +91,6 @@
|
|||||||
"{id:group}Buttons": "Buttons",
|
"{id:group}Buttons": "Buttons",
|
||||||
"{id:group}Counters": "Counters",
|
"{id:group}Counters": "Counters",
|
||||||
"{id:group}Light": "Light",
|
"{id:group}Light": "Light",
|
||||||
"{id:group}Measured Move": "Measured Move",
|
|
||||||
"{id:group}More": "More",
|
"{id:group}More": "More",
|
||||||
"{id:group}Move": "Move",
|
"{id:group}Move": "Move",
|
||||||
"{id:group}Screen": "Screen",
|
"{id:group}Screen": "Screen",
|
||||||
|
@ -96,7 +96,7 @@ namespace motors {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputToName(out: Output): string {
|
export function outputToName(out: Output): string {
|
||||||
let r = "";
|
let r = "";
|
||||||
for (let i = 0; i < DAL.NUM_OUTPUTS; ++i) {
|
for (let i = 0; i < DAL.NUM_OUTPUTS; ++i) {
|
||||||
if (out & (1 << i)) {
|
if (out & (1 << i)) {
|
||||||
@ -202,33 +202,16 @@ namespace motors {
|
|||||||
reset(this._port);
|
reset(this._port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the speed of the motor.
|
|
||||||
* @param speed the speed from ``100`` full forward to ``-100`` full backward, eg: 50
|
|
||||||
*/
|
|
||||||
//% blockId=motorSetSpeed block="set %motor|speed to %speed=motorSpeedPicker|%"
|
|
||||||
//% on.fieldEditor=toggleonoff
|
|
||||||
//% weight=99 blockGap=8
|
|
||||||
//% group="Move"
|
|
||||||
setSpeed(speed: number) {
|
|
||||||
this.init();
|
|
||||||
speed = Math.clamp(-100, 100, speed >> 0);
|
|
||||||
if (!speed) // always stop
|
|
||||||
this.stop();
|
|
||||||
else
|
|
||||||
this._setSpeed(speed);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the motor speed for limited time or distance
|
* Sets the motor speed for limited time or distance
|
||||||
* @param speed the speed from ``100`` full forward to ``-100`` full backward, eg: 50
|
* @param speed the speed from ``100`` full forward to ``-100`` full backward, eg: 50
|
||||||
* @param value the move quantity, eg: 2
|
* @param value (optional) measured distance or rotation
|
||||||
* @param unit the meaning of the value
|
* @param unit (optional) unit of the value
|
||||||
*/
|
*/
|
||||||
//% blockId=motorMove block="set %motor|speed to %speed=motorSpeedPicker|%|for %value|%unit"
|
//% blockId=motorSetSpeed block="set %motor|speed to %speed=motorSpeedPicker|%"
|
||||||
//% weight=98 blockGap=8
|
//% weight=100 blockGap=8
|
||||||
//% group="Measured Move"
|
//% group="Move"
|
||||||
setSpeedFor(speed: number, value: number, unit: MoveUnit) {
|
setSpeed(speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
|
||||||
this.init();
|
this.init();
|
||||||
speed = Math.clamp(-100, 100, speed >> 0);
|
speed = Math.clamp(-100, 100, speed >> 0);
|
||||||
if (!speed) {
|
if (!speed) {
|
||||||
@ -455,7 +438,6 @@ namespace motors {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Move Tank block can make a robot drive forward, backward, turn, or stop.
|
* The Move Tank block can make a robot drive forward, backward, turn, or stop.
|
||||||
* Use the Move Tank block for robot vehicles that have two Large Motors,
|
* Use the Move Tank block for robot vehicles that have two Large Motors,
|
||||||
@ -464,30 +446,14 @@ namespace motors {
|
|||||||
* to make your robot turn.
|
* to make your robot turn.
|
||||||
* @param speedLeft the speed on the left motor, eg: 50
|
* @param speedLeft the speed on the left motor, eg: 50
|
||||||
* @param speedRight the speed on the right motor, eg: 50
|
* @param speedRight the speed on the right motor, eg: 50
|
||||||
|
* @param value (optional) move duration or rotation
|
||||||
|
* @param unit (optional) unit of the value
|
||||||
*/
|
*/
|
||||||
//% blockId=motorPairTank block="tank %motors|%speedLeft=motorSpeedPicker|%|%speedRight=motorSpeedPicker|%"
|
//% blockId=motorPairTank block="tank %motors|%speedLeft=motorSpeedPicker|%|%speedRight=motorSpeedPicker|%"
|
||||||
//% weight=96 blockGap=8
|
//% weight=96 blockGap=8
|
||||||
//% group="Move"
|
|
||||||
tank(speedLeft: number, speedRight: number) {
|
|
||||||
this.tankFor(speedLeft, speedRight, 0, MoveUnit.Degrees);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Move Tank block can make a robot drive forward, backward, turn, or stop.
|
|
||||||
* Use the Move Tank block for robot vehicles that have two Large Motors,
|
|
||||||
* with one motor driving the left side of the vehicle and the other the right side.
|
|
||||||
* You can make the two motors go at different speeds or in different directions
|
|
||||||
* to make your robot turn.
|
|
||||||
* @param speedLeft the speed on the left motor, eg: 50
|
|
||||||
* @param speedRight the speed on the right motor, eg: 50
|
|
||||||
* @param value the amount of movement, eg: 2
|
|
||||||
* @param unit the unit of the value
|
|
||||||
*/
|
|
||||||
//% blockId=motorPairTankFor block="tank %motors|%speedLeft=motorSpeedPicker|%|%speedRight=motorSpeedPicker|%|for %value|%unit"
|
|
||||||
//% weight=19 blockGap=8
|
|
||||||
//% inlineInputMode=inline
|
//% inlineInputMode=inline
|
||||||
//% group="Measured Move"
|
//% group="Move"
|
||||||
tankFor(speedLeft: number, speedRight: number, value: number, unit: MoveUnit) {
|
tank(speedLeft: number, speedRight: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
|
||||||
this.init();
|
this.init();
|
||||||
|
|
||||||
speedLeft = Math.clamp(-100, 100, speedLeft >> 0);
|
speedLeft = Math.clamp(-100, 100, speedLeft >> 0);
|
||||||
@ -498,39 +464,22 @@ namespace motors {
|
|||||||
? (100 - speedRight / speedLeft * 100)
|
? (100 - speedRight / speedLeft * 100)
|
||||||
: (speedLeft / speedRight * 100 - 100);
|
: (speedLeft / speedRight * 100 - 100);
|
||||||
|
|
||||||
this.steerFor(turnRatio, speed, value, unit);
|
this.steer(turnRatio, speed, value, unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns the motor and the follower motor by a number of rotations
|
* Turns the motor and the follower motor by a number of rotations
|
||||||
* @param turnRatio the ratio of power sent to the follower motor, from ``-200`` to ``200``, eg: 0
|
* @param turnRatio the ratio of power sent to the follower motor, from ``-200`` to ``200``, eg: 0
|
||||||
* @param speed the speed from ``100`` full forward to ``-100`` full backward, eg: 50
|
* @param speed the speed from ``100`` full forward to ``-100`` full backward, eg: 50
|
||||||
* @param value the move quantity, eg: 2
|
* @param value (optional) move duration or rotation
|
||||||
* @param unit the meaning of the value
|
* @param unit (optional) unit of the value
|
||||||
*/
|
*/
|
||||||
//% blockId=motorPairSteer block="steer %chassis|turn ratio %turnRatio|speed %speed=motorSpeedPicker|%"
|
//% blockId=motorPairSteer block="steer %chassis|turn ratio %turnRatio|speed %speed=motorSpeedPicker|%"
|
||||||
//% weight=95
|
//% weight=95
|
||||||
//% turnRatio.min=-200 turnRatio=200
|
//% turnRatio.min=-200 turnRatio=200
|
||||||
//% inlineInputMode=inline
|
//% inlineInputMode=inline
|
||||||
//% group="Move"
|
//% group="Move"
|
||||||
steer(turnRatio: number, speed: number) {
|
steer(turnRatio: number, speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
|
||||||
this.steerFor(turnRatio, speed, 0, MoveUnit.Rotations);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Turns the motor and the follower motor by a number of rotations
|
|
||||||
* @param turnRatio the ratio of power sent to the follower motor, from ``-200`` to ``200``, eg: 0
|
|
||||||
* @param speed the speed from ``100`` full forward to ``-100`` full backward, eg: 50
|
|
||||||
* @param value the move quantity, eg: 2
|
|
||||||
* @param unit the meaning of the value
|
|
||||||
*/
|
|
||||||
//% blockId=motorPairSteerFor block="steer %chassis|turn ratio %turnRatio|speed %speed=motorSpeedPicker|%|for %value|%unit"
|
|
||||||
//% weight=6
|
|
||||||
//% turnRatio.min=-200 turnRatio=200
|
|
||||||
//% inlineInputMode=inline
|
|
||||||
//% group="Measured Move"
|
|
||||||
steerFor(turnRatio: number, speed: number, value: number, unit: MoveUnit) {
|
|
||||||
this.init();
|
this.init();
|
||||||
speed = Math.clamp(-100, 100, speed >> 0);
|
speed = Math.clamp(-100, 100, speed >> 0);
|
||||||
if (!speed) {
|
if (!speed) {
|
||||||
|
@ -14,7 +14,7 @@ namespace sensors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//% color="#A5CA18" weight=90 icon="\uf10d"
|
//% color="#A5CA18" weight=90 icon="\uf10d"
|
||||||
//% groups='["Move", "Counters", "Measured Move"]'
|
//% groups='["Move", "Counters"]'
|
||||||
//% labelLineWidth=0
|
//% labelLineWidth=0
|
||||||
namespace motors {
|
namespace motors {
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user