@@ -52,7 +52,7 @@ this frame.
5252# Connector frames
5353- `frame_a`: Frame for the wheel joint
5454"""
55- @component function RollingWheelJoint(; name, radius, angles = zeros( 3 ) , der_angles= zeros( 3 ) , x0= 0 , y0 = radius , z0= 0 , sequence = [2 , 3 , 1 ], iscut= false , surface = nothing , color = [1 , 0 , 0 , 1 ], state_priority = 15 )
55+ @component function RollingWheelJoint(; name, radius, angles = nothing , der_angles= nothing , x0= nothing , y0 = nothing , z0= nothing , sequence = [2 , 3 , 1 ], iscut= false , surface = nothing , color = [1 , 0 , 0 , 1 ], state_priority = 15 )
5656 pars = @parameters begin
5757 radius = radius, [description = " Radius of the wheel" ]
5858 color[1 : 4 ] = color, [description = " Color of the wheel in animations" ]
@@ -64,52 +64,52 @@ this frame.
6464 (angles(t)[1 : 3 ] = angles),
6565 [state_priority = state_priority, description = " Angles to rotate world-frame into frame_a around z-, y-, x-axis" ]
6666 (der_angles(t)[1 : 3 ] = der_angles), [state_priority = 5 , description = " Derivatives of angles" ]
67- (r_road_0(t)[1 : 3 ] = zeros( 3 ) ),
67+ (r_road_0(t)[1 : 3 ]),
6868 [
6969 description = " Position vector from world frame to contact point on road, resolved in world frame" ,
7070 ]
71- (f_wheel_0(t)[1 : 3 ] = zeros( 3 ) ),
71+ (f_wheel_0(t)[1 : 3 ]),
7272 [description = " Force vector on wheel, resolved in world frame" ]
73- (f_n(t) = 0 ), [description = " Contact force acting on wheel in normal direction" ]
74- (f_lat(t) = 0 ), [
73+ (f_n(t)), [description = " Contact force acting on wheel in normal direction" ]
74+ (f_lat(t)), [
7575 description = " Contact force acting on wheel in lateral direction" ,
7676 ]
77- (f_long(t) = 0 ),
77+ (f_long(t)),
7878 [description = " Contact force acting on wheel in longitudinal direction" ]
79- # (err(t) = 0 ),
79+ # (err(t)),
8080 # [
8181 # description = "|r_road_0 - frame_a.r_0| - radius (must be zero; used for checking)",
8282 # ]
83- (e_axis_0(t)[1 : 3 ] = zeros( 3 ) ),
83+ (e_axis_0(t)[1 : 3 ]),
8484 [description = " Unit vector along wheel axis, resolved in world frame" ]
85- (delta_0(t)[1 : 3 ] = [0 ,- radius, 0 ]),
86- [description = " Distance vector from wheel center to contact point" ]
87- (e_n_0(t)[1 : 3 ] = zeros( 3 ) ),
85+ (delta_0(t)[1 : 3 ]), # = [0,-radius, 0]),
86+ [description = " Distance vector from wheel center to contact point" , guess = [ 0 , - radius, 0 ] ]
87+ (e_n_0(t)[1 : 3 ]),
8888 [
8989 description = " Unit vector in normal direction of road at contact point, resolved in world frame" ,
9090 ]
91- (e_lat_0(t)[1 : 3 ] = zeros( 3 ) ),
91+ (e_lat_0(t)[1 : 3 ]),
9292 [
9393 description = " Unit vector in lateral direction of road at contact point, resolved in world frame" ,
9494 ]
95- (e_long_0(t)[1 : 3 ] = zeros( 3 ) ),
95+ (e_long_0(t)[1 : 3 ]),
9696 [
9797 description = " Unit vector in longitudinal direction of road at contact point, resolved in world frame" ,
9898 ]
9999
100- (s(t) = 0 ), [description = " Road surface parameter 1" ]
101- (w(t) = 0 ), [description = " Road surface parameter 2" ]
102- (e_s_0(t)[1 : 3 ] = zeros( 3 ) ),
100+ (s(t)), [description = " Road surface parameter 1" ]
101+ (w(t)), [description = " Road surface parameter 2" ]
102+ (e_s_0(t)[1 : 3 ]),
103103 [description = " Road heading at (s,w), resolved in world frame (unit vector)" ]
104104
105- (v_0(t)[1 : 3 ] = zeros( 3 ) ),
105+ (v_0(t)[1 : 3 ]),
106106 [description = " Velocity of wheel center, resolved in world frame" ]
107- (w_0(t)[1 : 3 ] = zeros( 3 ) ),
107+ (w_0(t)[1 : 3 ]),
108108 [description = " Angular velocity of wheel, resolved in world frame" ]
109- (vContact_0(t)[1 : 3 ] = zeros( 3 ) ),
109+ (vContact_0(t)[1 : 3 ]),
110110 [description = " Velocity of contact point, resolved in world frame" ]
111111
112- (aux(t)[1 : 3 ] = zeros( 3 )) , [description = " Auxiliary variable" ]
112+ (aux(t)[1 : 3 ]) , [description = " Auxiliary variable" , guess = [ 1 , 0 , 0 ] ]
113113 end
114114
115115
@@ -227,7 +227,7 @@ with the wheel itself. A [`Revolute`](@ref) joint rotationg around `n = [0, 1, 0
227227@component function RollingWheel(; name, radius, m, I_axis, I_long, width = 0.035 , x0= 0 , z0= 0 ,
228228 angles = zeros(3 ), der_angles = zeros(3 ), kwargs... )
229229
230- @named wheeljoint = RollingWheelJoint(; radius, angles, x0, z0, der_angles, kwargs... )
230+ @named wheeljoint = RollingWheelJoint(; radius, angles= nothing , x0= nothing , z0= nothing , der_angles= nothing , kwargs... )
231231 @named begin
232232 frame_a = Frame()
233233 body = Body(r_cm = [0 , 0 , 0 ],
@@ -260,8 +260,8 @@ with the wheel itself. A [`Revolute`](@ref) joint rotationg around `n = [0, 1, 0
260260
261261 equations = Equation[wheeljoint. x ~ x
262262 wheeljoint. z ~ z
263- collect (wheeljoint. angles) .~ collect (angles)
264- collect (wheeljoint. der_angles) .~ collect (der_angles)
263+ (wheeljoint. angles) ~ (angles)
264+ (wheeljoint. der_angles) ~ (der_angles)
265265 connect(body. frame_a, frame_a)
266266 connect(wheeljoint. frame_a, frame_a)]
267267 compose(System(equations, t; name), frame_a, wheeljoint, body)
0 commit comments