Skip to content

Commit

Permalink
python: Robot: *.py: Fix python3 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
plaes authored and wwmayer committed Feb 28, 2017
1 parent b265030 commit 8b5fb47
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/Mod/Robot/KukaExporter.py
Expand Up @@ -26,7 +26,7 @@


def ExportCompactSub(Rob,Trak,FileName):
print Rob,Trak,FileName
print(Rob,Trak,FileName)
Traj = Trak.Trajectory
# open the output file
SrcFile = open(FileName,'w')
Expand Down Expand Up @@ -65,5 +65,5 @@ def ExportCompactSub(Rob,Trak,FileName):
#DatFile.close()

def ExportFullSub(Rob,Trak,FileName):
print Trak,FileName
print(Trak,FileName)

2 changes: 1 addition & 1 deletion src/Mod/Robot/MovieTool.py
Expand Up @@ -19,4 +19,4 @@ def run():
for l in range(size):
Robot.Tcp = Trajectory.position(l/24.0).multiply(Tool)
FreeCADGui.updateGui()
FreeCADGui.ActiveDocument.ActiveView.saveImage(OutDir + "Rob_" + `l` + ".jpg",x,y,"White")
FreeCADGui.ActiveDocument.ActiveView.saveImage(OutDir + "Rob_" + l + ".jpg",x,y,"White")
26 changes: 13 additions & 13 deletions src/Mod/Robot/RobotExample.py
Expand Up @@ -9,31 +9,31 @@
# === Basic robot stuff ===
# create the robot. If you not specify a other kinematic it becomes a Puma 560
rob = Robot6Axis()
print rob
print(rob)

# accessing the axis and the Tcp. Axis go from 1-6 and are in degrees:
Start = rob.Tcp
print Start
print rob.Axis1
print(Start)
print(rob.Axis1)

# move the first Axis of the robot:
rob.Axis1 = 5.0
# the Tcp has changed (forward kinematic)
print rob.Tcp
print(rob.Tcp)

# move the robot back to start position (reverse kinematic):
rob.Tcp = Start
print rob.Axis1
print(rob.Axis1)

# the same with axis 2:
rob.Axis2 = 5.0
print rob.Tcp
print(rob.Tcp)
rob.Tcp = Start
print rob.Axis2
print(rob.Axis2)

# Waypoints:
w = Waypoint(Placement(),name="Pt",type="LIN")
print w.Name,w.Type,w.Pos,w.Cont,w.Velocity,w.Base,w.Tool
print(w.Name,w.Type,w.Pos,w.Cont,w.Velocity,w.Base,w.Tool)

# generate more. The Trajectory find allways outomatically a unique name for the waypoints
l = [w]
Expand All @@ -42,12 +42,12 @@

# create a trajectory
t = Trajectory(l)
print t
print(t)
for i in range(7):
t.insertWaypoints(Waypoint(Placement(Vector(0,0,i*100+500),Vector(1,0,0),0),"LIN","Pt"))

# see a list of all waypoints:
print t.Waypoints
print(t.Waypoints)

del rob,Start,t,l,w

Expand Down Expand Up @@ -79,15 +79,15 @@
StartTcp = App.activeDocument().Robot.Tcp
t.insertWaypoints(StartTcp)
App.activeDocument().Trajectory.Trajectory = t
print App.activeDocument().Trajectory.Trajectory
print(App.activeDocument().Trajectory.Trajectory)

# insert some more Waypoints and the start point at the end again:
for i in range(7):
t.insertWaypoints(Waypoint(Placement(Vector(0,1000,i*100+500),Vector(1,0,0),i),"LIN","Pt"))

t.insertWaypoints(StartTcp) # end point of the trajectory
App.activeDocument().Trajectory.Trajectory = t
print App.activeDocument().Trajectory.Trajectory
print(App.activeDocument().Trajectory.Trajectory)

# === Simulation ===
# To be done..... ;-)
Expand All @@ -102,5 +102,5 @@
# and thats kind of how its done:
for w in App.activeDocument().Trajectory.Trajectory.Waypoints:
(A,B,C) = (w.Pos.Rotation.toEuler())
print ("LIN {X %.3f,Y %.3f,Z %.3f,A %.3f,B %.3f,C %.3f} ; %s"%(w.Pos.Base.x,w.Pos.Base.y,w.Pos.Base.z,A,B,C,w.Name))
print("LIN {X %.3f,Y %.3f,Z %.3f,A %.3f,B %.3f,C %.3f} ; %s"%(w.Pos.Base.x,w.Pos.Base.y,w.Pos.Base.z,A,B,C,w.Name))

2 changes: 1 addition & 1 deletion src/Mod/Robot/RobotExampleTrajectoryOutOfShapes.py
Expand Up @@ -11,7 +11,7 @@
if edge.Type != 'Part::TopoShape':continue
pos1 = edge.valueAt(0)
pos2 = edge.valueAt(edge.Length)
print pos1,pos2
print(pos1,pos2)
if count==0: # first edge
FirstPos1 = pos1
FirstPos2 = pos2
Expand Down

0 comments on commit 8b5fb47

Please sign in to comment.