Stopping Viper 1300 from C#

Tips and tricks for Adept ACE

Stopping Viper 1300 from C#

Postby cos.cirstea » Tue Sep 19, 2017 11:54 am

Hi,

I am currently using Adept 3.4.3.21 to control a Viper 1300 robot and an application developed by me in C#.
In order to stop when the user requests I issue robot.Halt(), which practically does the trick, however if I want to issue a move after that, the controller gives me error : { -621 } * Robot interlocked
Is there any way to go around this situation?

Thank you
cos.cirstea
 
Posts: 6
Joined: Tue Oct 21, 2014 10:23 am

Re: Stopping Viper 1300 from C#

Postby cos.cirstea » Sat Sep 23, 2017 1:17 pm

Anybody? Any sugestions?
cos.cirstea
 
Posts: 6
Joined: Tue Oct 21, 2014 10:23 am

Re: Stopping Viper 1300 from C#

Postby Guenter Grass » Thu Sep 28, 2017 7:13 am

HI,

I just tested this in ACE 3.7.3.152 and it works fine like this. Debugging through the program the robot stops (Halt) and then it continues its motions.

______________________________________________________________
using Ace.Adept.Server.Motion.Robots;
using Ace.Core.Server;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Ace.Adept.Server.Motion;
using Ace.Core.Server.Motion;
namespace Ace.Custom {

public class Program {

public AceServer ace;

public void Main () {

// Get a robot in the workspace
//IRobot robot = ace.Root["/Robot"] as IRobot;
ICobra600 robot = (ICobra600) ace["/SmartController 1/R1 Cobra600"];

// Create an end-effector object
//IAbstractEndEffector endEffector = ace.Root.AddObjectOfType(typeof(IIODrivenEndEffector), "End Effector") as IAbstractEndEffector;

// Associate the end-effector with the robot
//robot.SelectedEndEffector = endEffector;

// If not calibrated, calibrate the robot
try {
if (robot.IsCalibrated == false) {
robot.Power = true;
robot.Calibrate();
}
} catch (Exception ex) {
Trace.WriteLine(ex.Message);
}

// Read various properties of the robot
Trace.WriteLine("Number of joints = " + robot.JointCount);

double[] jointPositions = robot.JointPosition;
for (int i = 0; i < robot.JointCount; i++) {
Trace.WriteLine("Joint " + i + " " + jointPositions[i]);
}

// Transform the current joint position to a world location
try {
Transform3D loc = robot.JointToWorld(jointPositions);
} catch (Exception ex) {
Trace.WriteLine(ex.Message);
}

// Check if the current location is inrange
Transform3D currentPosition = robot.WorldLocationWithTool;
int inRange = robot.InRange(currentPosition);
Trace.WriteLine(currentPosition + " inrange check = " + inRange);

// Get the current robot configuration
IMoveConfiguration moveConfig = robot.GetMoveConfiguration(jointPositions);

// Create a motion object and command the robot to move
CartesianMove cartesianMove = ace.CreateObject(typeof(CartesianMove)) as CartesianMove;
cartesianMove.MoveConfiguration = moveConfig;
cartesianMove.WorldLocation = new Transform3D(200, 200, 250,0,180,0);

try {

// Issue the move and wait until it is done
robot.Move(cartesianMove);

robot.Halt();

robot.Move(cartesianMove);
robot.WaitMoveDone();

// Force the robot to issue a DETACH
robot.AutomaticControlActive = false;

} catch (Exception ex) {
Trace.WriteLine(ex.Message);
}

}
}
}
______________________________________________________________

Best Regards
Günter
Guenter Grass
 
Posts: 189
Joined: Thu Oct 16, 2008 4:34 am

Re: Stopping Viper 1300 from C#

Postby cos.cirstea » Thu Sep 28, 2017 12:03 pm

Hi Guenter
Thank you for your response.
Here are some portions of my code that may be of interest:

Connect ()
{
RemotingUtil.InitializeRemotingSubsystem(true, 0);

// Connect to ACE.
mAceServer = (IAceServer)RemotingUtil.GetRemoteServerObject(typeof(IAceServer), "ace", "localhost", RemotingPort);
mAceClient = new AceClient(mAceServer);
mAceClient.InitializePlugins(null);

// Get a handle to all controllers in the workspace
ObjectTypeFilter filter = new ObjectTypeFilter(typeof(IAdeptController));
IList<IAceObject> controllerObjects = mAceServer.Root.Filter(filter, true);

// Create a controller and robot and establish the connection
mController = (IAdeptController)controllerObjects.ElementAt<IAceObject>(0);

mController.Enabled = true;

// Force the power on and the robot to calibrated
if (mController.HighPower == false)
mController.HighPower = true;

if (mController.IsCalibrated == false)
mController.Calibrate();

mRobot = mController.GetRobot(1);

if (mRobot.IsAlive == false)
{
//logging
throw new InvalidOperationException();
}
if(mRobot.Power == false)
mRobot.Power = true;

mRobot.ClearErrors();
}

