Class: MSPhysics::Piston

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

Overview

Since:

  • 1.0.0

Constant Summary

DEFAULT_MIN =

Since:

  • 1.0.0

-10.0
DEFAULT_MAX =

Since:

  • 1.0.0

10.0
DEFAULT_LIMITS_ENABLED =

Since:

  • 1.0.0

false
DEFAULT_RATE =

Since:

  • 1.0.0

4.0
DEFAULT_POWER =

Since:

  • 1.0.0

0.0
DEFAULT_REDUCTION_RATIO =

Since:

  • 1.0.0

0.1
DEFAULT_CONTROLLER =

Since:

  • 1.0.0

nil
DEFAULT_CONTROLLER_MODE =

Since:

  • 1.0.0

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, #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) ⇒ Piston

Create a piston 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

Instance Method Details

#controllerNumeric?

Get piston controller.

Returns:

  • (Numeric, nil)

    Returns one of the following values:

    • Desired position in meters if the controller mode is 0.

    • Magnitude and direction of the linear rate if controller mode is 1.

    • nil if piston is turned off.

Since:

  • 1.0.0

#controller=(value) ⇒ Object

Set piston controller.

Parameters:

  • value (Numeric, nil)

    Accepts one of the following values:

    • Desired position in meters if the controller mode is 0.

    • Magnitude and direction of the linear rate if controller mode is 1.

    • nil to turn off the piston.

Since:

  • 1.0.0

#controller_modeFixnum

Get controller mode.

Returns:

  • (Fixnum)

    Returns one of the following values:

    • 0 to control piston by position.

    • 1 to control piston by speed.

Since:

  • 1.0.0

#controller_mode=(mode) ⇒ Object

Set controller mode.

Parameters:

  • mode (Fixnum)

    Pass one of the following values:

    • 0 to control piston by position.

    • 1 to control piston by speed.

Since:

  • 1.0.0

#cur_accelerationNumeric

Get current acceleration in meters per second per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#cur_positionNumeric

Get current position in meters.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#cur_velocityNumeric

Get current velocity in meters per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#limits_enabled=(state) ⇒ Object

Enable/disable min & max position limits.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0

#limits_enabled?Boolean

Determine whether min & max position limits are enabled.

Returns:

  • (Boolean)

Since:

  • 1.0.0

#maxNumeric

Get maximum position in meters.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#max=(value) ⇒ Object

Set maximum position in meters.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0

#minNumeric

Get minimum position in meters.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#min=(value) ⇒ Object

Set minimum position in meters.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0

#powerNumeric

Note:

A power value of zero represents maximum power.

Get movement power in Watts.

Returns:

  • (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0

#power=(value) ⇒ Object

Note:

A power value of zero represents maximum power.

Set movement power in Watts.

Parameters:

  • value (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0

#rateNumeric

Get maximum linear rate in meters per second.

Returns:

  • (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0

#rate=(value) ⇒ Object

Set maximum linear rate in meters per second.

Parameters:

  • value (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0

#reduction_ratioNumeric

Note:

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.

Note:

A reduction ratio of zero disables the reduction feature.

Note:

A typical reduction ratio value is 0.1.

Get linear reduction ratio.

Returns:

  • (Numeric)

    A value between 0.0 and 1.0.

Since:

  • 1.0.0

#reduction_ratio=(value) ⇒ Object

Note:

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.

Note:

A reduction ratio of zero disables the reduction feature.

Note:

A typical reduction ratio value is 0.1.

Get linear reduction ratio.

Parameters:

  • value (Numeric)

    A value between 0.0 and 1.0.

Since:

  • 1.0.0