• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Scala-Robotics-Simulator / PPS-22-srs / #716

20 Oct 2025 06:09PM UTC coverage: 78.302% (+0.4%) from 77.925%
#716

push

github

srs-mate
refactor: correct doc for DifferentialKinematics

1393 of 1779 relevant lines covered (78.3%)

8.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

57.96
/src/main/scala/io/github/srs/utils/SimulationDefaults.scala
1
package io.github.srs.utils
2

3
import java.awt.Color
4
import java.util.UUID
5

6
import scala.concurrent.duration.{ DurationInt, FiniteDuration }
7

8
import cats.effect.IO
9
import cats.effect.unsafe.implicits.global
10
import io.github.srs.model.entity.*
11
import io.github.srs.model.entity.dynamicentity.actuator.{ Actuator, Wheel as ActWheel }
12
import io.github.srs.model.entity.dynamicentity.agent.Agent
13
import io.github.srs.model.entity.dynamicentity.agent.reward.{ NoReward, RewardModel }
14
import io.github.srs.model.entity.dynamicentity.robot.Robot
15
import io.github.srs.model.entity.dynamicentity.robot.behavior.Policy
16
import io.github.srs.model.entity.dynamicentity.sensor.*
17
import io.github.srs.model.environment.Environment
18
import io.github.srs.model.illumination.LightMap
19
import io.github.srs.model.illumination.engine.SquidLibFovEngine
20
import io.github.srs.model.illumination.model.ScaleFactor
21

22
object SimulationDefaults:
23

×
24
  object Illumination:
25

3✔
26
    val GridThreshold = 10_000
27
    val LightThreshold = 2
8✔
28

5✔
29
    object Occlusion:
30
      val FullRotation: Double = 90.0
3✔
31
      val AlmostZero: Double = 1e-6
8✔
32

5✔
33
  object Behaviors:
34

×
35
    object Prioritized:
36
      val DangerDist: Double = 0.40
3✔
37
      val LightThreshold: Double = 0.05
8✔
38

5✔
39
    object Phototaxis:
40
      val Epsilon: Double = 1e-9
3✔
41
      val MinForwardBias: Double = 0.4
8✔
42
      val TurnGain: Double = 1.0
4✔
43

5✔
44
    object ObstacleAvoidance:
45
      val CruiseSpeed: Double = 0.35
3✔
46
      val WarnSpeed: Double = 0.15
8✔
47
      val WarnTurnSpeed: Double = 0.55
4✔
48
      val BackBoost: Double = 0.20
4✔
49
      val SafeDist: Double = 0.5
4✔
50
      val CriticalDist: Double = 0.35
4✔
51

5✔
52
    object RandomWalk:
53
      val MinForwardFactor: Double = 0.35
3✔
54
      val MaxForwardExtra: Double = 0.35
8✔
55
      val MinTurnOfBase: Double = 0.35
4✔
56
      val MaxTurnOfBase: Double = 1.15
4✔
57
      val TurnExponent: Double = 1.2
4✔
58
      val PivotBoostProb: Double = 0.20
4✔
59
      val PivotBoostAbs: Double = 0.15
4✔
60

5✔
61
  end Behaviors
62

63
  object UI:
64

×
65
    object SimulationViewConstants:
66
      val IdDisplayLength = 8
×
67
      val PositionDecimals = 2
×
68
      val OrientationDecimals = 1
×
69
      val DefaultRobotInfo = "Select a robot to view details"
×
70
      val StopConfirmMessage = "Are you sure you want to stop the simulation?\n\nClick Yes to stop, No to continue."
×
71
      val StopConfirmTitle = "Stop Simulation"
×
72

×
73
    object Colors:
74
      @inline private def rgb(r: Int, g: Int, b: Int) = new java.awt.Color(r, g, b)
×
75
      @inline private def rgba(r: Int, g: Int, b: Int, a: Int) = new java.awt.Color(r, g, b, a)
×
76
      def backgroundLight: Color = rgb(250, 250, 250)
×
77
      def backgroundMedium: Color = rgb(245, 245, 245)
×
78
      def border: Color = rgb(200, 200, 200)
×
79
      def text: Color = rgb(60, 60, 60)
×
80
      def obstacleGradientStart: Color = rgb(120, 120, 120)
×
81
      def obstacleGradientEnd: Color = rgb(80, 80, 80)
