yincheng.zhong
2025-11-23 212ccb49d3e7c7fa138c5f9d335d0b8c5a08d2a3
1
2
3
4
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
o
ÿ' i=ã@sZddlZddlmmZddlZddlZddlm Z   dd„Z
dd„Z dd„Z d   d
„Z dS) éN)ÚDifferentialDriveModelc
 
CsÞtƒ}| ¡|jdddd}|j}tj}d}d}|||d}||k}|svt d|fd||f¡dt  ¡vs:t 
|¡r?t  |¡ndt  |¡d t  ¡vsOt 
t¡rTt  t¡nd   t  |¡t  |¡t  |¡t  |¡d
œ}d d |i}   t t  | ¡ƒ‚d}}}}}}|j}tj}d}d}|||d }||k}|sét d|fd||f¡dt  ¡vs­t 
|¡r²t  |¡ndt  |¡d t  ¡vsÂt 
t¡rÇt  t¡nd   t  |¡t  |¡t  |¡t  |¡d
œ}d d |i}   t t  | ¡ƒ‚d}}}}}}|j}tj}d}d}|||d }||k}|sat d|fd||f¡dt    ¡vs#t 
|¡r(t  |¡ndt  |¡d   t  ¡vs:t 
t¡r?t  t¡nd t  |¡t  |¡t  |¡t  |¡d
œ}d d |i}   t t  | ¡ƒ‚d}}}}}}dS)Nçð?ç©Z target_linearZtarget_angularÚdt皙™™™™©?)Úrel©ú==)zv%(py2)s
{%(py2)s = %(py0)s.east
} == %(py12)s
{%(py12)s = %(py6)s
{%(py6)s = %(py4)s.approx
}(%(py8)s, rel=%(py10)s)
}ÚstateÚpytest)Úpy0Úpy2Úpy4Úpy6Úpy8Úpy10Zpy12zassert %(py14)sZpy14©Úabs)zw%(py2)s
{%(py2)s = %(py0)s.north
} == %(py12)s
{%(py12)s = %(py6)s
{%(py6)s = %(py4)s.approx
}(%(py8)s, abs=%(py10)s)
}gü©ñÒMbP?)zy%(py2)s
{%(py2)s = %(py0)s.heading
} == %(py12)s
{%(py12)s = %(py6)s
{%(py6)s = %(py4)s.approx
}(%(py8)s, abs=%(py10)s)
})rÚresetÚstepZeastr ÚapproxÚ
@pytest_arÚ_call_reprcompareÚ @py_builtinsÚlocalsÚ_should_repr_global_nameÚ  _safereprÚAssertionErrorÚ_format_explanationZnorthÚheading)
Úmodelr Ú @py_assert1Ú @py_assert5Ú @py_assert7Ú @py_assert9Z @py_assert11Ú @py_assert3Z @py_format13Z @py_format15©r'ú;E:\GIT\Lawnmower_STM32H7\python\tests_hitl\test_dynamics.pyÚ%test_straight_motion_updates_positions ææôr)c Cstƒ}| ¡|jdt d¡dd}tj}|j}||ƒ}tj}d}d}|||d}||k} |   s™t  
d| fd||f¡dt   ¡vsDt     t¡rIt    t¡ndt  |¡d t   ¡vsYt   |¡r^t    |¡nd   t    |¡t  |¡d
t   ¡vsrt   t¡rwt    t¡nd
t    |¡t  |¡t  |¡t  |¡d œ
}
d d |
i} tt    | ¡ƒ‚d}}}} }}}}|j} t| ƒ}d} || k}|st  
d|fd|| f¡dt   ¡vsÎt     t¡rÓt    t¡ndd t   ¡vsßt   |¡rät    |¡nd   t    | ¡t  |¡t  | ¡dœ}dd|i}tt    |¡ƒ‚d} }}} dS)Nrg€V@rrrr )z·%(py7)s
{%(py7)s = %(py2)s
{%(py2)s = %(py0)s.degrees
}(%(py5)s
{%(py5)s = %(py3)s.heading
})
} == %(py17)s
{%(py17)s = %(py11)s
{%(py11)s = %(py9)s.approx
}(%(py13)s, abs=%(py15)s)
}Úmathr r )
r rÚpy3Úpy5Úpy7Zpy9Úpy11Zpy13Zpy15Zpy17zassert %(py19)sZpy19çíµ ÷ư>©ú<)zT%(py5)s
{%(py5)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.linear_velocity
})
} < %(py8)sr)r Úpy1r+r,rúassert %(py10)sr)rrrr*ÚradiansÚdegreesr r rrrrrrrrrÚlinear_velocityr)r!r r"Ú @py_assert4Ú @py_assert6Z @py_assert10Z @py_assert12Z @py_assert14Z @py_assert16Ú @py_assert8Z @py_format18Z @py_format20Ú @py_assert2r$Ú @py_format9Ú @py_format11r'r'r(Ú&test_in_place_rotation_changes_headings þ0Ær=c   Csòtddd}| ¡|jdddd}|j}|j}d}||}||k}|smt d|fd ||f¡d
t ¡vs9t    |¡r>t 
|¡nd
t 
|¡d t ¡vsNt  |¡rSt 
|¡nd t 
|¡t 
|¡d œ}d d|i}t t  |¡ƒ‚d}}}}}dS)Ngà?)Úmax_linear_speedZmax_linear_accelg@rgš™™™™™É?rr/)ú<=)zi%(py2)s
{%(py2)s = %(py0)s.linear_velocity
} <= (%(py6)s
{%(py6)s = %(py4)s.max_linear_speed
} + %(py8)s)r r!)r rrrrzassert %(py11)sr.) rrrr6r>rrrrrrrr) r!r r"r#r$r%r&Z @py_format10Z @py_format12r'r'r(Útest_velocity_limits_respecteds Îr@cCs<tƒ}| ¡|jdddd}|j\}}}d}| }||k}d}| } || k}
|r+|
sat d||
fd|||   f¡t |¡dt ¡vsFt  |¡rKt |¡ndt |¡d œ} d
d | i} t
t  | ¡ƒ‚d}}}}
}}   t |ƒ}d } || k}
|
s¾t d |
fd|| f¡dt ¡vsŽt  t ¡r“t t ¡nddt ¡vsŸt    |¡r¤t |¡ndt |¡t | ¡dœ}dd|i} t
t  | ¡ƒ‚d}}
} t |ƒ}d } || k}
|
st d |
fd|| f¡dt ¡vsæt  t ¡rët t ¡nddt ¡vs÷t    |¡rüt |¡ndt |¡t | ¡dœ}dd|i} t
t  | ¡ƒ‚d}}
} dS)Nrgš™™™™™¹?rgÍÌÌÌÌÌð?gffffffî?)r1r1)z-%(py1)s < %(py5)sz%(py5)s < -%(py7)sÚaz)r2r,r-r3rrr0)z/%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} < %(py6)srÚax)r r2r+rzassert %(py8)srÚay) rrrZ body_accel_grrrrrrrrr)r!r rBrCrAZ @py_assert0r:r&r8r9r7r;r<r#Ú @py_format7r'r'r(Ú'test_body_acceleration_contains_gravity s °®´rE)ÚbuiltinsrÚ_pytest.assertion.rewriteÚ   assertionÚrewriterr*r Z hitl.dynamicsrr)r=r@rEr'r'r'r(Ú<module>s"