Class: Phidgets::RCServo

Inherits:
Common
  • Object
show all
Defined in:
lib/phidgets/rc_servo.rb,
ext/phidgets/phidgets_rc_servo.c

Instance Method Summary collapse

Methods inherited from Common

#close, #getAttached, #getChannel, #getChannelClass, #getChannelClassName, #getChannelName, #getChannelSubclass, #getDeviceChannelCount, #getDeviceClass, #getDeviceClassName, #getDeviceID, #getDeviceLabel, #getDeviceName, #getDeviceSKU, #getDeviceSerialNumber, #getDeviceVersion, #getHubPort, #getHubPortCount, #getIsChannel, #getIsHubPortDevice, #getIsLocal, #getIsRemote, #getServerHostname, #getServerName, #getServerPeerName, #getServerUniqueName, #open, #openWaitForAttachment, #setChannel, #setDeviceLabel, #setDeviceSerialNumber, #setHubPort, #setIsHubPortDevice, #setIsLocal, #setIsRemote, #setOnAttachHandler, #setOnDetachHandler, #setOnErrorHandler, #setOnPropertyChangeHandler, #setServerName, #writeDeviceLabel

Constructor Details

#newObject

Creates a Phidget RCServo object.



11
12
13
14
15
# File 'ext/phidgets/phidgets_rc_servo.c', line 11

VALUE ph_rc_servo_init(VALUE self) {
  ph_data_t *ph = get_ph_data(self);
  ph_raise(PhidgetRCServo_create((PhidgetRCServoHandle *)(&(ph->handle))));
  return self;
}

Instance Method Details

#getAccelerationObject Also known as: acceleration

When changing velocity, the RC servo motor will accelerate/decelerate at this rate. The acceleration is bounded by MaxAcceleration and MinAcceleration. SpeedRampingState controls whether or not the acceleration value is actually applied when trying to reach a target position. There is a practical limit on how fast your RC servo motor can accelerate. This is based on the load and physical design of the motor. The units for Position,Velocity, and Acceleration are configured by scaling the internal timing (set with MinPulseWidth and MaxPulseWidth) to a user specified range with MinPosition and MaxPosition.



17
18
19
# File 'ext/phidgets/phidgets_rc_servo.c', line 17

VALUE ph_rc_servo_get_acceleration(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getAcceleration);
}

#getDataIntervalObject Also known as: data_interval

The DataInterval is the time that must elapse before the controller will fire another PositionChange event. The data interval is bounded by MinDataInterval and MaxDataInterval.



34
35
36
# File 'ext/phidgets/phidgets_rc_servo.c', line 34

VALUE ph_rc_servo_get_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetRCServo_getDataInterval);
}

#getEngagedBoolean Also known as: engaged?

When engaged, a RC servo motor has the ability to be positioned. When disengaged, no commands are sent to the RC servo motor. There is no position feedback to the controller, so the RC servo motor will immediately snap to the TargetPosition after being engaged from a disengaged state. This property is useful for relaxing a servo once it has reached a given position. If you are concerned about tracking position accurately, you should not disengage the motor while IsMoving is true.

Returns:

  • (Boolean)


51
52
53
# File 'ext/phidgets/phidgets_rc_servo.c', line 51

VALUE ph_rc_servo_get_engaged(VALUE self) {
  return ph_get_bool(get_ph_handle(self), (phidget_get_bool_func)PhidgetRCServo_getEngaged);
}

#getIsMovingBoolean Also known as: is_moving?

IsMoving returns true if the RC servo motor is currently in motion. The controller cannot know if the RC servo motor is physically moving. When < code > IsMoving is false, it simply means there are no commands in the pipeline to the RC servo motor.

Returns:

  • (Boolean)


60
61
62
# File 'ext/phidgets/phidgets_rc_servo.c', line 60

VALUE ph_rc_servo_get_is_moving(VALUE self) {
  return ph_get_bool(get_ph_handle(self), (phidget_get_bool_func)PhidgetRCServo_getIsMoving);
}

#getMaxAccelerationObject Also known as: max_acceleration

The maximum acceleration that Acceleration can be set to. This value depends on MinPosition/MaxPosition and MinPulseWidth/MaxPulseWidth.



