Class: MSPhysics::Servo

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

Overview

Since:

  • 1.0.0

Constant Summary

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_RATE =

Since:

  • 1.0.0

360.degrees
DEFAULT_POWER =

Since:

  • 1.0.0

0.0
DEFAULT_REDUCTION_RATIO =

Since:

  • 1.0.0

0.1
DEFAULT_CONTROLLER =

Since:

  • 1.0.0

nil

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

Create a servo 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 servo controller.

Returns:

  • (Numeric, nil)

    Desired angle in radians or nil if servo is turned off.

Since:

  • 1.0.0

#controller=(value) ⇒ Object

Set servo controller.

Parameters:

  • value (Numeric, nil)

    Desired angle in radians or nil to turn off the servo.

Since:

  • 1.0.0

#cur_alphaNumeric

Get current angular acceleration in radians per second per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#cur_angleNumeric

Get current angle in radians.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#cur_omegaNumeric

Get current angular velocity in radians per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#limits_enabled=(state) ⇒ Object

Note:

This option has no effect if SP mode is enabled.

Enable/disable min & max angle limits.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0

#limits_enabled?Boolean

Note:

This option has no effect if SP mode is enabled.

Determine whether min & max angle limits are enabled.

Returns:

  • (Boolean)

Since:

  • 1.0.0

#maxNumeric

Get maximum angle in radians.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#max=(value) ⇒ Object

Set maximum angle in radians.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0

#minNumeric

Get minimum angle in radians.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#min=(value) ⇒ Object

Set minimum angle in radians.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0

#powerNumeric

Note:

A power value of zero represents maximum power.

Get rotational power in Watts.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#power=(value) ⇒ Object

Note:

A power value of zero represents maximum power.

Set rotational power in Watts.

Parameters:

  • value (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0

#rateNumeric

Get maximum angular rate in radians per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#rate=(value) ⇒ Object

Set maximum angular rate in radians 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 angular rate of the joint when its current angle nears its desired angle. Angular reduction ratio starts acting upon the angular rate of the joint when the difference between the current angle and the desired angle of the joint is less than rate * reduction_ratio radians.

Note:

A reduction ratio of zero disables the reduction feature.

Note:

A typical reduction ratio value is 0.1.

Get angular 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 angular rate of the joint when its current angle nears its desired angle. Angular reduction ratio starts acting upon the angular rate of the joint when the difference between the current angle and the desired angle of the joint is less than rate * reduction_ratio radians.

Note:

A reduction ratio of zero disables the reduction feature.

Note:

A typical reduction ratio value is 0.1.

Set angular reduction ratio.

Parameters:

  • value (Numeric)

    A value between 0.0 and 1.0.

Since:

  • 1.0.0