Class: MSPhysics::Universal

Inherits:
Joint show all
Defined in:
RubyExtension/MSPhysics/joint_universal.rb

Overview

Since:

  • 1.0.0

Constant Summary collapse

DEFAULT_MIN =

Since:

  • 1.0.0

-180.0.degrees
DEFAULT_MAX =

Since:

  • 1.0.0

180.0.degrees
DEFAULT_LIMITS_ENABLED =

Since:

  • 1.0.0

false
DEFAULT_FRICTION =

Since:

  • 1.0.0

0.0
DEFAULT_CONTROLLER =

Since:

  • 1.0.0

1.0

Constants inherited from Joint

Joint::DEFAULT_BODIES_COLLIDABLE, Joint::DEFAULT_BREAKING_FORCE, Joint::DEFAULT_SOLVER_MODEL, Joint::DEFAULT_STIFFNESS

Instance Method Summary collapse

Methods inherited from Joint

#address, all_joints, #bodies_collidable=, #bodies_collidable?, #breaking_force, #breaking_force=, #child, #connect, #connected?, #destroy, #disconnect, #dof, #get_pin_matrix, #get_pin_matrix2, #get_tension1, #get_tension2, #group, joint_by_address, #name, #name=, #parent, #set_pin_matrix, #solver_model, #solver_model=, #stiffness, #stiffness=, #type, #valid?, validate, #world

Methods inherited from Entity

#inspect, #to_s

Constructor Details

#initialize(world, parent, pin_tra, group = nil) ⇒ Universal

Create a universal joint.

Parameters:

  • world (MSPhysics::World)
  • parent (MSPhysics::Body, nil)
  • pin_tra (Geom::Transformation, Array<Numeric>)

    Pin transformation in global space. Matrix origin is interpreted as the pin position. Matrix Z-axis is interpreted as the pin direction.

  • group (Sketchup::Group, Sketchup::ComponentInstance, nil) (defaults to: nil)

Since:

  • 1.0.0



19
20
21
22
23
24
25
26
27
28
29
30
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 19

def initialize(world, parent, pin_tra, group = nil)
  super(world, parent, pin_tra, group)
  MSPhysics::Newton::Universal.create(@address)
  MSPhysics::Newton::Universal.set_min1(@address, DEFAULT_MIN)
  MSPhysics::Newton::Universal.set_max1(@address, DEFAULT_MAX)
  MSPhysics::Newton::Universal.enable_limits1(@address, DEFAULT_LIMITS_ENABLED)
  MSPhysics::Newton::Universal.set_min2(@address, DEFAULT_MIN)
  MSPhysics::Newton::Universal.set_max2(@address, DEFAULT_MAX)
  MSPhysics::Newton::Universal.enable_limits2(@address, DEFAULT_LIMITS_ENABLED)
  MSPhysics::Newton::Universal.set_friction(@address, DEFAULT_FRICTION)
  MSPhysics::Newton::Universal.set_controller(@address, DEFAULT_CONTROLLER)
end

Instance Method Details

#controllerNumeric

Note:

Default controller value is 1.0.

Note:

The actual friction is friction * controller.

Get magnitude of the angular friction.

Returns:

  • (Numeric)

Since:

  • 1.0.0



160
161
162
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 160

def controller
  MSPhysics::Newton::Universal.get_controller(@address)
end

#controller=(value) ⇒ Object

Note:

Default controller value is 1.0.

Note:

The actual friction is friction * controller.

Set magnitude of the angular friction.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0



168
169
170
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 168

def controller=(value)
  MSPhysics::Newton::Universal.set_controller(@address, value)
end

#cur_alpha1Numeric

Get current angular acceleration in radians per second per second along joint Z-axis.

Returns:

  • (Numeric)

Since:

  • 1.0.0



47
48
49
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 47

def cur_alpha1
  MSPhysics::Newton::Universal.get_cur_alpha1(@address)
end

#cur_alpha2Numeric

Get current angular acceleration in radians per second per second along joint X-axis.

Returns:

  • (Numeric)

Since:

  • 1.0.0



102
103
104
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 102

def cur_alpha2
  MSPhysics::Newton::Universal.get_cur_alpha2(@address)
end

#cur_angle1Numeric

Get current angle in radians along joint Z-axis.

Returns:

  • (Numeric)

Since:

  • 1.0.0



34
35
36
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 34

