Skip to content

model

xvr.model

get_random_pose

get_random_pose(
    alphamin,
    alphamax,
    betamin,
    betamax,
    gammamin,
    gammamax,
    txmin,
    txmax,
    tymin,
    tymax,
    tzmin,
    tzmax,
    batch_size,
)

Generate a batch of random poses in SE(3) using specified ranges.

Source code in src/xvr/model/sampler.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def get_random_pose(
    alphamin,
    alphamax,
    betamin,
    betamax,
    gammamin,
    gammamax,
    txmin,
    txmax,
    tymin,
    tymax,
    tzmin,
    tzmax,
    batch_size,
):
    """Generate a batch of random poses in SE(3) using specified ranges."""
    alpha = uniform(alphamin, alphamax, batch_size, circle_shift=True)
    beta = uniform(betamin, betamax, batch_size, circle_shift=True)
    gamma = uniform(gammamin, gammamax, batch_size, circle_shift=True)
    tx = uniform(txmin, txmax, batch_size)
    ty = uniform(tymin, tymax, batch_size)
    tz = uniform(tzmin, tzmax, batch_size)
    rot = torch.concat([alpha, beta, gamma], dim=1)
    xyz = torch.concat([tx, ty, tz], dim=1)
    return convert(
        rot, xyz, parameterization="euler_angles", convention="ZXY", degrees=True
    )