30
31
32
# File 'ext/phidgets/phidgets_rc_servo.c', line 30

VALUE ph_rc_servo_get_max_acceleration(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getMaxAcceleration);
}

#getMaxDataIntervalObject Also known as: max_data_interval

The DataInterval is the time that must elapse before the controller will fire another PositionChange event. The data interval is bounded by MinDataInterval and MaxDataInterval.



47
48
49
# File 'ext/phidgets/phidgets_rc_servo.c', line 47

VALUE ph_rc_servo_get_max_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetRCServo_getMaxDataInterval);
}

#getMaxPositionObject Also known as: max_position

The maximum position TargetPosition can be set to. The units for Position,Velocity, and Acceleration are configured by scaling the internal timing (set with MinPulseWidth and MaxPulseWidth) to a user specified range with MinPosition and MaxPosition.



77
78
79
# File 'ext/phidgets/phidgets_rc_servo.c', line 77

VALUE ph_rc_servo_get_max_position(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getMaxPosition);
}

#getMaxPulseWidthObject Also known as: max_pulse_width

The MaxPulseWidth represents the maximum pulse width that your RC servo motor specifies. This value can be found in the data sheet of most RC servo motors. The units for Position,Velocity, and Acceleration are configured by scaling the internal timing (set with MinPulseWidth and MaxPulseWidth) to a user specified range with MinPosition and MaxPosition.



95
96
97
# File 'ext/phidgets/phidgets_rc_servo.c', line 95

VALUE ph_rc_servo_get_max_pulse_width(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getMaxPulseWidth);
}

#getMaxPulseWidthLimitObject Also known as: max_pulse_width_limit

The maximum pulse width that MaxPulseWidth can be set to.



108
109
110
# File 'ext/phidgets/phidgets_rc_servo.c', line 108

VALUE ph_rc_servo_get_max_pulse_width_limit(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getMaxPulseWidthLimit);
}

#getMaxTorqueObject Also known as: max_torque

The maximum value that Torque can be set to. Torque is a ratio of the maximum available torque, therefore the minimum torque is a unitless constant.



143
144
145
# File 'ext/phidgets/phidgets_rc_servo.c', line 143

VALUE ph_rc_servo_get_max_torque(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getMaxTorque);
}

#getMaxVelocityLimitObject Also known as: max_velocity_limit

The maximum velocity VelocityLimit can be set to. This value depends on MinPosition/MaxPosition and MinPulseWidth/MaxPulseWidth.



164
165
166
# File 'ext/phidgets/phidgets_rc_servo.c', line 164

VALUE ph_rc_servo_get_max_velocity_limit(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getMaxVelocityLimit);
}

#getMinAccelerationObject Also known as: min_acceleration

The minimum value that Acceleration can be set to This value depends on MinPosition/MaxPosition and MinPulseWidth/MaxPulseWidth.



26
27
28
# File 'ext/phidgets/phidgets_rc_servo.c', line 26

VALUE ph_rc_servo_get_min_acceleration(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getMinAcceleration);
}

#getMinDataIntervalObject Also known as: min_data_interval

The DataInterval is the time that must elapse before the controller will fire another PositionChange event. The data interval is bounded by MinDataInterval and MaxDataInterval.



43
44
45
# File 'ext/phidgets/phidgets_rc_servo.c', line 43

VALUE ph_rc_servo_get_min_data_interval(VALUE self) {
  return ph_get_uint(get_ph_handle(self), (phidget_get_uint_func)PhidgetRCServo_getMinDataInterval);
}

#getMinPositionObject Also known as: min_position

The minimum position that TargetPosition can be set to. The units for Position,Velocity, and Acceleration are configured by scaling the internal timing (set with MinPulseWidth and MaxPulseWidth) to a user specified range with MinPosition and MaxPosition.



68
69
70
# File 'ext/phidgets/phidgets_rc_servo.c', line 68

VALUE ph_rc_servo_get_min_position(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getMinPosition);
}

#getMinPulseWidthObject Also known as: min_pulse_width

The MinPulseWidth represents the minimum pulse width that your RC servo motor specifies. This value can be found in the data sheet of most RC servo motors. The units for Position,Velocity, and Acceleration are configured by scaling the internal timing (set with MinPulseWidth and MaxPulseWidth) to a user specified range with MinPosition and MaxPosition.



