Skip to content

Get Joint Positions

SUMMARY

Get Joint Positions returns the current joint angles in degrees, one per joint, ordered base to wrist. Reads from the manipulator state - live values when connected, the last commanded joint configuration offline.

UNITS

Returns joint positions in degrees, ordered base to wrist.

The Skill

python
joint_positions = robot.get_joint_positions()

The Code

python
"""
Logs the manipulator's live joint positions.

Supports Universal Robots (UR), Epson, and virtual.

Usage:
    python get_joint_positions.py [--ip <ROBOT_IP>]
"""

import argparse

from loguru import logger

from telekinesis.synapse.robots.manipulators import universal_robots

def main(ip: str) -> None:
    """Log the live joint positions [deg]."""

    #===================== Create Robot ==========================================
    robot = universal_robots.UniversalRobotsUR10E(name='UR10e')

    try:
        #===================== Connect Robot ==========================================
        robot.connect(ip=ip)

        # ==================== Run Skill ============================================
        logger.success(f"joint_positions [deg]: {robot.get_joint_positions()}")
    except (ConnectionError, OSError) as e:
        logger.error(f"Error occurred: {e}")
    finally:
        robot.disconnect()

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Read joint positions Synapse example")
    parser.add_argument("--ip", type=str, default="192.168.1.100", help="UR robot IP address (default: 192.168.1.100)")
    args = parser.parse_args()

    main(ip=args.ip)
python
"""
Read the manipulator's joint positions.

Supports Universal Robots (UR), Epson, and virtual.

Usage:
    python get_joint_positions.py
"""

from loguru import logger

from telekinesis.synapse.robots.manipulators import universal_robots

def main():
    """Log the commanded-cache joint positions [deg]."""

    #===================== Create Robot ==========================================
    robot = universal_robots.UniversalRobotsUR10E(name='UR10e')

    # ==================== Run Skill ============================================
    logger.success(f"joint_positions [deg]: {robot.get_joint_positions()}")

if __name__ == "__main__":
    main()

Parameter Configuration

This skill takes no input parameters.

Returns

TypeDescription
list[float]Joint angles in degrees, one value per joint, ordered base to wrist.

Raises

get_joint_positions reads from robot.state and does not raise under normal use. On Epson, reading live hardware state instead queries the controller directly and can raise RuntimeError if the robot is not connected or the controller command fails.

Where to Use the Skill

  • Feedback control - Sample joint state at each control step to close a position loop.
  • Relative motion - Read current positions and apply an offset before calling set_joint_positions.
  • State logging - Record the joint configuration at key points in a task sequence.

When Not to Use the Skill