@@ -75,6 +75,53 @@ Torque acting between two frames, defined by 3 input signals and resolved in fra
75
75
extend (ODESystem (eqs, t, name = name, systems = [torque, basicTorque]), ptf)
76
76
end
77
77
78
+ @component function BasicWorldTorque (; name, resolve_frame = :world )
79
+ @named torque = Blocks. RealInput (; nin = 3 )
80
+ @named frame_b = Frame ()
81
+ eqs = if resolve_frame == :world
82
+ collect (frame_b. tau) .~ - resolve2 (ori (frame_b), collect (torque. u))
83
+ elseif resolve_frame == :frame_b
84
+ collect (frame_b. tau) .~ - torque. u
85
+ else
86
+ collect (frame_b. tau) .~ zeros (3 )
87
+ end |> collect
88
+ append! (eqs, collect (frame_b. f) .~ zeros (3 ))
89
+ ODESystem (eqs, t; name, systems = [torque, frame_b])
90
+ end
91
+
92
+ """
93
+ WorldTorque(; name, resolve_frame = :world)
94
+
95
+ External torque acting at `frame_b`, defined by 3 input signals and resolved in frame `:world` or `:frame_b`.
96
+
97
+ # Connectors:
98
+ - `frame_b`: Frame at which the torque is acting
99
+ - `torque`: Of type `Blocks.RealInput(3)`. x-, y-, z-coordinates of torque resolved in frame defined by `resolve_frame`.
100
+
101
+ # Rendering options
102
+ - `scale = 0.1`: scaling factor for the force [m/N]
103
+ - `color = [0,1,0,0.5]`: color of the force arrow in rendering
104
+ - `radius = 0.05`: radius of the force arrow in rendering
105
+ """
106
+ @component function WorldTorque (; name, resolve_frame = :world , scale = 0.1 , color = [0 , 1 , 0 , 0.5 ], radius = 0.05 )
107
+ @named begin
108
+ torque = Blocks. RealInput (; nin = 3 )
109
+ frame_b = Frame ()
110
+ basicWorldTorque = BasicWorldTorque (; resolve_frame)
111
+ end
112
+ pars = @parameters begin
113
+ scale = scale, [description = " scaling factor for the force [m/N]" ]
114
+ color[1 : 4 ] = color, [description = " color of the force arrow in rendering" ]
115
+ radius = radius, [description = " radius of the force arrow in rendering" ]
116
+ end
117
+ eqs = [
118
+ connect (basicWorldTorque. frame_b, frame_b)
119
+ connect (basicWorldTorque. torque, torque)
120
+ ]
121
+ ODESystem (eqs, t, [], pars; name, systems = [torque, basicWorldTorque, frame_b])
122
+ end
123
+
124
+
78
125
@component function BasicForce (; name, resolve_frame = :frame_b )
79
126
@named ptf = PartialTwoFrames ()
80
127
@named force = Blocks. RealInput (; nin = 3 )
0 commit comments