Macpod LLC: Forums

General Category => OpenLase Discussion => Topic started by: Fabrice on October 30, 2015, 04:46:46 AM

Title: Level nearly completed ...
Post by: Fabrice on October 30, 2015, 04:46:46 AM
Dear Macpod and all others Lasershark Aficionados !

I have finally succeed in making my green laser projector based on lasershark working really fine under Ubuntu 14.04 ! Thank you very much for all the support that the macpod.net website is offering ...
I would like to go one step further and, sorry for that, i will need your help once again  :)

2 questions haunt me...

-1- I'm totally newbie in the programmation field, I'm starting to learn Python but i'm very curious if discovering the 'tweet.py' application. I have tried to compile it but it does not run properly . Have I miss something ?

-2- I have installed VMplayer under Windows and runs a 10.04 Ubuntu version in order to be able to discover  the Jeremy van Grinsven project (https://github.com/jv4779/openlase-mame (https://github.com/jv4779/openlase-mame)).The main problem is that Ubuntu 10.04 is the last version of Ubuntu which has Xmame. When trying to install jackd2 library 
via "sudo apt-get install libjack-jackd2-dev" system answers that it does not exist ...
I do not want to update the Ubuntu Version because i would then lost the possibility of Xmame ... May I ask you how i should proceed please ?

Thank you very much for your help and your patience? Sorry for writing such a long post  ;)

Have a great day

PS. Can't wait for the laserShark RGB Version ...
Title: Re: Level nearly completed ...
Post by: Macpod on October 30, 2015, 10:40:45 PM
Hi Fabrice,

Glad you got your projector working to your liking.


1. This question is very difficult to answer without output to identify the problem you are encountering.

2. jv4779 modified xmame to support OpenLase. By default Xmame does not support OpenLase. You are going to have to compile jv4779's code.

A fair warning: I did this a while ago and even with proper 30kpps galvos, it was quite choppy and probably overly-complicated for a galvo system. I don't know or have access to many ROMs, but if you do experiment, do so with very simple games like asteroids.
Title: Re: Level nearly completed ...
Post by: Fabrice on November 02, 2015, 03:03:37 AM
Dear Macpod,

Thank you for your fast answer , sorry to be such a lamer but it seems that I have everything to learn ...

May I abuse from your patience once again please ?

1° I have installed the python wrapper for the twitter API. I have done it via
 'sudo easy_install python-twitter' ' 

Then, under the terminel,
'python twitter.py' ' 

The python compiler returns

Traceback (most recent call last):
  File "tweet.py", line 114, in <module>
    search = sys.argv[1]
IndexError: list index out of range

From this point i really need help  ;) i'm trying to learn python but not fast enough it seems ...

2° I understand that Xmame does not natively support Openlase, the main problem comes from the fact that the Xmame package is no more available under the last version of Ubuntu . I do not know how to compile the jv4779's sources under Ubuntu 14.04. jv4779 wrote in the GitHub that Ubuntu 10.04 was the last Ubuntu version with Xmame. I have tried to install openlase under Ubuntu 10.04 (VM player) but the jackd2 library is not available under this ubuntu version  :'(

May I ask you if you remember how you had proceed for compiling the jv4779's sources please ? 

Thank you very much for your help Macpod and sorry to be painful...

Title: Re: Level nearly completed ...
Post by: Macpod on November 06, 2015, 01:30:17 AM
Lets start on question 1. Please read through this fully because there are multiple problems here:

a. 'sudo easy_install python-twitter'
This is not actually the twitter library used by openlase, instead this one is just called "twitter"

I would suggest using pip vs easy_install to install packages:
sudo pip install twitter

b. 'python tweet.py'
This is not the correct usage. You need to specify a twitter search term. This is why you are getting this error:
Traceback (most recent call last):
  File "tweet.py", line 114, in <module>
    search = sys.argv[1]
IndexError: list index out of range

Try running it as:
python tweet.py test

Since you say you want to learn more about programming check out these tutorials which talk more about parsing command line arguments:
http://www.cyberciti.biz/faq/python-command-line-arguments-argv-example/

c. Twitter no longer supports their v1 REST API so even if you did import the right modules and provide the proper command line arguments it would not work. I'll take a look at what is needed to update this tomorrow.

Down the rabbit hole! :)
Title: Re: Level nearly completed ...
Post by: Fabrice on November 06, 2015, 06:12:21 AM
Dear MacPod,

