Read the current tool position of your Fanuc robot in Cartesian (X, Y, Z, W, P, R) or joint (J1–J6) format using different protocols.

## SNPX (fastest : ~2 ms)

SNPX provides the fastest position reading, in world or user frame coordinates.

**C# : SnpxPositionWorld**
```csharp
using UnderAutomation.Fanuc;
using UnderAutomation.Fanuc.Common;

public class SnpxPositionWorld
{
  static void Main()
  {
    // Create a new Fanuc robot instance
    FanucRobot robot = new FanucRobot();

    // Set connection parameters
    ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");
    parameters.Snpx.Enable = true;

    // Connect to the robot
    robot.Connect(parameters);

    /**/
    // Read a current world position
    Position worldPosition = robot.Snpx.CurrentPosition.ReadWorldPosition();

    // Access the Cartesian position
    double x = worldPosition.CartesianPosition.X;

    // Access the user tool at this cartesian position
    short usertTool = worldPosition.UserTool;

    // Access the joint positions
    double j1 = worldPosition.JointsPosition.J1;

    // Read a current world position of group 2
    Position worldPositionG2 = robot.Snpx.CurrentPosition.ReadWorldPosition(2);
    /**/
  }

}
```

**Python : SnpxPositionWorld**
```python
from underautomation.fanuc.fanuc_robot import FanucRobot
from underautomation.fanuc.connection_parameters import ConnectionParameters

# Create a robot instance
robot = FanucRobot()

# Configure connection parameters
parameters = ConnectionParameters("192.168.0.1")
parameters.snpx.enable = True

# Connect to the robot
robot.connect(parameters)

##
# Read current world position
world_position = robot.snpx.current_position.read_world_position()

# Access the Cartesian position
x = world_position.cartesian_position.x

# Access the user tool at this position
user_tool = world_position.user_tool

# Access the joint positions
j1 = world_position.joints_position.j1

# Read current world position of group 2
world_position_g2 = robot.snpx.current_position.read_world_position(2)
##
```

**C# : SnpxPositionUserFrame**
```csharp
using UnderAutomation.Fanuc;
using UnderAutomation.Fanuc.Common;

public class SnpxPositionUserFrame
{
  static void Main()
  {
    // Create a new Fanuc robot instance
    FanucRobot robot = new FanucRobot();

    // Set connection parameters
    ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");
    parameters.Snpx.Enable = true;

    // Connect to the robot
    robot.Connect(parameters);

    /**/
    // Read user frame 2 position
    Position userFrame = robot.Snpx.CurrentPosition.ReadUserFramePosition(1);

    // Access the Cartesian position
    double x = userFrame.CartesianPosition.X;

    // Access the user tool at this cartesian position
    short usertTool = userFrame.UserTool;

    // Access the user frame id
    short usertFrame = userFrame.UserFrame;

    // Access the joint positions
    double j1 = userFrame.JointsPosition.J1;

    // Read a current world position of group 2
    Position userFrameG2 = robot.Snpx.CurrentPosition.ReadWorldPosition(2);
    /**/
  }

}
```

**Python : SnpxPositionUserFrame**
```python
from underautomation.fanuc.fanuc_robot import FanucRobot
from underautomation.fanuc.connection_parameters import ConnectionParameters

# Create a robot instance
robot = FanucRobot()

# Configure connection parameters
parameters = ConnectionParameters("192.168.0.1")
parameters.snpx.enable = True

# Connect to the robot
robot.connect(parameters)

##
# Read user frame 1 position
user_frame = robot.snpx.current_position.read_user_frame_position(1)

# Access the Cartesian position
x = user_frame.cartesian_position.x

# Access the user tool at this position
user_tool = user_frame.user_tool

# Access the user frame id
frame_id = user_frame.user_frame

# Access the joint positions
j1 = user_frame.joints_position.j1

# Read user frame position of group 2
user_frame_g2 = robot.snpx.current_position.read_user_frame_position(1, 2)
##
```

