Class: MSPhysics::Piston
- Defined in:
- RubyExtension/MSPhysics/joint_piston.rb
Overview
Constant Summary collapse
- DEFAULT_MIN =
-10.0
- DEFAULT_MAX =
10.0
- DEFAULT_LIMITS_ENABLED =
false
- DEFAULT_RATE =
4.0
- DEFAULT_POWER =
0.0
- DEFAULT_REDUCTION_RATIO =
0.1
- DEFAULT_CONTROLLER =
nil
- DEFAULT_CONTROLLER_MODE =
0
Constants inherited from Joint
Joint::DEFAULT_BODIES_COLLIDABLE, Joint::DEFAULT_BREAKING_FORCE, Joint::DEFAULT_SOLVER_MODEL, Joint::DEFAULT_STIFFNESS
Instance Method Summary collapse
-
#controller ⇒ Numeric?
Get piston controller.
-
#controller=(value) ⇒ Object
Set piston controller.
-
#controller_mode ⇒ Integer
Get controller mode.
-
#controller_mode=(mode) ⇒ Object
Set controller mode.
-
#cur_acceleration ⇒ Numeric
Get current acceleration in meters per second per second.
-
#cur_position ⇒ Numeric
Get current position in meters.
-
#cur_velocity ⇒ Numeric
Get current velocity in meters per second.
-
#initialize(world, parent, pin_tra, group = nil) ⇒ Piston
constructor
Create a piston joint.
-
#limits_enabled=(state) ⇒ Object
Enable/disable min & max position limits.
-
#limits_enabled? ⇒ Boolean
Determine whether min & max position limits are enabled.
-
#max ⇒ Numeric
Get maximum position in meters.
-
#max=(value) ⇒ Object
Set maximum position in meters.
-
#min ⇒ Numeric
Get minimum position in meters.
-
#min=(value) ⇒ Object
Set minimum position in meters.
-
#power ⇒ Numeric
Get movement power in Watts.
-
#power=(value) ⇒ Object
Set movement power in Watts.
-
#rate ⇒ Numeric
Get maximum linear rate in meters per second.
-
#rate=(value) ⇒ Object
Set maximum linear rate in meters per second.
-
#reduction_ratio ⇒ Numeric
Get linear reduction ratio.
-
#reduction_ratio=(value) ⇒ Object
Get linear reduction ratio.
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
Constructor Details
#initialize(world, parent, pin_tra, group = nil) ⇒ Piston
Create a piston joint.
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 22 def initialize(world, parent, pin_tra, group = nil) super(world, parent, pin_tra, group) MSPhysics::Newton::Piston.create(@address) MSPhysics::Newton::Piston.set_min(@address, DEFAULT_MIN) MSPhysics::Newton::Piston.set_max(@address, DEFAULT_MAX) MSPhysics::Newton::Piston.enable_limits(@address, DEFAULT_LIMITS_ENABLED) MSPhysics::Newton::Piston.set_rate(@address, DEFAULT_RATE) MSPhysics::Newton::Piston.set_power(@address, DEFAULT_POWER) MSPhysics::Newton::Piston.set_reduction_ratio(@address, DEFAULT_REDUCTION_RATIO) MSPhysics::Newton::Piston.set_controller(@address, DEFAULT_CONTROLLER) MSPhysics::Newton::Piston.set_controller_mode(@address, DEFAULT_CONTROLLER_MODE) end |
Instance Method Details
#controller ⇒ Numeric?
Get piston controller.
146 147 148 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 146 def controller MSPhysics::Newton::Piston.get_controller(@address) end |
#controller=(value) ⇒ Object
Set piston controller.
155 156 157 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 155 def controller=(value) MSPhysics::Newton::Piston.set_controller(@address, value) end |
#controller_mode ⇒ Integer
Get controller mode.
163 164 165 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 163 def controller_mode MSPhysics::Newton::Piston.get_controller_mode(@address) end |
#controller_mode=(mode) ⇒ Object
Set controller mode.
171 172 173 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 171 def controller_mode=(mode) MSPhysics::Newton::Piston.set_controller_mode(@address, mode) end |
#cur_acceleration ⇒ Numeric
Get current acceleration in meters per second per second.
49 50 51 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 49 def cur_acceleration MSPhysics::Newton::Piston.get_cur_acceleration(@address) end |
#cur_position ⇒ Numeric
Get current position in meters.
37 38 39 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 37 def cur_position MSPhysics::Newton::Piston.get_cur_position(@address) end |
#cur_velocity ⇒ Numeric
Get current velocity in meters per second.
43 44 45 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 43 def cur_velocity MSPhysics::Newton::Piston.get_cur_velocity(@address) end |
#limits_enabled=(state) ⇒ Object
Enable/disable min & max position limits.
85 86 87 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 85 def limits_enabled=(state) MSPhysics::Newton::Piston.enable_limits(@address, state) end |
#limits_enabled? ⇒ Boolean
Determine whether min & max position limits are enabled.
79 80 81 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 79 def limits_enabled? MSPhysics::Newton::Piston.limits_enabled?(@address) end |
#max ⇒ Numeric
Get maximum position in meters.
67 68 69 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 67 def max MSPhysics::Newton::Piston.get_max(@address) end |
#max=(value) ⇒ Object
Set maximum position in meters.
73 74 75 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 73 def max=(value) MSPhysics::Newton::Piston.set_max(@address, value) end |
#min ⇒ Numeric
Get minimum position in meters.
55 56 57 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 55 def min MSPhysics::Newton::Piston.get_min(@address) end |
#min=(value) ⇒ Object
Set minimum position in meters.
61 62 63 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 61 def min=(value) MSPhysics::Newton::Piston.set_min(@address, value) end |
#power ⇒ Numeric
A power value of zero represents maximum power.
Get movement power in Watts.
104 105 106 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 104 def power MSPhysics::Newton::Piston.get_power(@address) end |
#power=(value) ⇒ Object
A power value of zero represents maximum power.
Set movement power in Watts.
111 112 113 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 111 def power=(value) MSPhysics::Newton::Piston.set_power(@address, value) end |
#rate ⇒ Numeric
Get maximum linear rate in meters per second.
91 92 93 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 91 def rate MSPhysics::Newton::Piston.get_rate(@address) end |
#rate=(value) ⇒ Object
Set maximum linear rate in meters per second.
97 98 99 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 97 def rate=(value) MSPhysics::Newton::Piston.set_rate(@address, value) end |
#reduction_ratio ⇒ Numeric
Reduction ratio is a feature that reduces linear rate of the joint when its current position nears its desired position. Linear reduction ratio starts acting upon the linear rate of the joint when the difference between the current position and the desired position of the joint is less than rate * reduction_ratio
meters.
A reduction ratio of zero disables the reduction feature.
A typical reduction ratio value is 0.1.
Get linear reduction ratio.
124 125 126 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 124 def reduction_ratio MSPhysics::Newton::Piston.get_reduction_ratio(@address) end |
#reduction_ratio=(value) ⇒ Object
Reduction ratio is a feature that reduces linear rate of the joint when its current position nears its desired position. Linear reduction ratio starts acting upon the linear rate of the joint when the difference between the current position and the desired position of the joint is less than rate * reduction_ratio
meters.
A reduction ratio of zero disables the reduction feature.
A typical reduction ratio value is 0.1.
Get linear reduction ratio.
137 138 139 |
# File 'RubyExtension/MSPhysics/joint_piston.rb', line 137 def reduction_ratio=(value) MSPhysics::Newton::Piston.set_reduction_ratio(@address, value) end |