Get Target Speed Fraction
SUMMARY
Get Target Speed Fraction returns the target speed fraction set by the teach-pendant speed slider as a float in [0.0, 1.0]. It is one of the two factors whose product is reported by Get Speed Scaling Combined.
UNITS
Returns a dimensionless fraction in [0.0, 1.0].
The Skill
python
fraction = robot.get_target_speed_fraction()The Code
Example: Read the Teach-Pendant Speed Slider
Connect to the robot, read the target speed fraction, and log it.
python
"""
Logs the target speed fraction set by the operator via the teach-pendant speed slider.
Supports Universal Robots (UR).
Usage:
python get_target_speed_fraction.py [--ip <ROBOT_IP>]
"""
import argparse
from loguru import logger
from telekinesis.synapse.robots.manipulators import universal_robots
def main(ip: str | None) -> None:
"""Log the target speed fraction [0.0, 1.0]."""
#===================== Create Robot ==========================================
robot = universal_robots.UniversalRobotsUR10E(name='UR10e')
try:
#===================== Connect Robot ==========================================
if ip:
robot.connect(ip=ip)
# ==================== Run Skill ============================================
fraction = robot.get_target_speed_fraction()
logger.success(f"Target speed fraction: {fraction:.3f}")
except (ConnectionError, OSError) as e:
logger.error(f"Error occurred: {e}")
finally:
robot.disconnect()
robot.shutdown()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Read target speed fraction Synapse example")
parser.add_argument("--ip", type=str, default=None,
help="UR robot IP address for real hardware, e.g. 192.168.1.100")
args = parser.parse_args()
main(ip=args.ip)Running the Example
bash
python get_target_speed_fraction.py --ip 192.168.1.100For all options:
bash
python get_target_speed_fraction.py --helpParameter Configuration
This skill takes no input parameters.
Returns
| Type | Description |
|---|---|
float | Target speed fraction [0.0, 1.0] from the teach-pendant speed slider. |
Raises
| Exception | Condition |
|---|---|
RuntimeError | The robot is not connected (connect() was not called, or the connection has been lost) |
Where to Use the Skill
- Operator-override detection - Detect when the operator has lowered the speed slider mid-task.
- Adaptive program logic - Skip or extend dwell times based on the operator-selected speed.
When Not to Use the Skill
- You need the effective scaling actually applied - use Get Speed Scaling Combined, which folds in runtime safety / program scaling on top of the slider value.