visose / Robots

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

Added postprocessor for Fanuc robots (LS Format) #267

Closed AngelLM closed 8 months ago

AngelLM commented 8 months ago

This pull request adds a postprocessor for Fanuc robots.

I tried to follow the same code structure as the rest of the existing robots, but Fanuc robots have their peculiarities and I had to do some free styling on this:

The generated LS code has been tested on a real robot (M-20iB/35S with R-30iB Plus controller) to check that it works correctly.

AngelLM commented 8 months ago

I haven't said anything about the World coordinate base. Reviewing the Fanuc XML file before making the Pull Request to the libraries branch I have seen that you can define the World base there, so it isn't necessary to add it in grasshopper.

visose commented 8 months ago

Hola Angel,

Nice work, it must have been a bit of a pain to understand the spaghetti code required to add a new manufacturer.

This plugin tries to stick to the same conventions regardless of robot manufacturer and I think some of the peculiarities you mention can be addressed. I'd like to request if you could make these changes before merging:

AngelLM commented 8 months ago

Hello!

The truth is that at first I was a bit overwhelmed because it had been a long time since I worked with C#, but the way you have everything structured has helped me a lot to understand how the addon works!

Back to the changes:

visose commented 8 months ago

When the DeltaTime is 0, there is a constant variable called maxTranslationSpeed with a value of 1000, which is used to calculate the percentage of the maximum articular speed of the robot. Why this value is 1000?

This is an arbitrary value, there could be a better way to handle this. DeltaTime 0 can happen in two instances:

  1. Two consecutive targets in the same position. If you set the speed to 0 because deltaTime is 0, it could make the robot not move to the next target, any speed higher than 0 would do (the logic in this case could also be to use the speed of the previous target, for example).
  2. The first target. This is more tricky because when you start a program, the robot it will move from wherever it is in real life to the first target, but the plugin doesn't know where the robot is in real life, so it cannot calculate a delta time. In this case it uses 1000 mm/s as 100% speed, so if you set the speed of the first target to 250 mm/s it will move at 25% speed.
visose commented 8 months ago

I did the same with the Fanuc models and changed in the XML the distance values. I tested it and it works

Can you confirm the robot in real life adopts the same position as in the simulation? By changing only the XML and not the post processor, I would assume the simulation now looks like it's moving to targets that are at a lower position relative to the robot than in real life.

AngelLM commented 8 months ago

I have double checked it, because I had the same concern, but the points are placed where they should be.

Calbaterra commented 7 months ago

Hi @AngelLM,

I'm in the process of acquiring a FANUC LR10iA/10 robot. I attempted to use the solution you've implemented, but encountered the following message While I understand that you haven't implemented support for the specific FANUC robot I'll be using, I still wanted to give it a try to see if it would work with FANUC (TPE).

Screenshot_2

AngelLM commented 7 months ago

Hello @Calbaterra,

Which version of Robots plugin are you using? If you are using the released version it may not contain the support for Fanuc robots (lastest release was 1.6.7 on Jan 8). So I think that you can build yourself the plugin or wait until @visose releases a new version that contains the Fanuc support.

However, I think this topic should be addressed in an issue.