def cur_angle1
  MSPhysics::Newton::Universal.get_cur_angle1(@address)
end

#cur_angle2Numeric

Get current angle in radians along joint X-axis.

Returns:

  • (Numeric)

Since:

  • 1.0.0



89
90
91
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 89

def cur_angle2
  MSPhysics::Newton::Universal.get_cur_angle2(@address)
end

#cur_omega1Numeric

Get current angular velocity in radians per second along joint Z-axis.

Returns:

  • (Numeric)

Since:

  • 1.0.0



40
41
42
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 40

def cur_omega1
  MSPhysics::Newton::Universal.get_cur_omega1(@address)
end

#cur_omega2Numeric

Get current angular velocity in radians per second along joint X-axis.

Returns:

  • (Numeric)

Since:

  • 1.0.0



95
96
97
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 95

def cur_omega2
  MSPhysics::Newton::Universal.get_cur_omega2(@address)
end

#frictionNumeric

Note:

The actual friction is friction * controller.

Get angular friction.

Returns:

  • (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0



145
146
147
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 145

def friction
  MSPhysics::Newton::Universal.get_friction(@address)
end

#friction=(value) ⇒ Object

Note:

The actual friction is friction * controller.

Set angular friction.

Parameters:

  • value (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0



152
153
154
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 152

def friction=(value)
  MSPhysics::Newton::Universal.set_friction(@address, value)
end

#limits1_enabled=(state) ⇒ Object

Enable/disable min & max angle limits along joint Z-axis.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0



83
84
85
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 83

def limits1_enabled=(state)
  MSPhysics::Newton::Universal.enable_limits1(@address, state)
end

#limits1_enabled?Boolean

Determine whether min & max angle limits along joint Z-axis are enabled.

Returns:

  • (Boolean)

Since:

  • 1.0.0



77
78
79
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 77

def limits1_enabled?
  MSPhysics::Newton::Universal.limits1_enabled?(@address)
end

#limits2_enabled=(state) ⇒ Object

Enable/disable min & max angle limits along joint X-axis.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0



138
139
140
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 138

def limits2_enabled=(state)
  MSPhysics::Newton::Universal.enable_limits2(@address, state)
end

#limits2_enabled?Boolean

Determine whether min & max angle limits along joint X-axis are enabled.

Returns:

  • (Boolean)

Since:

  • 1.0.0



132
133
134
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 132

def limits2_enabled?
  MSPhysics::Newton::Universal.limits2_enabled?(@address)
end

#max1Numeric

Get maximum angle in radians along joint Z-axis.

Returns:

  • (Numeric)

Since:

  • 1.0.0



65
66
67
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 65

def max1
  MSPhysics::Newton::Universal.get_max1(@address)
end

#max1=(value) ⇒ Object

Set maximum angle in radians along joint Z-axis.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0



71
72
73
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 71

def max1=(value)
  MSPhysics::Newton::Universal.set_max1(@address, value)
end

#max2Numeric

Get maximum angle in radians along joint X-axis.

Returns:

  • (Numeric)

Since:

  • 1.0.0



120
121
122
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 120

def max2
  MSPhysics::Newton::Universal.get_max2(@address)
end

#max2=(value) ⇒ Object

Set maximum angle in radians along joint X-axis.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0



126
127
128
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 126

def max2=(value)
  MSPhysics::Newton::Universal.set_max2(@address, value)
end

#min1Numeric

Get minimum angle in radians along joint Z-axis.

Returns:

  • (Numeric)

Since:

  • 1.0.0



53
54
55
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 53

def min1
  MSPhysics::Newton::Universal.get_min1(@address)
end

#min1=(value) ⇒ Object

Set minimum angle in radians along joint Z-axis.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0



59
60
61
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 59

def min1=(value)
  MSPhysics::Newton::Universal.set_min1(@address, value)
end

#min2Numeric

Get minimum angle in radians along joint X-axis.

Returns:

  • (Numeric)

Since:

  • 1.0.0



108
109
110
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 108

def min2
  MSPhysics::Newton::Universal.get_min2(@address)
end

#min2=(value) ⇒ Object

Set minimum angle in radians along joint X-axis.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0



114
115
116
# File 'RubyExtension/MSPhysics/joint_universal.rb', line 114

def min2=(value)
  MSPhysics::Newton::Universal.set_min2(@address, value)
end