Thank you so much for your help, I can now stop to pull my hair  :)
I have never imagine that the command should be used as you explain... Thank for that Macpod...
I will immediately visit the link you mentionned, and, of course, i say YES to the update you propose as my level in python is increasing really very slowly  ;)

Thank you for your assistance MacPod, have a great day ...
Title: Re: Level nearly completed ...
Post by: Macpod on November 06, 2015, 09:48:42 PM
I have made the bare minimum changes needed to get this running again:

https://github.com/macpod/openlase/blob/master/examples/tweet.py

In order to use this you will need to make a Twitter app:
https://apps.twitter.com/app/new

Once you create this app you will need to modify the source to include your designated API Key and API Secret.

Since tweet.py was first written by marcan it seems twitter.com has exposed a streaming api. This should be used if a new version of tweet.py were to be made.
Title: Re: Level nearly completed ...
Post by: Fabrice on November 07, 2015, 08:22:56 AM
Hi MacPod,
That was it !
it now compiles without error , the goal is very near but please let me ask you one lasr request please ?
The execution of

"python twitter.py test"

gives back the follwing error message

'Api' object has no attribute 'search' Fetch error

I do not have any idea about what that means , it may be a mis understanding of the twitter.py program ...

Really sorry to abuse your kindness MacPod,

Have a great week end


 
Title: Re: Level nearly completed ...
Post by: Macpod on November 07, 2015, 01:15:49 PM
Sounds like it is using the python-twitter api vs the twitter api. You should uninstall the python-twitter api.
Title: Re: Level nearly completed ...
Post by: Fabrice on November 07, 2015, 05:28:29 PM
"python-twitter" has been uninstalled but i still have the same message error when executing

python tweet.py test

Do you still have an idea MacPod ?  :-\
Title: Re: Level nearly completed ...
Post by: Macpod on November 07, 2015, 05:30:18 PM
What version of the tweet api do you have installed?
Title: Re: Level nearly completed ...
Post by: Fabrice on November 08, 2015, 06:04:23 AM
MAcPod,

As you have recommended me, i have used the command

sudo pip install twitter

And I can found in

]/usr/local/lib/python2.7/dist-packages

the following files

twitter  twitter-1.17.1.dist-info

Is it what should be expected ?

Thx MacPod





Title: Re: Level nearly completed ...
Post by: Macpod on November 08, 2015, 09:58:49 PM
1.17.1 is correct.

The fact that it accepted the api = twitter.Twitter(...) line indicates you are using tweet vs tweet-python.. I'm not sure why this isn't working for you with the information provided.

Did you modify the python program?

Title: Re: Level nearly completed ...
Post by: Fabrice on November 09, 2015, 02:12:13 AM
Hi MacPod,

Sorry to bother you, I have re-installed the twitter api once again, modified the code in the following manner

# Access token
#token = ''
# Access token secret
#token_key = ''
# Consumer key
con_secret = 'myvalue'
# Consumer Secret
con_secret_key = 'myvalue'

 and i finally obtain

skappy@skappy-portable:~/Bureau/MacPod/openlase/examples$ python tweet.py test
  File "tweet.py", line 42
    def __init__(self):
      ^
IndentationError: expected an indented block


Can you please help me to understand the meaning of this error message...

May I ask you if I can try a another argument than 'test' in

python tweet.py test

