abb rapid simulator

576 views
Skip to first unread message

michele....@gmail.com

unread,
Nov 12, 2014, 4:56:15 PM11/12/14
to swri-ros...@googlegroups.com
Hi all,

In the past I have write a "compiler" for abb rapid language able to manage more or less all the rapid grammar.

the standard library is not completed but if someone want to use and extend that it can be downloaded from


best regards

Shaun Edwards

unread,
Nov 12, 2014, 5:12:38 PM11/12/14
to swri-ros...@googlegroups.com
Michele,

We use ABB robots and program quite a bit in RAPID.  I'm not sure I understand the use of your library.  Does it generate/compile RAPID code into python or simply check syntax?  I apologize if this is a dumb question.

Shaun

--
You received this message because you are subscribed to the Google Groups "swri-ros-pkg-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swri-ros-pkg-d...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

michele....@gmail.com

unread,
Nov 15, 2014, 10:29:33 AM11/15/14
to swri-ros...@googlegroups.com
For now you can test syntax but also logic of your rapid code without use any abb robot or abb simulator.

for now you can execute your rapid code on any pc.
If someone want, and have time, it is possible to integrade this with, for example, freeCAD and try to simulate also the robot move.
Message has been deleted

Michele Dionisio

unread,
Nov 23, 2014, 10:37:50 AM11/23/14
to jelle feringa, swri-ros...@googlegroups.com
Hi,

I have to investigate way. Is years that i don't works on that project.
When I will find time I will check.

there is some regression indroduced in the last checkin. if you go to checkin 
[ADD] better identification of error position

your test works.

But I have to investigate.

to summarize.
The project is able to  -> create an AST from rapid language

than there is 2 visitor of the AST -> 1. rapid2rapid that visit the AST and generate python code
                                                         2. rapid2py than visit the AST and generate python code (the python code generated need som library defined in run directory to works)

create rapid code from python code in another story. You need to convert python AST to rapid AST. And this is not easy.

feel free to write directly to me for any question. If you want to work with me on that project I will be happy to give you access to the repository.

regards


2014-11-23 12:13 GMT+01:00 jelle feringa <jellef...@gmail.com>:

Hi Michele,

This is a wonderful contribtion.
I understand that pyrapid is not only a parser ( unit testing RAPID code, huzaah! ) but also a python generator from RAPID code.
The file "rapid2py.py" hints at that but also the "Palletizer" directory.

When viewing the Palletizer/maintask.mod hints at this:

MODULE MAINTASK
!python rapid2py.py -i Pallettizer/schema.mod -s -f schema.py
!python rapid2py.py -e MAIN -i Pallettizer/settings.mod -i Pallettizer/gloadschema.mod -i Pallettizer/schema.mod -i Pallettizer/maintask.mod -f pallettizer.py -r

When running the "python rapid2py.py -i Pallettizer/schema.mod -s -f schema.py" command, I can generate a schem.py in the run directory.
However, when running the 2nd command, "python rapid2py.py -e MAIN -i Pallettizer/settings.mod -i Pallettizer/gloadschema.mod -i Pallettizer/schema.mod -i Pallettizer/maintask.mod -f pallettizer.py -r", I do get the following error:

$ python rapid2py.py -e MAIN -i Pallettizer/settings.mod -i Pallettizer/gloadschema.mod -i Pallettizer/schema.mod -i Pallettizer/maintask.mod -f pallettizer.py -r
PARSING: ./default/standard.sys
Traceback (most recent call last):
  File "rapid2py.py", line 1368, in <module>
    attriblist += parser.parse(text, fname, debuglevel=0).module_list
  File "/Users/jelleferinga/GIT/pyrapidparser/rapid_parser.py", line 105, in parse
    return self.rapidparser.parse(text, lexer=self.rapidlex, debug=debuglevel)
  File "/Users/jelleferinga/miniconda/lib/python2.7/site-packages/ply/yacc.py", line 265, in parse
    return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
  File "/Users/jelleferinga/miniconda/lib/python2.7/site-packages/ply/yacc.py", line 1047, in parseopt_notrack
    tok = self.errorfunc(errtoken)
  File "/Users/jelleferinga/GIT/pyrapidparser/rapid_parser.py", line 1443, in p_error
    self._coord(p.lineno))
  File "/Users/jelleferinga/GIT/pyrapidparser/plyparser.py", line 54, in _parse_error
    raise ParseError("%s: %s" % (coord, msg))
plyparser.ParseError: ./default/standard.sys:1: before: "0" near charapter 1

I'll try to look into this.
To be frank, I've had a failed attempt at doing the *exact* *same* thing ( writing a RAPID parser in ply / python ), so this is much appreciated.

 
For now you can test syntax but also logic of your rapid code without use any abb robot or abb simulator.

That's great.
Could you provide a bit of context for this project?
My guess would be that pyrapid was used for testing RAPID code?
( to provide some background: testing RAPID code is basically running a simulation in RobotStudio, so really, the concept of unit testing robot code even in a sophisticated offline software as RobotStudio really doesnt exist )
 
Michele, I have a question: what would it take for pyrapid to become round trip?
By that I mean 

python rapid2py.py some.mod | py2rapid.py some2.mod

diff some.mod some2.mod | wc -w

       0

Being able to generate RAPID code from python would be powerful.
If that generated RAPID code is isomorph to the original RAPID code that the python code was generated from, well, that would be something ;)

for now you can execute your rapid code on any pc.
If someone want, and have time, it is possible to integrade this with, for example, freeCAD and try to simulate also the robot move.

Hi I'm someone ;)

So, I've been developing an offline robotics package in python, on top of PythonOCC ( freecad is built on top of OCC too, and can be used to extend FreeCAD's scripting capabilities ).
So, the work-in-progress name for this software is PyRAPID too ;)
I've been working with it in Italy too..., experimenting with cutting marble.








Michele Dionisio

unread,
Nov 24, 2014, 4:12:00 PM11/24/14
to jelle feringa, swri-ros...@googlegroups.com
Problem fixed. You can try to download the last one.

mikal...@gmail.com

unread,
Dec 25, 2017, 10:02:16 AM12/25/17
to swri-ros-pkg-dev
Hello Michele.
I'd like to exp[lore the use of your work to parse RAPID.  
Downloaded the project, but on first attempts to run anything I encountered some problemas.
Where do I find rapid_ast? 
Thanks,
Mikal

Michele Dionisio

unread,
Dec 25, 2017, 6:54:41 PM12/25/17
to swri-ros...@googlegroups.com
Hi,
you need to use python 2 and ply installed (http://www.dabeaz.com/ply/)
the go in the root folder and execute the first time:

python _ast_gen.py
(please update the repo to the last version I commit a fix just 2
minutes ago to work with new version of ply)

to generate all the "missing" files

the you have all.
2 usefull programs are:
rapid2rapid.py to read a python file, parse it and regenerate
the rapid code from the syntax tree
rapid2py.py to read a python code and generate python.

Pallettizer is an example of rapid program that can be executed.
in that case if you open Pallettizer/maintask.mod you can see how to
create the python code

python rapid2py.py -i Pallettizer/schema.mod -s -f schema.py
python rapid2py.py -e MAIN -i Pallettizer/settings.mod -i
Pallettizer/gloadschema.mod -i Pallettizer/schema.mod -i
Pallettizer/maintask.mod -f pallettizer.py -r

If you have same specific issue I can try to help your. If you have
enery to contribute I will be happy.

regards
Michele
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "swri-ros-pkg-dev" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/swri-ros-pkg-dev/98MnwSNLz8o/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
Reply all
Reply to author
Forward
0 new messages