86
87
88
# File 'ext/phidgets/phidgets_rc_servo.c', line 86

VALUE ph_rc_servo_get_min_pulse_width(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getMinPulseWidth);
}

#getMinPulseWidthLimitObject Also known as: min_pulse_width_limit

The minimum pulse width that MinPulseWidth can be set to.



104
105
106
# File 'ext/phidgets/phidgets_rc_servo.c', line 104

VALUE ph_rc_servo_get_min_pulse_width_limit(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getMinPulseWidthLimit);
}

#getMinTorqueObject Also known as: min_torque

The minimum value that Torque can be set to. Torque is a ratio of the maximum available torque, therefore the minimum torque is a unitless constant.



139
140
141
# File 'ext/phidgets/phidgets_rc_servo.c', line 139

VALUE ph_rc_servo_get_min_torque(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getMinTorque);
}

#getMinVelocityLimitObject Also known as: min_velocity_limit

The minimum velocity VelocityLimit can be set to.



160
161
162
# File 'ext/phidgets/phidgets_rc_servo.c', line 160

VALUE ph_rc_servo_get_min_velocity_limit(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getMinVelocityLimit);
}

#getPositionObject Also known as: position

The most recent position of the RC servo motor that the controller has reported. This value will always be between MinPosition and MaxPosition.



64
65
66
# File 'ext/phidgets/phidgets_rc_servo.c', line 64

VALUE ph_rc_servo_get_position(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getPosition);
}

#getSpeedRampingStateObject Also known as: speed_ramping_state

When speed ramping state is enabled, the controller will take the Acceleration and Velocity properties into account when moving the RC servo motor, usually resulting in smooth motion. If speed ramping state is not enabled, the controller will simply set the RC servo motor to the requested position.



112
113
114
# File 'ext/phidgets/phidgets_rc_servo.c', line 112

VALUE ph_rc_servo_get_speed_ramping_state(VALUE self) {
  return ph_get_bool(get_ph_handle(self), (phidget_get_bool_func)PhidgetRCServo_getSpeedRampingState);
}

#getTargetPositionObject Also known as: target_position

If the RC servo motor is configured and TargetPosition is set, the controller will continuously try to reach targeted position. The target position is bounded by MinPosition and MaxPosition. If the RC servo motor is not engaged, then the position cannot be read. The position can still be set while the RC servo motor is not engaged. Once engaged, the RC servo motor will snap to position, assuming it is not there already. The units for Position,Velocity, and Acceleration are configured by scaling the internal timing (set with MinPulseWidth and MaxPulseWidth) to a user specified range with MinPosition and MaxPosition.



121
122
123
# File 'ext/phidgets/phidgets_rc_servo.c', line 121

VALUE ph_rc_servo_get_target_position(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getTargetPosition);
}

#getTorqueObject Also known as: torque

The Torque is a ratio of the maximum available torque. The torque is bounded by MinTorque and MaxTorque Increasing the torque will increase the speed and power consumption of the RC servo motor.



130
131
132
# File 'ext/phidgets/phidgets_rc_servo.c', line 130

VALUE ph_rc_servo_get_torque(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getTorque);
}

#getVelocityObject Also known as: velocity

The velocity that the RC servo motor is being driven at. A negative value means the RC servo motor is moving towards a lower position. The velocity range of the RC servo motor will be from -VelocityLimit to VelocityLimit, depending on direction. This is not the actual physical velocity of the RC servo motor.



147
148
149
# File 'ext/phidgets/phidgets_rc_servo.c', line 147

VALUE ph_rc_servo_get_velocity(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getVelocity);
}

#getVelocityLimitObject Also known as: velocity_limit

When moving, the RC servo motor velocity will be limited by this value. The velocity limit is bounded by MinVelocityLimit and MaxVelocityLimit. SpeedRampingState controls whether or not the velocity limit value is actually applied when trying to reach a target position. The velocity range of the RC servo motor will be from -VelocityLimit to VelocityLimit, depending on direction. Note that when this value is set to 0, the RC servo motor will not move. There is a practical limit on how fast your servo can rotate, based on the physical design of the motor. The units for Position,Velocity, and Acceleration are configured by scaling the internal timing (set with MinPulseWidth and MaxPulseWidth) to a user specified range with MinPosition and MaxPosition.