×
82
      def obstacleBorder: Color = rgb(60, 60, 60)
×
83
      def robotDefault: Color = rgb(100, 150, 255)
×
84
      def robotDefaultDark: Color = rgb(50, 100, 200)
×
85
      def robotDefaultBorder: Color = rgb(0, 50, 150)
×
86
      def robotSelected: Color = rgb(255, 100, 100)
×
87
      def robotSelectedDark: Color = rgb(200, 50, 50)
×
88
      def robotSelectedBorder: Color = rgb(150, 0, 0)
×
89
      def robotShadow: Color = rgba(0, 0, 0, 50)
×
90
      def lightCenter: Color = rgba(255, 255, 200, 200)
×
91
      def lightEdge: Color = rgba(255, 140, 0, 80)
×
92
      def buttonHover: Color = rgb(230, 230, 230)
×
93
      def buttonPressed: Color = rgb(220, 235, 250)
×
94
      def timeDisplay: Color = rgb(50, 50, 50)
×
95

×
96
    end Colors
97

98
    object Fonts:
99
      val FontSize = 12
×
100
      val TitleSize = 12
×
101

×
102
    object Spacing:
103
      val StandardPadding = 10
×
104
      val InnerPadding = 5
×
105
      val ComponentGap = 10
×
106

×
107
    object Dimensions:
108
      val ButtonWidth = 150
×
109
      val ButtonHeight = 30
×
110
      val RobotListWidth = 250
×
111
      val RobotListHeight = 300
×
112
      val InfoAreaRows = 6
×
113
      val InfoAreaColumns = 25
×
114

×
115
    object Strokes:
116
      val ObstacleStroke = 1.5f
×
117
      val RobotShadowStroke = 3f
×
118

×
119
    object Icons:
120
      val Play = "\u25B6"
×
121
      val Stop = "\u23F9"
×
122
      val Pause = "\u23F8"
×
123
  end UI
×
124

125
  val Duration: Option[Long] = None
126
  val Seed: Option[Long] = None
8✔
127
  val DebugMode = false
4✔
128
  val BinarySearchDurationThreshold: FiniteDuration = 1.microseconds
4✔
129

11✔
130
  /**
131
   * Alternative light map configurations for different use cases
132
   */
133
  object LightMapConfigs:
134

3✔
135
    /**
136
     * Default light map with caching enabled Uses scale factor 10 for a good balance of performance and precision
137
     */
138
    lazy val BaseLightMap: LightMap[IO] =
139
      LightMap
11✔
140
        .create[IO](ScaleFactor.default, SquidLibFovEngine)
27✔
141
        .unsafeRunSync()
7✔
142

25✔
143
    /**
144
     * High-precision light map for detailed rendering Uses scale factor 100 for maximum precision.
145
     *
146
     * @return
147
     *   A [[io.github.srs.model.illumination.LightMap]] configured for high precision, or the default light map if the
148
     *   scale factor is invalid.
149
     */
150
    def HPLightMap: LightMap[IO] =
151
      ScaleFactor
152
        .validate(80)
×
153
        .map { scale =>
×
154
          LightMap
×
155
            .create[IO](scale, SquidLibFovEngine)
156
            .unsafeRunSync()
157
        }
158
        .getOrElse(BaseLightMap)
159

×
160
    /**
161
     * Fast light map for real-time simulation Uses scale factor 5 for maximum performance.
162
     *
163
     * @return
164
     *   A [[io.github.srs.model.illumination.LightMap]] configured for fast computation, or the default light map if
165
     *   the scale factor is invalid.
166
     */
167
    def fastLightMap: LightMap[IO] =
168
      ScaleFactor
169
        .validate(10)
×
170
        .map { scale =>
×
171
          LightMap
×
172
            .create[IO](scale, SquidLibFovEngine)
173
            .unsafeRunSync()
174
        }
175
        .getOrElse(BaseLightMap)
176

×
177
    /**
178
     * Custom light map with specific scale factor Curried for better composition.
179
     *
180
     * @param scaleFactor
181
     *   The desired scale factor (cells per meter).
182
     * @return
183
     *   A [[io.github.srs.model.illumination.LightMap]] configured with the specified scale factor, or the default
184
     *   light map if the scale factor is invalid.
185
     */
186
    def withScale(scaleFactor: Int): LightMap[IO] =
187
      ScaleFactor
188
        .validate(scaleFactor)