Thank you very much and sorry once again  :-[
Title: Re: Level nearly completed ...
Post by: Macpod on November 09, 2015, 09:32:19 PM
skappy@skappy-portable:~/Bureau/MacPod/openlase/examples$ python tweet.py test
  File "tweet.py", line 42
    def __init__(self):
      ^
IndentationError: expected an indented block


Can you please help me to understand the meaning of this error message...
Python uses spacing at the start of the line to determine when code blocks start and end. It seems line 42 is improperly indented. Spaces are not considered the same as tabs. You will need to update the indentation of this line so the program can run.

https://docs.python.org/2/reference/lexical_analysis.html#indentation


May I ask you if I can try a another argument than 'test' in

python tweet.py test

Thank you very much and sorry once again  :-[
I can use whatever argument I want and it behaves the same.

If it is still installed, you should uninstall python-twitter:
pip uninstall python-twitter
Title: Re: Level nearly completed ...
Post by: Fabrice on November 11, 2015, 01:48:01 PM
Dear McPod,

Today is a GREAT day !!!

I think that i'm as good at photo than at programming but despite the poor quality of the photo i'm very happy to announce you that tweet.py is running fine ...I would like to thanks you very much for your help and your assistance... I can not help but look at the scrolling messages ...

I do not want to abuse your patience and kindness but may i ask one last thing please MacPod ?

May i ask you how i should proceed in order to compile the  jv4779 code please ? I would like to test asteroids game it would remind me great time  ;) I encountered difficulties with Xmame when trying to compile ... I have installed VMplayer under Windows and runs a 10.04 Ubuntu version. The main problem is that Ubuntu 10.04 is the last version of Ubuntu which has Xmame. When trying to install jackd2 library 
via "sudo apt-get install libjack-jackd2-dev" system answers that it does not exist ...

Have a great day,

Thank you for all MacPod,  :)
Title: Re: Level nearly completed ...
Post by: Macpod on November 15, 2015, 11:53:25 PM
Glad you got it working. To compile jv4779's code you should do the following:

To build

Code: [Select]
cd ~/Desktop
mkdir mame
cd mame
git clone https://github.com/jv4779/openlase-mame.git
cd openlase-mame/xmame-0.106

If you have not installed the libopenlase.so library, you will need to specify where it is located:
Code: [Select]
export LD_LIBRARY_PATH=/home/<openlase directory>/build/libol:$LD_LIBRARY_PATH

In the Makefile within the of xmame-0.106 directory make the following changes:
Code: [Select]
Change this line to point to where openlase source is:
OL_DIR = /home/nelsonjm/laser_projector/openlase_macpod/openlase

Change this line:
#CFLAGS = -O2 -mtune=i686 -fomit-frame-pointer -fstrength-reduce -ffast-math
To this:
CFLAGS += -O2 -mtune=i686 -fomit-frame-pointer -fstrength-reduce -ffast-math

Comment out this line (assuming you are running a 64-bit os):
MY_CPU = i386
And uncomment this line:
MY_CPU = em64t

If you want to use a joystick, uncomment this line:
JOY_STANDARD = 1


If you want sounds, uncomment htis line:
SOUND_ALSA = 1

Build it:
Code: [Select]
make

To run:
If you have not installed the libopenlase.so library, you will need to specify where it is located:
Code: [Select]
export LD_LIBRARY_PATH=/home/<openlase directory>/build/libol:$LD_LIBRARY_PATH

Code: [Select]
Copy or link xmamerc that is in ~/Desktop/mame/openlase-mame/ into $HOME/.xmame directory

Update rompath in $HOME/.xmame/xmamerc to point to where your roms are

Start up openlase (ie jackctl, etc)

cd ~/Desktop/mame/openlase-mame/xmame-0.106
padsp ./xmame.x11 asteroid
Title: Re: Level nearly completed ...
Post by: Fabrice on November 17, 2015, 02:52:59 AM
Dear MacPod,

Everything goes well until the 'make' command ... :'(

Terminal returns :

skappy@skappy-portable:~/Bureau/mame/openlase-mame/xmame-0.106$ export LD_LIBRARY_PATH=/home/skappy/openlase/libol:$LD_LIBRARY_PATH
skappy@skappy-portable:~/Bureau/mame/openlase-mame/xmame-0.106$ make
Compiling src/chd.c ...
src/chd.c:13:18: fatal error: zlib.h: Aucun fichier ou dossier de ce type
 #include <zlib.h>                  ^
compilation terminated.
make: *** [xmame.obj/chd.o] Erreur 1
skappy@skappy-portable:~/Bureau/mame/openlase-mame/xmame-0.106$