151
152
153
# File 'ext/phidgets/phidgets_rc_servo.c', line 151

VALUE ph_rc_servo_get_velocity_limit(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getVelocityLimit);
}

#getVoltageObject Also known as: voltage

The supply voltage for the RC servo motor. If your controller supports multiple RC servo motors, every motor will have the same supply voltage. It is not possible to set individual supply voltages.



168
169
170
# File 'ext/phidgets/phidgets_rc_servo.c', line 168

VALUE ph_rc_servo_get_voltage(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetRCServo_getVoltage);
}

#setAcceleration(acceleration) ⇒ Object Also known as: acceleration=

When changing velocity, the RC servo motor will accelerate/decelerate at this rate. The acceleration is bounded by MaxAcceleration and MinAcceleration. SpeedRampingState controls whether or not the acceleration value is actually applied when trying to reach a target position. There is a practical limit on how fast your RC servo motor can accelerate. This is based on the load and physical design of the motor. The units for Position,Velocity, and Acceleration are configured by scaling the internal timing (set with MinPulseWidth and MaxPulseWidth) to a user specified range with MinPosition and MaxPosition.



21
22
23
24
# File 'ext/phidgets/phidgets_rc_servo.c', line 21

VALUE ph_rc_servo_set_acceleration(VALUE self, VALUE acceleration) {
  ph_raise(PhidgetRCServo_setAcceleration((PhidgetRCServoHandle)get_ph_handle(self), NUM2DBL(acceleration)));
  return Qnil;
}

#setDataInterval(data_interval) ⇒ Object Also known as: data_interval=

The DataInterval is the time that must elapse before the controller will fire another PositionChange event. The data interval is bounded by MinDataInterval and MaxDataInterval.



38
39
40
41
# File 'ext/phidgets/phidgets_rc_servo.c', line 38

VALUE ph_rc_servo_set_data_interval(VALUE self, VALUE interval) {
  ph_raise(PhidgetRCServo_setDataInterval((PhidgetRCServoHandle)get_ph_handle(self), NUM2UINT(interval)));
  return Qnil;
}

#setEngaged(state) ⇒ Object Also known as: engaged=

When engaged, a RC servo motor has the ability to be positioned. When disengaged, no commands are sent to the RC servo motor. There is no position feedback to the controller, so the RC servo motor will immediately snap to the TargetPosition after being engaged from a disengaged state. This property is useful for relaxing a servo once it has reached a given position. If you are concerned about tracking position accurately, you should not disengage the motor while IsMoving is true.



55
56
57
58
# File 'ext/phidgets/phidgets_rc_servo.c', line 55

VALUE ph_rc_servo_set_engaged(VALUE self, VALUE engaged) {
  ph_raise(PhidgetRCServo_setEngaged((PhidgetRCServoHandle)get_ph_handle(self), TYPE(engaged) == T_TRUE ? PTRUE : PFALSE));
  return Qnil;
}

#setMaxPosition(position) ⇒ Object Also known as: max_position=

The maximum position that TargetPosition can be set to. The units for Position,Velocity, and Acceleration are configured by scaling the internal timing (set with MinPulseWidth and MaxPulseWidth) to a user specified range with MinPosition and MaxPosition.



81
82
83
84
# File 'ext/phidgets/phidgets_rc_servo.c', line 81

VALUE ph_rc_servo_set_max_position(VALUE self, VALUE position) {
  ph_raise(PhidgetRCServo_setMaxPosition((PhidgetRCServoHandle)get_ph_handle(self), NUM2DBL(position)));
  return Qnil;
}

#setMaxPulseWidth(pulse_width) ⇒ Object Also known as: max_pulse_width=

The MaxPulseWidth represents the maximum pulse width that your RC servo motor specifies. This value can be found in the data sheet of most RC servo motors. The units for Position,Velocity, and Acceleration are configured by scaling the internal timing (set with MinPulseWidth and MaxPulseWidth) to a user specified range with MinPosition and MaxPosition.



99
100
101
102
# File 'ext/phidgets/phidgets_rc_servo.c', line 99

VALUE ph_rc_servo_set_max_pulse_width(VALUE self, VALUE pulse_width) {
  ph_raise(PhidgetRCServo_setMaxPulseWidth((PhidgetRCServoHandle)get_ph_handle(self), NUM2DBL(pulse_width)));
  return Qnil;
}

#setMinPosition(position) ⇒ Object Also known as: min_position=

The minimum position that TargetPosition can be set to. The units for Position,Velocity, and Acceleration are configured by scaling the internal timing (set with MinPulseWidth and MaxPulseWidth) to a user specified range with MinPosition and MaxPosition.



72
73
74
75
# File 'ext/phidgets/phidgets_rc_servo.c', line 72

VALUE ph_rc_servo_set_min_position(VALUE self, VALUE position) {
  ph_raise(PhidgetRCServo_setMinPosition((PhidgetRCServoHandle)get_ph_handle(self), NUM2DBL(position)));
  return Qnil;
}

#setMinPulseWidth(pulse_width) ⇒ Object Also known as: min_pulse_width=

The MinPulseWidth represents the minimum pulse width that your RC servo motor specifies. This value can be found in the data sheet of most RC servo motors. The units for Position,Velocity, and Acceleration are configured by scaling the internal timing (set with MinPulseWidth and MaxPulseWidth) to a user specified range with MinPosition and MaxPosition.



90
91
92
93
# File 'ext/phidgets/phidgets_rc_servo.c', line 90

VALUE ph_rc_servo_set_min_pulse_width(VALUE self, VALUE pulse_width) {
  ph_raise(PhidgetRCServo_setMinPulseWidth((PhidgetRCServoHandle)get_ph_handle(self), NUM2DBL(pulse_width)));
  return Qnil;
}

#setOnPositionChangeHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_position_change

call-seq:

setOnPositionChangeHandler(proc=nil, &block)

Assigns a handler that will be called when the PositionChange event occurs.



10
11
12
13
14
# File 'lib/phidgets/rc_servo.rb', line 10

def setOnPositionChangeHandler(cb_proc = nil, &cb_block)
  @on_position_change_thread.kill if defined? @on_position_change_thread and @on_position_change_thread.alive?
  callback = cb_proc || cb_block
  @on_position_change_thread = Thread.new {ext_setOnPositionChangeHandler(callback)}
end

#setOnTargetPositionReachedHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_target_position_reached

call-seq:

setOnTargetPositionReachedHandler(proc=nil, &block)

Assigns a handler that will be called when the TargetPositionReached event occurs.



22
23
24
25
26
# File 'lib/phidgets/rc_servo.rb', line 22

def setOnTargetPositionReachedHandler(cb_proc = nil, &cb_block)
  @on_target_position_reached_thread.kill if defined? @on_target_position_reached_thread and @on_target_position_reached_thread.alive?
  callback = cb_proc || cb_block
  @on_target_position_reached_thread = Thread.new {ext_setOnTargetPositionReachedHandler(callback)}
end

#setOnVelocityChangeHandler(cb_proc = nil, &cb_block) ⇒ Object Also known as: on_velocity_change

call-seq:

setOnVelocityChangeHandler(proc=nil, &block)

Assigns a handler that will be called when the PositionChange event occurs.



34
35
36
37
38
# File 'lib/phidgets/rc_servo.rb', line 34

def setOnVelocityChangeHandler(cb_proc = nil, &cb_block)
  @on_velocity_change_thread.kill if defined? @on_velocity_change_thread and @on_velocity_change_thread.alive?
  callback = cb_proc || cb_block
  @on_velocity_change_thread = Thread.new {ext_setOnVelocityChangeHandler(callback)}
end

#setSpeedRampingState(ramping_state) ⇒ Object Also known as: speed_ramping_state=

When speed ramping state is enabled, the controller will take the Acceleration and Velocity properties into account when moving the RC servo motor, usually resulting in smooth motion. If speed ramping state is not enabled, the controller will simply set the RC servo motor to the requested position.



116
117
118
119
# File 'ext/phidgets/phidgets_rc_servo.c', line 116