×
189
        .map { scale =>
×
190
          LightMap
×
191
            .create[IO](scale, SquidLibFovEngine)
192
            .unsafeRunSync()
193
        }
194
        .getOrElse(BaseLightMap)
195

×
196
  end LightMapConfigs
197

198
  object SimulationConfig:
199
    val MaxCount = 10_000
×
200

×
201
  object Environment:
202
    val DefaultWidth: Int = 10
3✔
203
    val MinWidth: Int = 1
8✔
204
    val MaxWidth: Int = 500
4✔
205

4✔
206
    val DefaultHeight: Int = 10
207
    val MinHeight: Int = 1
4✔
208
    val MaxHeight: Int = 500
4✔
209

4✔
210
    val DefaultEntities: List[Entity] = List.empty
211
    val MaxEntities: Int = 50
6✔
212

5✔
213
  object StaticEntity:
214

×
215
    object Obstacle:
216
      val DefaultId: UUID = UUID.fromString("00000000-0000-0000-0000-000000000000")
3✔
217
      val DefaultPosition: Point2D = (0.0, 0.0)
9✔
218
      val DefaultOrientation: Orientation = Orientation(0.0)
8✔
219
      val DefaultWidth: Double = 1.0
6✔
220
      val DefaultHeight: Double = 1.0
4✔
221

5✔
222
    object Light:
223
      val DefaultId: UUID = UUID.fromString("00000000-0000-0000-0000-000000000001")
3✔
224
      val DefaultPosition: Point2D = (0.0, 0.0)
9✔
225
      val DefaultOrientation: Orientation = Orientation(0.0)
8✔
226
      val DefaultRadius: Double = 0.05
6✔
227
      val DefaultIlluminationRadius: Double = 1.0
4✔
228
      val DefaultIntensity: Double = 1.0
4✔
229
      val DefaultAttenuation: Double = 1.0
4✔
230

5✔
231
    object Boundary:
232
      val DefaultPosition: Point2D = (0.0, 0.0)
3✔
233
      val DefaultOrientation: Orientation = Orientation(0.0)
12✔
234
      val DefaultWidth: Double = 1.0
6✔
235
      val DefaultHeight: Double = 1.0
4✔
236

5✔
237
  end StaticEntity
238

239
  object DynamicEntity:
240
    val ZeroSpeed: Double = 0.0
3✔
241
    val MinSpeed: Double = -1.0
8✔
242
    val MaxSpeed: Double = 1.0
4✔
243
    val HalfSpeed: Double = 0.5
4✔
244

5✔
245
    object Actuator:
246

×
247
      object DifferentialWheelMotor:
248
        val DefaultWheel: ActWheel = ActWheel()
×
249

×
250
        object Wheel:
251
          val DefaultSpeed: Double = 1.0
3✔
252
          val DefaultShape: ShapeType.Circle = ShapeType.Circle(0.1)
8✔
253
          val MinSpeed: Double = -1.0
6✔
254
          val MaxSpeed: Double = 1.0
4✔
255

5✔
256
    object Sensor:
257

×
258
      object ProximitySensor:
259
        val DefaultOffset: Double = 0.0
3✔
260
        val DefaultRange: Double = 1.0
8✔
261

5✔
262
    object Agent:
263
      val DefaultId: UUID = UUID.fromString("00000000-0000-0000-0000-000000000003")
3✔
264
      val DefaultPosition: Point2D = (0.0, 0.0)
7✔
265
      val DefaultShape: ShapeType.Circle = ShapeType.Circle(0.25)
8✔
266
      val DefaultOrientation: Orientation = Orientation(0.0)
6✔
267
      val DefaultActuators: Seq[Actuator[Agent]] = Seq.empty
6✔
268
      val DefaultSensors: Vector[Sensor[Agent, Environment]] = Vector.empty
7✔
269
      val MinRadius: Double = 0.01
6✔
270
      val MaxRadius: Double = 0.5
4✔
271
      val DefaultReward: RewardModel[Agent] = NoReward()
4✔
272

5✔
273
      val StdProximitySensors: Vector[Sensor[Agent, Environment]] = Vector(
274
        ProximitySensor(Orientation(0.0)),
5✔
275
        ProximitySensor(Orientation(45.0)),
15✔
276
        ProximitySensor(Orientation(90.0)),
10✔
277
        ProximitySensor(Orientation(135.0)),
10✔
278
        ProximitySensor(Orientation(180.0)),
10✔
279
        ProximitySensor(Orientation(225.0)),
10✔
280
        ProximitySensor(Orientation(270.0)),
10✔
281
        ProximitySensor(Orientation(315.0)),
10✔
282
      )