It seems that it does not find the zlib.h files ...
 :-[ still a little help MacPod ?  :-[

Thank you so much !

---- LAST MINUTE NEWS ---
Magic has operated ...
I have put the 2 missing files in the main directory and compilation starts ...  ;)
But .. that was too easy ...
Terminal finally returns

src/unix/video-drivers/xv.c:14:31: fatal error: X11/extensions/Xv.h: Aucun fichier ou dossier de ce type
 #include <X11/extensions/Xv.h>
                               ^
compilation terminated.
make: *** [xmame.obj/unix.x11/video-drivers/xv.o] Erreur 1

And this time, the Xv.h file is not in the neighborhood  :'( so I still need help MacPod  :-[ :-[

Thx
Title: Re: Level nearly completed ...
Post by: Macpod on November 17, 2015, 10:09:00 PM
If you receive messages concerning missing header files, it indicates you do not have the appropriate developer packages installed on your computer which contain these headers.

When you encounter errors of this type, you will need to identify and install the package which provides these headers. This page describes how to do this:
https://kobablog.wordpress.com/2011/05/17/how-to-find-and-install-the-missing-file-in-ubuntu/

In your case you need to install the following packages (note that packages ending with -dev indicates they include headers generally):
Code: [Select]
sudo apt-get install zlib1g-dev x11proto-video-dev


You should remove the two headers you added to the project folder.
Title: Re: Level nearly completed ...
Post by: Fabrice on November 18, 2015, 01:15:17 PM
MacPod,
I have erase the mame directory from the last installation and start the process from the beginning , installed a new stuff by myself  8) (it was sudo apt-get install libxv-dev)


But now terminal returns ....

(...)
Compiling src/chdcd.c ...
src/chdcd.c: In function ‘cdrom_parse_toc’:
src/chdcd.c:153:8: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
   fgets(linebuffer, 511, infile);
        ^
[OSDEPEND] Compiling src/unix/osd_tool.c ...
Linking chdman...
Compiling src/xml2info.c ...
src/xml2info.c: In function ‘process_error’:
src/xml2info.c:232:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘XML_Size’ [-Wformat=]
  fprintf(stderr, "%d:%s:%s\n", XML_GetCurrentLineNumber(state->parser), tag, msg);
  ^
Linking xml2info...
Compiling src/jedutil.c ...
Linking jedutil...
skappy@skappy-portable:~/Bureau/mame/openlase-mame/xmame-0.106$

Help once again is really welcome  :P

Thx MacPod


Title: Re: Level nearly completed ...
Post by: Macpod on November 19, 2015, 11:49:34 PM
Some warnings are expected. As long as there were no errors you are ok. Looks like it finished compiling successfully
Title: Re: Level nearly completed ...
Post by: Fabrice on November 21, 2015, 07:09:58 AM
Dear MacPod,
the goal is near ...
Terminaly finally returns now

skappy@skappy-portable:~/Bureau/mame/openlase-mame/xmame-0.106$ padsp ./xmame.x11 asteroid
info: trying to parse: /usr/local/share/xmame/xmamerc
info: trying to parse: /home/skappy/.xmame/xmamerc
info: trying to parse: /usr/local/share/xmame/xmame-x11rc
info: trying to parse: /home/skappy/.xmame/xmame-x11rc
info: trying to parse: /usr/local/share/xmame/rc/asteroidrc
info: trying to parse: /home/skappy/.xmame/rc/asteroidrc
loading rom 0: 035145.02                       
loading rom 1: 035144.02                       
loading rom 2: 035143.02                       
loading rom 3: 035127.02                       
done
035145.02    NOT FOUND
035144.02    NOT FOUND
035143.02    NOT FOUND
035127.02    NOT FOUND
ERROR: required files are missing, the game cannot be run.
skappy@skappy-portable:~/Bureau/mame/openlase-mame/xmame-0.106$

I have created a roms directory in /mame/openlase-mame/xmame-0.106/
And i have put asteroid.zip in it (I have also decompress the zip files into this roms directory).

Do you have any idea of what i'm doing wrong Macpod ?

Have a great week end



