Skip to content

Commit a2e7123

Browse files
committed
Tune motor jitter
1.5% fixed error, 1% random error
1 parent 0263ca5 commit a2e7123

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

simulator/modules/sbot_interface/devices/motor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def set_power(self, value: int) -> None:
119119
else:
120120
# Apply a small amount of variation to the power setting to simulate
121121
# inaccuracies in the motor
122-
value = int(add_jitter(value, (MIN_POWER, MAX_POWER)))
122+
value = int(add_jitter(value, (MIN_POWER, MAX_POWER), std_dev_percent=1))
123123

124124
self._device.setVelocity(map_to_range(
125125
value,

simulator/protos/robot/MotorAssembly.proto

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ PROTO MotorAssembly [
5151
name IS name
5252
%<
5353
import * as wbrandom from 'wbrandom.js';
54-
const motorVariation = 0.01;
54+
const motorVariation = 0.015;
5555
// equivalent to Java's String.hashCode()
5656
// https://gist.github.com/hyamamoto/fd435505d29ebfa3d9716fd2be8d42f0
5757
function hashCode(s) {
@@ -65,7 +65,7 @@ PROTO MotorAssembly [
6565
let motorCoeff = 1 + wbrandom.real() * motorVariation;
6666
>%
6767
# seed the random number generator with the name of the motor
68-
# Add 1% variation between motors
68+
# Add 1.5% variation between motors
6969
maxVelocity %<= fields.maxVelocity.value * motorCoeff >%
7070
sound ""
7171
}

0 commit comments

Comments
 (0)