11✔
283

284
      val StdLightSensors: Vector[Sensor[Agent, Environment]] = Vector(
285
        LightSensor(Orientation(0.0)),
6✔
286
        LightSensor(Orientation(45.0)),
13✔
287
        LightSensor(Orientation(90.0)),
8✔
288
        LightSensor(Orientation(135.0)),
8✔
289
        LightSensor(Orientation(180.0)),
8✔
290
        LightSensor(Orientation(225.0)),
8✔
291
        LightSensor(Orientation(270.0)),
8✔
292
        LightSensor(Orientation(315.0)),
8✔
293
      )
9✔
294

295
    end Agent
296

297
    object Robot:
298

3✔
299
      val DefaultMaxRetries = 10
300

8✔
301
      val DefaultId: UUID = UUID.fromString("00000000-0000-0000-0000-000000000002")
302
      val DefaultPosition: Point2D = (0.0, 0.0)
5✔
303
      val DefaultShape: ShapeType.Circle = ShapeType.Circle(0.25)
8✔
304
      val DefaultOrientation: Orientation = Orientation(0.0)
6✔
305
      val DefaultActuators: Seq[Actuator[Robot]] = Seq.empty
6✔
306
      val DefaultSensors: Vector[Sensor[Robot, Environment]] = Vector.empty
7✔
307
      val MinRadius: Double = 0.01
6✔
308
      val MaxRadius: Double = 0.5
4✔
309

4✔
310
      val SelectionStroke: Float = 3f
311
      val NormalStroke: Float = 1f
2✔
312
      val ArrowLengthFactor: Double = 0.6
2✔
313
      val ArrowWidthFactor: Double = 0.3
2✔
314
      val MinArrowWidth: Float = 2f
2✔
315

2✔
316
      val StdProximitySensors: Vector[Sensor[Robot, Environment]] = Vector(
317
        ProximitySensor(Orientation(0.0)),
5✔
318
        ProximitySensor(Orientation(45.0)),
15✔
319
        ProximitySensor(Orientation(90.0)),
10✔
320
        ProximitySensor(Orientation(135.0)),
10✔
321
        ProximitySensor(Orientation(180.0)),
10✔
322
        ProximitySensor(Orientation(225.0)),
10✔
323
        ProximitySensor(Orientation(270.0)),
10✔
324
        ProximitySensor(Orientation(315.0)),
10✔
325
      )
11✔
326

327
      val StdLightSensors: Vector[Sensor[Robot, Environment]] = Vector(
328
        LightSensor(Orientation(0.0)),
5✔
329
        LightSensor(Orientation(45.0)),
13✔
330
        LightSensor(Orientation(90.0)),
8✔
331
        LightSensor(Orientation(135.0)),
8✔
332
        LightSensor(Orientation(180.0)),
8✔
333
        LightSensor(Orientation(225.0)),
8✔
334
        LightSensor(Orientation(270.0)),
8✔
335
        LightSensor(Orientation(315.0)),
8✔
336
      )
9✔
337
      val DefaultPolicy: Policy = Policy.AlwaysForward
338
    end Robot
5✔
339
  end DynamicEntity
340

341
  object GridDSL:
342
    val ObstacleSize: Double = 0.999999
3✔
343
    val IncrementToCenterPos: Point2D = Point2D(0.5, 0.5)
8✔
344

8✔
345
  object Fields:
346

×
347
    object Simulation:
348
      val Self: String = "simulation"
3✔
349
      val Duration: String = "duration"
8✔
350
      val Seed: String = "seed"
4✔
351

5✔
352
    object Environment:
353
      val Self: String = "environment"
3✔
354
      val Width: String = "width"
8✔
355
      val Height: String = "height"
4✔
356
      val Entities: String = "entities"
4✔
357

5✔
358
    object Entity:
359
      val Id: String = "id"
3✔
360
      val Position: String = "position"
8✔
361
      val X: String = "x"
4✔
362
      val Y: String = "y"
2✔
363
      val Orientation: String = "orientation"
2✔
364

5✔
365
      object StaticEntity:
366

×
367
        object Obstacle:
