c4dynamics.sensors.radar.radar.scale_factor#
- property radar.scale_factor: float#
Gets and sets the object’s scale_factor.
The scale factor is a random variable generated once at the stage of constructing the instance by the errors model:
\[scalefactor = std \cdot randn\]Where scale_factor_std is a parameter with default value of 0.05 (5%) for
seeker
object, and 0.07 (7%) forradar
object.To get the scale factor generated by the errors model, or to override it, the user may call
scale_factor
to get or set the final scale factor error.- Parameters:
scale_factor (float) – Required scale factor, [dimensionless].
- Returns:
scale_factor (float) – Current scale factor, [dimensionless].
Example
The following example for a seeker object is directly applicable to a radar object too. Simply replace
c4d.sensors.seeker(...)
withc4d.sensors.radar(...)
.Required packages:
>>> import c4dynamics as c4d >>> from matplotlib import pyplot as plt >>> import numpy as np
Settings and initial conditions:
(see
seeker
orradar
examples for more details):Target:
>>> tgt = c4d.datapoint(x = 1000, y = 0, vx = -80 * c4d.kmh2ms, vy = 10 * c4d.kmh2ms) >>> for t in np.arange(0, 60, 0.01): ... tgt.inteqm(np.zeros(3), .01) ... tgt.store(t)
Origin:
>>> pedestal = c4d.rigidbody(z = 30, theta = -1 * c4d.d2r)
Ground truth reference:
>>> skr_ideal = c4d.sensors.seeker(origin = pedestal, isideal = True)
Tracking with scale factor
Define a seeker with a scale factor error only (mute the bias and the noise) and set it to 1.2 (= 20%) to track a constant velocity target:
>>> skr = c4d.sensors.seeker(origin = pedestal, bias_std = 0, noise_std = 0) >>> skr.scale_factor = 1.2 >>> for x in tgt.data(): ... skr_ideal.measure(c4d.create(x[1:]), t = x[0], store = True) ... skr.measure(c4d.create(x[1:]), t = x[0], store = True)
Compare with the true target angles (ideal seeker):
>>> ax = plt.subplot() >>> ax.plot(*skr_ideal.data('az', scale = c4d.r2d), label = 'target') >>> ax.plot(*skr.data('az', scale = c4d.r2d), label = 'seeker')