VALUE ph_rc_servo_set_speed_ramping_state(VALUE self, VALUE speed_ramping_state) {
  ph_raise(PhidgetRCServo_setSpeedRampingState((PhidgetRCServoHandle)get_ph_handle(self), TYPE(speed_ramping_state) == T_TRUE ? PTRUE : PFALSE));
  return Qnil;
}

#setTargetPosition(position) ⇒ Object Also known as: target_position=

If the RC servo motor is configured and TargetPosition is set, the controller will continuously try to reach targeted position. The target position is bounded by MinPosition and MaxPosition. If the RC servo motor is not engaged, then the position cannot be read. The position can still be set while the RC servo motor is not engaged. Once engaged, the RC servo motor will snap to position, assuming it is not there already. The units for Position,Velocity, and Acceleration are configured by scaling the internal timing (set with MinPulseWidth and MaxPulseWidth) to a user specified range with MinPosition and MaxPosition.



125
126
127
128
# File 'ext/phidgets/phidgets_rc_servo.c', line 125

VALUE ph_rc_servo_set_target_position(VALUE self, VALUE position) {
  ph_raise(PhidgetRCServo_setTargetPosition((PhidgetRCServoHandle)get_ph_handle(self), NUM2DBL(position)));
  return Qnil;
}

#setTargetPosition_async(position, cb_proc = nil, &cb_block) ⇒ Object Also known as: set_target_position_async

call-seq:

setTargetPosition_async(proc=nil, &block)

If the controller is configured and the TargetPosition is set, the motor will try to reach the TargetPostiion.



45
46
47
48
49
# File 'lib/phidgets/rc_servo.rb', line 45

def setTargetPosition_async(position, cb_proc = nil, &cb_block)
  @target_position_async_thread.kill if defined? @target_position_async_thread and @target_position_async_thread.alive?
  callback = cb_proc || cb_block
  @target_position_async_thread = Thread.new {ext_setTargetPosition_async(position, callback)}
end

#setTorque(torque) ⇒ Object Also known as: torque=

The Torque is a ratio of the maximum available torque. The torque is bounded by MinTorque and MaxTorque Increasing the torque will increase the speed and power consumption of the RC servo motor.



134
135
136
137
# File 'ext/phidgets/phidgets_rc_servo.c', line 134

VALUE ph_rc_servo_set_torque(VALUE self, VALUE torque) {
  ph_raise(PhidgetRCServo_setTorque((PhidgetRCServoHandle)get_ph_handle(self), NUM2DBL(torque)));
  return Qnil;
}

#setVelocityLimit(velocity) ⇒ Object Also known as: velocity_limit=

When moving, the RC servo motor velocity will be limited by this value. The velocity limit is bounded by MinVelocityLimit and MaxVelocityLimit. SpeedRampingState controls whether or not the velocity limit value is actually applied when trying to reach a target position. The velocity range of the RC servo motor will be from -VelocityLimit to VelocityLimit, depending on direction. Note that when this value is set to 0, the RC servo motor will not move. There is a practical limit on how fast your servo can rotate, based on the physical design of the motor. The units for Position,Velocity, and Acceleration are configured by scaling the internal timing (set with MinPulseWidth and MaxPulseWidth) to a user specified range with MinPosition and MaxPosition.



155
156
157
158
# File 'ext/phidgets/phidgets_rc_servo.c', line 155

VALUE ph_rc_servo_set_velocity_limit(VALUE self, VALUE velocity_limit) {
  ph_raise(PhidgetRCServo_setVelocityLimit((PhidgetRCServoHandle)get_ph_handle(self), NUM2DBL(velocity_limit)));
  return Qnil;
}

#setVoltage(voltage) ⇒ Object Also known as: voltage=

The supply voltage for the RC servo motor. If your controller supports multiple RC servo motors, every motor will have the same supply voltage. It is not possible to set individual supply voltages.



172
173
174
175
# File 'ext/phidgets/phidgets_rc_servo.c', line 172

VALUE ph_rc_servo_set_voltage(VALUE self, VALUE voltage) {
  ph_raise(PhidgetRCServo_setVoltage((PhidgetRCServoHandle)get_ph_handle(self), NUM2DBL(voltage)));
  return Qnil;
}