Title: Re: Level nearly completed ...
Post by: Macpod on November 23, 2015, 11:11:24 PM
Did you modify the following line in your xmamerc file to specify where your rom folder is?:
Code: [Select]
rompath                 $HOME/.xmame/roms
Is your xmamerc file located in one of the locations it was searched for at? I.e.:
Code: [Select]
info: trying to parse: /usr/local/share/xmame/xmamerc
info: trying to parse: /home/skappy/.xmame/xmamerc
info: trying to parse: /usr/local/share/xmame/xmame-x11rc
info: trying to parse: /home/skappy/.xmame/xmame-x11rc
info: trying to parse: /usr/local/share/xmame/rc/asteroidrc
info: trying to parse: /home/skappy/.xmame/rc/asteroidrc

Finally in your rom directory (or a subdirectory), do these files exist?:
Code: [Select]
035145.02    NOT FOUND
035144.02    NOT FOUND
035143.02    NOT FOUND
035127.02    NOT FOUND

What does the rompath directory point to and what is inside of this directory? (use ls -l)
Title: Re: Level nearly completed ...
Post by: Fabrice on November 24, 2015, 12:12:49 PM
Dear MacPod,
Very sorry for been such a pain ...
I do not understanf what is going on ...

I have put the xmamerc file into the .xmame directory, change the rompath with

rompath         $HOME/skappy/.xmame/roms

and here is the path to my roms

skappy@skappy-portable:~$ ls
avirer.py                 examples.desktop  Modèles    Téléchargements
Bureau                    helloworld.py     Musique    test_twitter.py
Documents                 hershey-fonts     openlase   tweet.py
essai_compilation_c       Images            Public     Vidéos
essai_compilation_python  jd2               pylase.so
skappy@skappy-portable:~$ cd .xmame
skappy@skappy-portable:~/.xmame$ ls
cfg  diff  hi  inp  mem  nvram  rc  roms  sta  xmamerc
skappy@skappy-portable:~/.xmame$ cd roms
skappy@skappy-portable:~/.xmame/roms$ ls
034602-01.c8   035143-02.j2   035145-04e.ef2  readme.html
035127-02.np3  035144-04e.h2  asteroid.zip

I'm a bit lost !!!

Thx Macpod
Title: Re: Level nearly completed ...
Post by: Macpod on November 24, 2015, 08:48:39 PM
Quote
rompath         $HOME/skappy/.xmame/roms
This is incorrect. (it is pointing to /home/skappy/skappy/.xmame/roms) It should be:
Code: [Select]
rompath                 $HOME/.xmame/roms






Quote
skappy@skappy-portable:~/.xmame/roms$ ls
034602-01.c8   035143-02.j2   035145-04e.ef2  readme.html
035127-02.np3  035144-04e.h2  asteroid.zip
You need to rename these files to match what xmame is looking for when it tries to run the asteroid game. That is what these lines correspond to:
Code: [Select]
035145.02    NOT FOUND
035144.02    NOT FOUND
035143.02    NOT FOUND
035127.02    NOT FOUND
Title: Re: Level nearly completed ...
Post by: Fabrice on November 25, 2015, 12:22:39 PM
Macpod, please apologize...

I have modified the rompath as you mentionned ,

I have renamed the 4 files as terminal expects

skappy@skappy-portable:~$ cd ..
skappy@skappy-portable:/home$ ls
skappy
skappy@skappy-portable:/home$ cd skappy
skappy@skappy-portable:~$ cd .xmame
skappy@skappy-portable:~/.xmame$ ls
cfg  diff  hi  inp  mem  nvram  rc  roms  sta  xmamerc
skappy@skappy-portable:~/.xmame$ cd roms
skappy@skappy-portable:~/.xmame/roms$ ls -l
total 32
-rw-rw-r-- 1 skappy skappy  256 déc.  24  1996 034602-01.c8
-rw-rw-r-- 1 skappy skappy 2048 déc.  24  1996 035127.02
-rw-rw-r-- 1 skappy skappy 2048 déc.  24  1996 035143.02
-rw-rw-r-- 1 skappy skappy 2048 déc.  24  1996 035144.02
-rw-rw-r-- 1 skappy skappy 2048 déc.  24  1996 035145.02
-rw-r--r-- 1 skappy skappy 7752 nov.  21 11:25 asteroid.zip
-rw-r--r-- 1 skappy skappy  730 mai   19  2014 readme.html
skappy@skappy-portable:~/.xmame/roms$ ^C
skappy@skappy-portable:~/.xmame/roms$

