Turn ratio field editor (#225)

* Turn ratio field editor (initial draft)

* Add field turn ratio editor

* Fix arrow rotation

* Fix left and right direction, remove unnecessary SVG circles.

* Update UI a little. add marker.

* updated math for turnratio angle

* slightly cuter

* cleanup

* consistent naming

* more cleanup

* fixing motor node issue

* updated package version
This commit is contained in:
Peli de Halleux
2018-01-09 22:05:26 -08:00
committed by GitHub
parent e51721303a
commit ce3383f1b7
7 changed files with 132 additions and 5 deletions

View File

@ -59,7 +59,7 @@
"motors.MotorBase.setReversed|block": "set %motor|reversed %reversed",
"motors.MotorBase.setSpeed|block": "set %motor|speed to %speed=motorSpeedPicker|%",
"motors.MotorBase.stop|block": "%motors|stop",
"motors.SynchedMotorPair.steer|block": "steer %chassis|turn ratio %turnRatio|speed %speed=motorSpeedPicker|%",
"motors.SynchedMotorPair.steer|block": "steer %chassis|turn ratio %turnRatio=motorTurnRatioPicker|speed %speed=motorSpeedPicker|%",
"motors.SynchedMotorPair.tank|block": "tank %motors|%speedLeft=motorSpeedPicker|%|%speedRight=motorSpeedPicker|%",
"motors.largeAB|block": "large A+B",
"motors.largeAD|block": "large A+D",

View File

@ -11,4 +11,15 @@ namespace motors {
export function __speedPicker(speed: number): number {
return speed;
}
/**
* A turn ratio picker
* @param turnratio the turn ratio, eg: 0
*/
//% blockId=motorTurnRatioPicker block="%turnratio" shim=TD_ID
//% turnratio.fieldEditor="turnratio" colorSecondary="#FFFFFF"
//% weight=0 blockHidden=1 turnRatio.fieldOptions.decompileLiterals=1
export function __turnRatioPicker(turnratio: number): number {
return turnratio;
}
}

View File

@ -476,7 +476,7 @@ namespace motors {
* @param value (optional) move duration or rotation
* @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=motorTurnRatioPicker|speed %speed=motorSpeedPicker|%"
//% weight=95
//% turnRatio.min=-200 turnRatio=200
//% inlineInputMode=inline