See also: [SNPX Current position](/fanuc/documentation/snpx-position)

## CGTP Web Server

CGTP returns Cartesian and joint positions separately:

**C# : GetCurrentPositionCgtp**
```csharp
using System;
using UnderAutomation.Fanuc;
using UnderAutomation.Fanuc.Common;

public class GetCurrentPositionCgtp
{
    static void Main()
    {
        FanucRobot robot = new FanucRobot();
        robot.Connect("192.168.0.1");

        /**/
        // Read Cartesian position
        CartesianPosition cartesian = robot.Cgtp.ReadCartesianPosition();
        Console.WriteLine($"X={cartesian.X}, Y={cartesian.Y}, Z={cartesian.Z}");

        // Read joint position
        JointsPosition joints = robot.Cgtp.ReadJointPosition();
        Console.WriteLine($"J1={joints.J1}, J2={joints.J2}, J3={joints.J3}");

        // Multi-group
        CartesianPosition group2 = robot.Cgtp.ReadCartesianPosition(groupNum: 2);
        /**/
    }
}
```

**Python : GetCurrentPositionCgtp**
```python
from underautomation.fanuc.fanuc_robot import FanucRobot

robot = FanucRobot()
robot.connect("192.168.0.1")

##
# Read Cartesian position
cartesian = robot.cgtp.read_cartesian_position()
print(f"X={cartesian.x}, Y={cartesian.y}, Z={cartesian.z}")

# Read joint position
joints = robot.cgtp.read_joint_position()
print(f"J1={joints.j1}, J2={joints.j2}, J3={joints.j3}")

# Multi-group
group2 = robot.cgtp.read_cartesian_position(group_num=2)
##
```

See also: [CGTP Position & kinematics](/fanuc/documentation/cgtp-position-kinematics)

## FTP (offline parsing)

Download and parse the current position diagnostic file:

**C# : GetCurrentPositionFtp**
```csharp
using UnderAutomation.Fanuc;
using UnderAutomation.Fanuc.Common;

public class GetCurrentPositionFtp
{
    static void Main()
    {
        FanucRobot robot = new FanucRobot();
        robot.Connect("192.168.0.1");

        /**/
        CurrentPosition curPos = robot.Ftp.GetSummaryDiagnostic().CurrentPosition;
        /**/
    }
}
```

**Python : GetCurrentPositionFtp**
```python
from underautomation.fanuc.fanuc_robot import FanucRobot

robot = FanucRobot()
robot.connect("192.168.0.1")

##
cur_pos = robot.ftp.get_summary_diagnostic().current_position
##
```

See also: [FTP Diagnostics & variables](/fanuc/documentation/ftp-diagnostics)

## Telnet KCL

Read position-related system variables:

**C# : GetCurrentPositionTelnet**
```csharp
using UnderAutomation.Fanuc;

public class GetCurrentPositionTelnet
{
    static void Main()
    {
        FanucRobot robot = new FanucRobot();
        robot.Connect("192.168.0.1");

        /**/
        var curpos = robot.Telnet.GetCurrentPose();
        /**/
    }
}
```

**Python : GetCurrentPositionTelnet**
```python
from underautomation.fanuc.fanuc_robot import FanucRobot

robot = FanucRobot()
robot.connect("192.168.0.1")

##
curpos = robot.telnet.get_variable("$CURPOS")
curjpos = robot.telnet.get_variable("$CURJPOS")
##
```

## Protocol comparison

| Feature | SNPX | CGTP | FTP | Telnet |
|---------|------|------|-----|--------|
| **Speed** | ~2 ms | ~50 ms | ~100 ms | ~30 ms |
| **World frame** | Yes | Yes | Yes | Yes |
| **User frame** | Yes | No | No | No |
| **Joint position** | Yes | Yes | Yes | Yes |
| **Multi-group** | Yes | Yes | No | No |