but terminal is still returning

skappy@skappy-portable:~/Bureau/mame/openlase-mame/xmame-0.106$ padsp ./xmame.x11 asteroid
info: trying to parse: /usr/local/share/xmame/xmamerc
info: trying to parse: /home/skappy/.xmame/xmamerc
error: unknown option doublebuf, on line 52 of file: /home/skappy/.xmame/xmamerc
   ignoring line
error: unknown option grabinput, on line 53 of file: /home/skappy/.xmame/xmamerc
   ignoring line
error: unknown option joydevname, on line 62 of file: /home/skappy/.xmame/xmamerc
   ignoring line
error: unknown option lirc, on line 65 of file: /home/skappy/.xmame/xmamerc
   ignoring line
info: trying to parse: /usr/local/share/xmame/xmame-x11rc
info: trying to parse: /home/skappy/.xmame/xmame-x11rc
info: trying to parse: /usr/local/share/xmame/rc/asteroidrc
info: trying to parse: /home/skappy/.xmame/rc/asteroidrc
loading rom 0: 035145.02                       
loading rom 1: 035144.02                       
loading rom 2: 035143.02                       
loading rom 3: 035127.02                       
done
035145.02    NOT FOUND
035144.02    NOT FOUND
ERROR: required files are missing, the game cannot be run.
skappy@skappy-portable:~/Bureau/mame/openlase-mame/xmame-0.106$


I can't understand what is needed, previously 4 files were not found and now only two are still missing...
Title: Re: Level nearly completed ...
Post by: Macpod on December 02, 2015, 12:31:57 AM
Code: [Select]
macpod@computer ~/.xmame/roms $ tree
.
└── asteroid
    ├── 034602.01
    ├── 035127.02
    ├── 035143.02
    ├── 035144.02
    └── 035145.02

1 directory, 5 files

Try re-acquiring your rom files and installing them in your rom folder as above. Once you have done this run the tree command and paste the results here if it still does not work. Something isn't adding up. Either you have accidentally added a space to the names or the files are not actually in the right location.
Title: Re: Level nearly completed ...
Post by: Fabrice on December 04, 2015, 04:51:34 AM
Hi Macpod,
A very big thank for your patience and your support...
A big step was taken ... Putting all the .01 and .02 files into a directory called asteroid in the roms directory allows the game to start ...  :) :) :) but,  ???, it seems that the game could not be started as pressing the '1' key does not launch it ... It would have been to easy isn't it ?
I can read a message on the mame screen warning that a file can be corrupted but Asteroid launch properly, stars and asteroids scroll perfectly.

I have re-check the Makefile within the of xmame-0.106 directory and  the line:
JOY_STANDARD = 1  
is still commented.
Others keys seem to work properly ("pause", "tab",...) .

The goal is close ....
Title: Re: Level nearly completed ...
Post by: Macpod on December 05, 2015, 06:21:55 PM
Did you pay for the game? You need to insert quarters to play. Press the 5 key (insert coint) before pressing the 1 key (start)

Edit: Here is a link to the controls
http://wiki.mamedev.org/index.php/FAQ:Controls

Title: Re: Level nearly completed ...
Post by: Fabrice on December 07, 2015, 03:34:10 PM
Mapod,

Everything runs finally perfectly, i'm very happy !

Building this laser projector is quite an old dream and i would like to sincerely thanks you for all the help you provide to me ... I would never have been able to see sucha nice result wihout your assistance and your patience, so once again thank you ...

Next adventure will be with RGB Lasershark isn't it ?

Have a great day Macpod

 
Title: Re: Level nearly completed ...
Post by: Macpod on December 07, 2015, 10:34:54 PM
Glad you got it working. Please be careful with your galvos as these games can strain them. The galvos should not sound strained when operating. If they do, this is likely to reduce the operational lifespan of the galvos units.