368
          val Self: String = "obstacle"
3✔
369
          val Width: String = "width"
8✔
370
          val Height: String = "height"
4✔
371

5✔
372
        object Light:
373
          val Self: String = "light"
3✔
374
          val Radius: String = "radius"
8✔
375
          val IlluminationRadius: String = "illuminationRadius"
4✔
376
          val Intensity: String = "intensity"
4✔
377
          val Attenuation: String = "attenuation"
4✔
378

5✔
379
      object DynamicEntity:
380

×
381
        object Robot:
382
          val Self: String = "robot"
3✔
383
          val Radius: String = "radius"
8✔
384
          val Speed: String = "speed"
4✔
385
          val WithProximitySensors: String = "withProximitySensors"
4✔
386
          val WithLightSensors: String = "withLightSensors"
4✔
387
          val Behavior: String = "behavior"
4✔
388

5✔
389
        object Agent:
390
          val Self: String = "agent"
3✔
391
          val Radius: String = "radius"
8✔
392
          val Speed: String = "speed"
2✔
393
          val WithProximitySensors: String = "withProximitySensors"
2✔
394
          val WithLightSensors: String = "withLightSensors"
2✔
395
          val RewardModel: String = "rewardModel"
2✔
396

3✔
397
    end Entity
398
  end Fields
399

400
  object Layout:
401
    val SplitPaneWeight: Double = 0.8
×
402
    val SplitPaneLocation: Double = 0.8
×
403

×
404
  object Frame:
405
    val MinWidth = 800
×
406
    val MinHeight = 600
×
407
    val PrefWidth = 1200
×
408
    val PrefHeight = 720
×
409
    val SplitWeight = 0.8
×
410
    val CanvasBorder: Int = 2
×
411

×
412
  object Canvas:
413
    val BorderSize = 2
×
414
    val MinZoom = 0.2
×
415
    val MaxZoom = 5.0
×
416
    val ZoomInFactor = 1.2
×
417
    val ZoomOutFactor = 0.8
×
418
    val DesiredLabelPixels = 40.0
×
419
    val GridStrokeWidth = 1f
×
420
    val LabelDesiredPx: Double = 40.0
×
421
    val MinLightSize: Int = 12
×
422
    val LightStroke: Float = 2f
×
423
    val LabelBottomOffset: Int = 4
×
424
    val LabelYOffset: Int = 12
×
425
    val LabelXOffset: Int = 2
×
426

×
427
    val LabelStepSequence: List[Int] = List(1, 2, 5)
428
    val LabelScaleBase: Int = 10
×
429
    val DiameterFactor: Double = 2.0
×
430

×
431
    object Sensors:
432
      val LineStrokeWidth: Float = 1.0f
×
433
      val DotSize: Int = 3
×
434

×
435
    object LightFX:
436

×
437
      val GradientFraction0: Float = 0f
438
      val GradientFraction1: Float = 0.55f
×
439
      val GradientFraction2: Float = 0.9f
×
440
      val GradientFraction3: Float = 1f
×
441

×
442
      val CoreFractionStart: Float = 0f
443
      val CoreFractionEnd: Float = 1f
×
444

×
445
      val GradientRadiusDivisor: Float = 2f
446
      val MinLightPixels: Int = 1
×
447
      val PostGlowAlpha: Float = 0.015f
×
448

×
449
      val RingStrokeWidth: Float = 0.8f
450
      val RingStrokeMiterLimit: Float = 10f
×
451
      val RingStrokeDash1: Float = 4f
×
452
      val RingStrokeDash2: Float = 6f
×
453
      val RingStrokeDashPhase: Float = 0f
×
454

×
455
      val GradientColor: Array[Color] = Array(
456
        new Color(255, 200, 0, 28),
×
457
        new Color(255, 180, 0, 16),
×
458
        new Color(255, 160, 0, 6),
×
459
        new Color(255, 140, 0, 0),
×
460
      )
×
461

462
    end LightFX
463

464
    object Arrow:
465
      val TriangleVertices: Int = 3
×
466

×
467
    object RobotBody:
468
      val GradientFractionStart: Float = 0f
×
469
      val GradientFractionEnd: Float = 1f
×
470

×
471
  end Canvas
472

473
  object ControlsPanel:
474
    val StartStopButtonText: String = "Start/Stop"
×
475

×
476
end SimulationDefaults
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc