How to attach a body to external axes
Comments
-
You can refer this Doc for getting detailed information about the how to attach external axes to body: http://developercenter.robotstudio.com/BlobProxy/manuals/RobotStudioOpManual/doc61.html
0 -
Hi,
Since you are in the Developer Center part, I'm going to assume that you want to do this using the RobotStudio SDK?
http://developercenter.robotstudio.com/DevCenter.aspx?DevCenter=RobotStudio
If not then please give us a context.
If so then the attach functionality is on the Frame or Flange of the External Axis depending on how you created it. But note that a body cannot be attached by itself, instead it needs to be in a part to be attachable.
Here is a snippet that creates a cylinder at the flange of the active mechanism:
{
Logger.AddMessage(new LogMessage(sender.ToString()));
// Check that we have an active station
Station _station = Project.ActiveProject as Station;
if (_station == null) return;
// Get the active task and it's mechanism
RsTask _task = _station.ActiveTask;
if (_task == null) return;
Mechanism _mechanism = _task.Mechanism;
if (_mechanism == null)
{
Logger.AddMessage(new LogMessage("No active mechanism"));
return;
}
Part p=null;
Body cyl=Body.CreateSolidCone(new Matrix4(new Vector3(Axis.X), 0.0), 0.1, 0.5);
foreach (Flange x in _mechanism.GetFlanges())
{
p = new Part();
p.Bodies.Add(cyl);
_station.GraphicComponents.Add(p);
x.Attach(p,true);
}
Logger.AddMessage(new LogMessage("It is done!"));
}You could also attach directly to a specific joint, in this example it is joint 3 of a robot.
GraphicComponent _gc;
_mechanism.GetParentLink(3, out _gc);
Part myPart=(Part)_gc;
myPart.Attach(p,true);John
Developer Center0 -
Hi,yes, I´m working on the PC SDK. Ok, I didn´t know the Flange structure... but when I list all the flanges of the mechanism, the only one available is the wrist of my robot, and the external axis is not in this list... should it be listed in this collection? Is it possible that I have my Station misconfigured and the external axis is not visible by the system?0
-
Hi again HM
Seems to be some confusion here. The PC SDK deals with communication with the controller from a PC app. the RobotStudio SDK deals with the functionality in RobotStudio.
The only attach functionality in PC SDK is for attaching GUIDs to controllerIDs.
Here is a RobotStudio SDK snippet that goes through all mechanisms in the station and attaches a cylinder to all flanges on those mechanisms.
static void button2_ExecuteCommand(object sender, ExecuteCommandEventArgs e)
{
Logger.AddMessage(new LogMessage(sender.ToString()));// Check that we have an active station
Station station = Project.ActiveProject as Station;
if (station == null) return;Mechanism m = null;
IEnumerable<ProjectObject> stationobjects = station.GetAllObjects();
foreach (ProjectObject po in stationobjects)
{
if (po.TypeDisplayName == "Mechanism")
{
m = (Mechanism)po;
Flange[] flanges = m.GetFlanges();
foreach (Flange f in flanges)
{
Part p = new Part();
p.Bodies.Add(Body.CreateSolidCone(new Matrix4(new Vector3(Axis.X), 0.0), 0.1, 0.5));
station.GraphicComponents.Add(p);
f.Attach(p, true);
Logger.AddMessage(new LogMessage("Another one bites the dust: " + f.Name));
}
}
}
Logger.AddMessage(new LogMessage("It is done!"));
}Now you can actually create a mechanism that doesn't have a flange. Most tools are like that.
So if you have created the external axes yourself then you might have missed specifying a flange?
John
Developer Center1 -
Ok! This works perfectly! Thanks a lot.0
Categories
- All Categories
- 5.5K RobotStudio
- 395 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings