visose / Robots

Create and simulate ABB, KUKA, UR, and Staubli robot programs.
MIT License
302 stars 127 forks source link

Example with an external axis? #16

Closed robin-gdwl closed 5 years ago

robin-gdwl commented 5 years ago

Hello, was wondering if there is an examle that uses an external axis or positioner. I have not yet understood how the mechanical coupling works and would love to find out.

I am trying to build my own positioner with a stepper Motor (or rather a closed-loop servo) controlled by an Arduino or something similar, but I want to understand the way this plugin handles external axes first. Additionally, Do you have any ideas on how to synchronise a Stepper motor and a robot, with the possibilites of your plugin? Any help would be greatly appreciated.

visose commented 5 years ago

trackExample.zip Attached is a minimal example of moving a robot in a track based on the path. It uses the Bartlett robot library with the KR60 on a track. If you download this library the track might be commented out on the .xml, you'll have to remove the <-- and --> lines.

It moves the robot to keep it aligned with the targets in the direction of the track. You usually would not want to do this as moving the whole robot on every target less desirable that getting close and then moving the rest of the joints to reach a target (since it uses more energy, slower speed/ramping, less precision).

robin-gdwl commented 5 years ago

Thanks a lot, will try it out.

visose commented 5 years ago

The previous reply was written before you added the body of your comment. Regarding a positioner, you will use it in a similar way (the external input will be radians rather than millimeters). You can enable kinematic coupling using the 'create frame' component. The frame (and targets attached to it) will move/rotate together with the positioner. If you have a single robot with the positioner as the only external axis, both inputs G and M should be 0.

visose commented 5 years ago

I understand you want to connect a motor as an external axis to the robot controller so that the controller's computer synchronizes it with the rest of the joints taking its dynamics into account and so on. I've only done this with motors that are sold by the robot manufacturer as external axis compatible. This makes the integration a lot easier, but they are expensive. There are ways to synchronize a separate servo that comes with its own controller, but i would avoid this if you can as i think it's adding unnecessary complexity (unless you're doing something like moving a gigantic track that the robot controller wouldn't be able to handle). In any case this will only be possible with servos, not with stepper motors (saying closed loop servo is probably redundant).

robin-gdwl commented 5 years ago

I understand you want to connect a motor as an external axis to the robot controller so that the controller's computer synchronizes it with the rest of the joints taking its dynamics into account and so on.

THis is correct

My use case is fairly simple: I need infinite rotation on the last joint of the robot. To do this I was thinking of adding a DiY version of a rotary table similar to this one to the flange of the robot (a Universal Robots UR5): https://3l4sbp4ao2771ln0f54chhvm-wpengine.netdna-ssl.com/wp-content/uploads/2018/04/Zero-backlash-servo-rotary-indexing-table-from-Sankyo-Automation-1024x553.jpg

As you have already stated this will add a lot of complexity, especially when it comes to trajectory planning and my knowledge of programming is limited. I may have to solve this completely differently....

robin-gdwl commented 5 years ago

I am getting errors when trying to use your example: Track external axis not configured on this target where/how do I have to configure it ? Happens here : https://github.com/visose/Robots/blob/0890adec29a2accee9b3bd5d371a0d259a264a1d/Robots/External.cs#L44

visose commented 5 years ago

Ah, sorry, you have to also comment out or delete the positioner, which is the next mechanism after the track. If you want to make it work with both enabled, you have to input two numbers to the E input (as a string of two numbers separated by a comma), rather than one as it is right now.

robin-gdwl commented 5 years ago

Do you see a track when you enable the preview of the 'load robot system' component?

Yes, it is there, however the robot is shifted relative to the track and not directly on it image

Im guessing that my Bartlett.XML-library is different from yours. The robot cell is also just Bartlett-KR60 as Bartlett-KR60 on Track is not in my XML.

visose commented 5 years ago

The whole robotcell should look like this:

<RobotCell name="Bartlett-KR60 on track" manufacturer="KUKA">
<Mechanisms group="0">
  <RobotArm model="KR60-HA" manufacturer="KUKA" payload="60">
    <Base x="0.000" y="0.000" z="0.000" q1="-0.707107" q2="0.000" q3="0.000" q4="0.707107"/>
    <Joints>
      <Revolute number="1" a ="350" d ="815" minrange = "-185" maxrange ="185" maxspeed ="128"/>
      <Revolute number="2" a ="850" d ="0" minrange = "-135" maxrange ="35" maxspeed ="120"/>
      <Revolute number="3" a ="145" d ="0" minrange = "-120" maxrange ="158" maxspeed ="128"/>
      <Revolute number="4" a ="0" d ="820" minrange = "-350" maxrange ="350" maxspeed ="260"/>
      <Revolute number="5" a ="0" d ="0" minrange = "-119" maxrange ="119" maxspeed ="245"/>
      <Revolute number="6" a ="0" d ="170" minrange = "-350" maxrange ="350" maxspeed ="322"/>
    </Joints>
  </RobotArm>

  <Track model="KL1000-2" manufacturer="KUKA" payload="1000" movesRobot="true">
    <Base x="0.000" y="0.000" z="0.000" q1="1.000" q2="0.000" q3="0.000" q4="0.000"/>
    <Joints>
      <Prismatic number="7" a ="881.6" d ="480" minrange = "0" maxrange ="10000" maxspeed ="1890"/>
    </Joints>
  </Track>

</Mechanisms>
<IO>
  <DO names="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16"/>
  <DI names="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16"/>
  <AO names="1,2,3,4"/>
  <AI names="1,2,3,4"/>
</IO></RobotCell>
robin-gdwl commented 5 years ago

Now it works, thanks a lot. I will have to rethink my whole setup to figure out if an external axis is the right way to go or if I have to use other means to get the robot to move like I need it to. Thank you for your quick and helpful response.