Class: MSPhysics::CurvyPiston

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

Overview

Since:

  • 1.0.0

Constant Summary

DEFAULT_ANGULAR_FRICTION =

Since:

  • 1.0.0

0.0
DEFAULT_RATE =

Since:

  • 1.0.0

4.0
DEFAULT_POWER =

Since:

  • 1.0.0

0.0
DEFAULT_ALIGNMENT_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
DEFAULT_LOOP_ENABLED =

Since:

  • 1.0.0

false
DEFAULT_ALIGNMENT_ENABLED =

Since:

  • 1.0.0

true
DEFAULT_ROTATION_ENABLED =

Since:

  • 1.0.0

true

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) ⇒ CurvyPiston

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

#add_point(position) ⇒ Fixnum

Append point to the curve.

Parameters:

  • position (Geom::Point3d)

Returns:

  • (Fixnum)

    point index.

Since:

  • 1.0.0

#alignment_enabled=(state) ⇒ Object

Enable/disable alignment to curve.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0

#alignment_enabled?Boolean

Determine whether the connected body is supposed to align with the direction of curve.

Returns:

  • (Boolean)

Since:

  • 1.0.0

#alignment_powerNumeric

Note:

Has an effect only if alignment is enabled.

Get alignment power.

Returns:

  • (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0

#alignment_power=(value) ⇒ Object

Note:

Has an effect only if alignment is enabled.

Set alignment power.

Parameters:

  • value (Numeric)

    A value greater than or equal to zero. Pass zero to use maximum power.

Since:

  • 1.0.0

#angular_frictionNumeric

Get rotational friction.

Returns:

  • (Numeric)

    A numeric value greater than or equal to zero.

Since:

  • 1.0.0

#angular_friction=(value) ⇒ Object

Set rotational friction.

Parameters:

  • value (Numeric)

    A numeric value greater than or equal to zero.

Since:

  • 1.0.0

#clearFixnum

Remove all points that make up the curve.

Returns:

  • (Fixnum)

    The number of points removed.

Since:

  • 1.0.0

#controllerNumeric?

Get curvy 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 curvy 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 curvy piston by position.

    • 1 to control curvy piston by speed - strict.

    • 2 to control curvy piston by speed - adaptive.

Since:

  • 1.0.0

#controller_mode=(mode) ⇒ Object

Set controller mode.

Parameters:

  • mode (Fixnum)

    Pass one of the following values:

    • 0 to control curvy piston by position.

    • 1 to control curvy piston by speed - strict.

    • 2 to control curvy piston by speed - adaptive.

Since:

  • 1.0.0

#cur_accelerationNumeric

Get current acceleration along the curve in meters per second per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#cur_normal_matrixGeom::Transformation?

Get current normal matrix on the curve.

Returns:

  • (Geom::Transformation, nil)

    A transformation in global space or nil if curve is empty or joint is disconnected.

Since:

  • 1.0.0

#cur_pointGeom::Point3d?

Get current point on the curve.

Returns:

  • (Geom::Point3d, nil)

    A point in global space or nil if curve is empty or joint is disconnected.

Since:

  • 1.0.0

#cur_positionNumeric

Get current position along the curve in meters.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#cur_vectorGeom::Vector3d?

Get current vector on the curve.

Returns:

  • (Geom::Vector3d, nil)

    A vector in global space or nil if curve is empty or joint is disconnected.

Since:

  • 1.0.0

#cur_velocityNumeric

Get current velocity along the curve in meters per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#get_point_position(index) ⇒ Geom::Point3d?

Get point position by index.

Parameters:

  • index (Fixnum)

Returns:

  • (Geom::Point3d, nil)

    Point position in global space if the index references an existing point; nil otherwise.

Since:

  • 1.0.0

#lengthNumeric

Get curve length in meters.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#loop_enabled=(state) ⇒ Object

Enable/disable curve looping.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0

#loop_enabled?Boolean

Determine whether curve looping is enabled.

Returns:

  • (Boolean)

Since:

  • 1.0.0

#normal_matricesArray<Geom::Transformation>

Get all normal matrices of the curve.

Returns:

  • (Array<Geom::Transformation>)

    An array of the normal matrices.

Since:

  • 1.0.0

#normal_matrix_at_point(point) ⇒ Array<(Geom::Transformation, Numeric)>?

Get normal matrix corresponding to a particular point on or beside the curve.

Parameters:

  • point (Geom::Point3d)

    A point in global space.

Returns:

  • (Array<(Geom::Transformation, Numeric)>, nil)

    A transformation in global space along with overpass value or nil if curve is empty or joint is disconnected.

Since:

  • 1.0.0

#normal_matrix_at_position(distance) ⇒ Geom::Transformation?

Get normal matrix corresponding to a particular distance on the curve.

Parameters:

  • distance (Numeric)

    Linear position on curve in meters.

Returns:

  • (Geom::Transformation, nil)

    A transformation in global space or nil if curve is empty or joint is disconnected.

Since:

  • 1.0.0

#pointsArray<Geom::Point3d>

Get all points the curve is associated of.

Returns:

  • (Array<Geom::Point3d>)

Since:

  • 1.0.0

#points_sizeFixnum

Get the number of points that make up the curve.

Returns:

  • (Fixnum)

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

#remove_point(index) ⇒ Boolean

Remove point from curve at index.

Parameters:

  • index (Fixnum)

Returns:

  • (Boolean)

    success

Since:

  • 1.0.0

#rotation_enabled=(state) ⇒ Object

Enable/disable rotation along the current point on curve.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0

#rotation_enabled?Boolean

Determine whether the rotation along the current point on curve is enabled.

Returns:

  • (Boolean)

Since:

  • 1.0.0

#set_point_position(index, position) ⇒ Boolean

Set point position by index.

Parameters:

  • index (Fixnum)
  • position (Geom::Point3d)

    Point position in global space.

Returns:

  • (Boolean)

    success

Since:

  • 1.0.0