Cancel
Showing results for 
Search instead for 
Did you mean: 

Creating robot pose sensors / signals

Creator
Creator

Hello,

 

I am working on a command that will create the default signals for all robots in a study.  The part I am having trouble with is creating the pose signals.  The code I am using is at the bottom of this post.

 

This code will create a signal in the Signal Viewer with the associated robot in the Resource column.  However no pose signal is listed in the signal list of the robot.  After the study is saved and reloaded, the signal remains in the signal viewer, but is no longer associated to any resource.

 

I am using Process Simulate v13.1.

 

Thank you.

 

TxTypeFilter robotFilter = new TxTypeFilter(typeof(TxRobot));
TxObjectList allRobots = TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(robotFilter);

foreach (TxRobot robot in allRobots)
{
    foreach (TxPose robotPose in robot.PoseList)
    {
        TxPlcDevicePoseSensorCreationData newRobotPoseSensorData = new TxPlcDevicePoseSensorCreationData(robotPose, robot.Name + "_at_" + robotPose.Name);
        newRobotPoseSensorData.HighRange = 2;
        newRobotPoseSensorData.LowRange = -2;
        robot.CreatePoseSensor(newRobotPoseSensorData);
    }
}

 

 

8 REPLIES 8

Re: Creating robot pose sensors / signals

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Dmar,

 

Your are creating a device pose sensor and you need to create a robot pose sensor. Unfortunatelly robot pose sensor creation is not yet available in the .NET API. You can contact your local GTAC support and request that API.

 

Best Regards,

DianaG

Re: Creating robot pose sensors / signals

Valued Contributor
Valued Contributor

As of 14.0.1, there is a CreateRobotPoseSensor method.

 

Could somebody please supply an example of its use?

 

Presumably I need to set the HighRange and LowRange to something sensible, such as the same values as the pose sensors when the default signals are created, but I cannot seem to access these properties on robot pose sensors that have already been created using the normal method.

 

The default values for these parameters when creating a new robot pose sensor via TxRobotPoseSensorCreationData are both (positive) 1E+32 and the sensors are always on when running the simulation. Presumably, this is because these values are too high. What are some typical values?

 

It would be useful for the help to include a description of what the HighRange and LowRange parameters are.

 

Thanks

 

 

P.S. Using trial and error, I've just found these values seem to work:

 

HighRange = 0.05
LowRange = 0.00

Re: Creating robot pose sensors / signals

Valued Contributor
Valued Contributor

Just to add, the HighRange and LowRange values appear to be in radians, so setting them to 0.01 and -0.01 respectively gives a robot pose sensor that detects a pose if it's within 0.625 degrees either side of a joint.

Re: Creating robot pose sensors / signals

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

Hello LTW,

 

Here are the ranges based on the first driving joint:

  • For revolute joint case (value is considered in radians) : LowRange = -0.035  , HighRange = 0.035
  • For prismatic joint case (value is considered in mm): LowRange = -2, HighRange = 2

 

There is a fix in V14.0.2, where that values will be initialized with default values.

 

Regards,

Adi

Re: Creating robot pose sensors / signals

Valued Contributor
Valued Contributor

Thank you!

Re: Creating robot pose sensors / signals

Siemens Legend Siemens Legend
Siemens Legend

Hello 

 

Just wanted to mention that in version 14.0.1 we introduced a feature which can import Default signals for all robot in a study easily.

You can use Siganl Mapping to do so. 

Just run Signal Mapping and pick the excel located @ C:\Program Files\Tecnomatix_14.1.2\eMPower\Plc\MappingTemplates\SignalMappingTemplate_eMS.xlsx.

It will create all Default signals (and more) for all robots in the study. You can edit this Excel file to change the list imported as well or pre-select some robot to partially import. 

Kind regards,
Gal Snir

Re: Creating robot pose sensors / signals

Experimenter
Experimenter

private static void CreateRobotPoseSensors(TxRobot robot)
{

TxPlcProgramRoot prog = TxApplication.ActiveDocument.PlcProgramRootOrNull;
TxPlcProgram pp = prog.CurrentPlcProgramOrNull;

foreach (TxPose pose in robot.PoseList)
{
if (pose.Name != "HOME")
{
TxPlcRobotPoseSensorCreationData data = new TxPlcRobotPoseSensorCreationData(pose, robot.Name + "_at_" + pose.Name);
ITxPlcRobotPoseSensor sensor = robot.CreateRobotPoseSensor(data);
}
}
}

Re: Creating robot pose sensors / signals

Creator
Creator

Thanks everyone for the responses.  I am now at v14.1 and can confirm that this functionality has been added to the API as noted above.

 

I've accepted Cliff's example as the solution, however I wanted to note that this will create the signal with the Private (robot) signal name the same as the main (PLC) signal name (i.e., with the robot name in both signals).  If you would like the robot private signal name to be generic as it would be if you used the "Create Default Signals" button in the robot signal viewer, then you can add the lines of code below after the pose sensor is created:

 

ITxPlcRobotSignal sensorSignal = sensor.Signal as ITxPlcRobotSignal;
sensorSignal.PrivateName = "at_" + pose.Name;