models package

Subpackages

Submodules

models.Camera module

class models.Camera.Camera(filepath: Optional[str] = None, notch_filepath: Optional[str] = None, traj: Optional[VisualTraj] = None, max_vals: Optional[int] = None, scale: Optional[float] = None, with_notch: bool = False, start_at=None)

Bases: object

Class for the camera sensor which reads data from a text file.

Provides trajectory data (positions p and rotations R or q) as well as the derivatives of the above (velocities: v and om, accelerations: acc and alp).

Also provides the initial conditions.

property flag_interpolated
gen_rotated()
get_notch_vec_at(i: int) ndarray
interpolate(interframe_vals)
plot(config)
plot_notch(config)
update_sim_params(config)

Updates time-related info in the config, from camera data.

vec_at(i: int) List[ndarray]
class models.Camera.CameraInterpolated(traj: VisualTraj)

Bases: Camera

property interframe_vals
class models.Camera.CameraMeasurementArray(t: 'np.ndarray', p: 'np.ndarray', R: 'List[np.ndarray]', v: 'np.ndarray', om: 'np.ndarray', acc: 'np.ndarray', alp: 'np.ndarray', notch: 'np.ndarray', notch_d: 'np.ndarray', notch_dd: 'np.ndarray')

Bases: object

R: List[ndarray]
acc: ndarray
alp: ndarray
at_index(i: int) CameraMeasurementPoint
static from_camera(camera: Camera, old_t: float, new_t: float) CameraMeasurementArray

After old_t, up till new_t.

notch: ndarray
notch_d: ndarray
notch_dd: ndarray
om: ndarray
p: ndarray
t: ndarray
v: ndarray
models.Camera.create_camera(config: Config) Camera

Creates new camera object from the config object.

models.Imu module

class models.Imu.Imu(probe, cam, stdev_na=None, stdev_nom=None, gen_ref=False)

Bases: object

property acc
append_to_file(filepath)

Appends IMU trajectory to file.

clear()
static create(config, camera, probe, gen_ref=False) Imu

Creates synthetic IMU data from interpolated camera data.

eval_expr_single(t, q, qd, qdd, W_acc_C, R_WC, W_om_C, W_alp_C, append_array=False, filepath='', overwrite=False)

Evaluates the symbolic expression for ‘om’ and ‘acc’ using camera values and DOFs of the probe.

Args:

append_array : if True, appends the resulting data point (om, acc) to _om and _acc filepath : if given, appends the resulting data point to the file

Returns:

res_om : angular velocity in B coordinates res_acc : acceleration in B coordinates

eval_init(probe_joint_dofs: ndarray, notch_dofs: ndarray, overwrite: bool = False)

Evaluates initial IMU values using the probe’s and DOFs and the notch DOFS. :param probe_joint_dofs: initial degrees of freedom of the sensor setup model :param notch_dofs: initial degrees of freedom of the notch measurement :param overwrite: whether to overwrite current ‘om’ and ‘acc’ values :return:

property flag_interpolated
generate_traj(filepath, do_regenerate)
property num_imu_between_frames
property nvals
property om
reconstruct()
ref_vals(cam_meas_vec: List[np.ndarray], current_notch: np.ndarray)

For troubleshooting. Obtains the desired IMU position based on current camera values the relative kinematics relations C to B.

reset()
write_array_to_file(filepath)

Writes IMU trajectory, stored in the _om and _acc arrays, to a text file.

models.Probe module

class models.Probe.Probe(scope_length, theta_cam)

Bases: DHRobot

property R
property T
property acc
property alp
property fwkin
get_sym(q)
hessian_symbolic(J0)
property imu_dofs
property joint_dofs: list
property om
property p
plot(config, block=True, limits=None, movie=None, is_static=True, dt=0.05)

Modified to allow ‘hold’ of figure.

property q_cas
property qd_cas
property qd_s_arr
property qdd_cas
property v
class models.Probe.RigidSimpleProbe(scope_length, theta_cam)

Bases: SimpleProbe

Simple probe with non-rotating, non-translating parts. Uses the BC configuration.

ROT1 = 0.0
ROT2 = 0.0
ROT3 = 0.0
TRANS4 = 0.0
TRANS5 = 0.0
TRANS6 = 20
constraints = [0.0, 0.0, 0.0, 0.0, 0.0, 20, 0.0, 0.0]
class models.Probe.SimpleProbe(scope_length, theta_cam)

Bases: Probe

Simple probe with ROT9 as the only degree of freedom.

ROT1 = 0.0
ROT2 = 0.0
ROT3 = 0.0
TRANS4 = 0.0
TRANS5 = 0.0
TRANS6 = 20
constraints = [0.0, 0.0, 0.0, 0.0, 0.0, 20, None, 0.0]
class models.Probe.SymProbe(probe, const_dofs=False)

Bases: object

Container class for probe that only stores the symbolic forward kinematics relations.

get_est_fwkin(dofs_est, notchdofs)

Returns the estimated relative kinematics using the estimated dofs.

class models.Probe.TestProbe(scope_length, theta_cam, base=SE3(array([[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]])))

Bases: DHRobot

property T: SE3
property conf_q: list
plot(block=True, dt=0.05, camera_frames=None, imu_frames=None, animate: bool = False)

To implement.

Module contents