I run an internal receipt, which commands the robot to move at different points and execute operations such as get/put
The code that executes the move looks something like this:

public void MoveAbsolute(CoordinateWithParams toCoordinate)
{
if(IsAtCoordinate(toCoordinate) == false)
{
Transform3D transform = new Transform3D(Transform3D.DefaultEulerAngles, toCoordinate.ToArray());

// Create a move object and make sure the location is relative to the workspace
CartesianMove move = mAceServer.CreateObject(typeof(CartesianMove)) as CartesianMove;
move.WorldLocation = CoordinateUtils.WorkspaceToRobot(transform, mRobot);
move.Param.Accel = 100;
move.Param.Decel = 100;
move.Param.Speed = mRobotSpeed;
move.Param.MotionEnd = MotionEnd.Blend;
move.Param.SCurveProfile = 0;
move.Param.Straight = toCoordinate.IsMotionStraight;

try
{
// Issue the move
mRobot.Move(move);
if(toCoordinate.WaitForMotionToComplete)
mRobot.WaitMoveDone();
}
catch (Exception ex)
{
// logging
throw ex;
}
}
else
// logging - already there, don`t move
}

The code that stops the robot is a call performed by the user or when an alarm happens and looks like this:

public void Stop()
{
mRobot.Halt();
mInitialized = false;
// logging
}

So to be honest, I see no big differences between our codes, except the fact that you calibrate the robot if it is not. I calibrate the controller.

I was wondering if there could be some controller setting which sets it to interlocked when I issue a robot.Halt(). Because the issue is actually with the controller, it issues the Interlocked error when I try to move the robot, not the robot itself ..

Thank you,
Cosmin
cos.cirstea
 
Posts: 6
Joined: Tue Oct 21, 2014 10:23 am

Re: Stopping Viper 1300 from C#

Postby Guenter Grass » Fri Sep 29, 2017 1:48 am

Hi Cosmin,

I used these parts of the code and it runs fine.
_______________________________________________________________
using Ace.Adept.Server.Motion.Robots;
using Ace.Adept.Server.Controls;
using Ace.Core.Server;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Ace.Core.Server.Motion;
using Ace.Adept.Server.Motion;

namespace Ace.Custom {

public class Program {

public AceServer ace;

public void Main () {


IAdeptController mController = (IAdeptController) ace["/SmartController 15/SmartController 15"];

// Force the power on and the robot to calibrated
if (mController.HighPower == false)
mController.HighPower = true;

if (mController.IsCalibrated == false)
mController.Calibrate();

//mRobot = mController.GetRobot(1);
ICobra600 mRobot = (ICobra600) ace["/SmartController 15/R1 Cobra600"];

if (mRobot.IsAlive == false)
{
//logging
throw new InvalidOperationException();
}
if(mRobot.Power == false)
mRobot.Power = true;

mRobot.ClearErrors();


// Create a move object and make sure the location is relative to the workspace
CartesianMove move = ace.CreateObject(typeof(CartesianMove)) as CartesianMove;
move.WorldLocation = mRobot.WorldLocationWithTool * new Transform3D(-100, -100, 0);
move.Param.Accel = 100;
move.Param.Decel = 100;
move.Param.Speed = 100;
move.Param.MotionEnd = MotionEnd.Blend;
move.Param.SCurveProfile = 0;
//move.Param.Straight = toCoordinate.IsMotionStraight;

try
{

// Issue the move
mRobot.Move(move);

mRobot.WaitMoveDone();
}
catch (Exception ex)
{
// logging
throw ex;
}

}
}
}
_____________________________________________________________________________


The differences are
- I start the C# program directly from within Ace
- I use Ace 3.7 instead of 3.4

Can you try ACE 3.7?

Best Regards
Günter
Guenter Grass
 
Posts: 189
Joined: Thu Oct 16, 2008 4:34 am


Return to Adept ACE

Who is online

Users browsing this forum: No registered users and 3 guests