Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Pi3 - Running accessing python .py program/file from within Retropie? Servosix  (Read 9574 times)

0 Members and 1 Guest are viewing this topic.

subz

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:September 15, 2017, 04:55:05 pm
  • I want to build my own arcade controls!
Pi Model: 3
RetroPie Version Used: 4.02
Built From: (Pre made SD Image on RetroPie website)
Controller used: Tht 2 player/ xin-mo 20 pin usb to jamma

Hello, I am building an upright arcade cabinet with the pi 3 and retropie.
I would like to auto-rotate the monitor with a servo depending on the games orientation.

My goal is to auto-rotate the screen depending on orientation from within retropie.

I would like to navigate to the servo.py python program from
/home/pi/RetroPie/roms/arcade/romname.zip.cfg

This .cfg is what i have used to rotate the pi picture 90 degrees per rom and I know retropie definatly 'reads' from this file as it loads the rom.

I have little /no programing expierience I know the redirect is possible but I dont know
how to get there.

I have the monk makes servo controller for raspberry pi
https://www.monkmakes.com/servo-kit/

If I quit out retropie with f4 I can control the servo by navigating to the files and running the python .py file/program.

Is it possible to open/run a .py file/program from within retropie and from the rom.zip.cfg file? then return to open the rom
Also when exiting a game i need retropie to read and run a reset to landscape .py file to correct the orientation of the menus/gameslist?
Im not sure where this should go?

I know theres many programs like mrotate that are pc based for the job, are there any that are compatible with the pi 3

Any advice will be appreciated
Thanks
« Last Edit: November 25, 2016, 05:47:08 pm by subz »

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
I think this is possible, and I did a test setup.
Look through my posts on here, it's been a while so I will have to go back and re-study how I did it.
I never got past the test stage.

subz

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:September 15, 2017, 04:55:05 pm
  • I want to build my own arcade controls!
This is an update to my previous post in response to a p.m.
"... have you found any way to make possible the rotation call from retropie?   cheers"

Yes it is possible. Its not easy, quick or clean.

I will explain how, and my reason it was not good for me, hope it helps someone out.

I am not an expert in python, linux or programming but I had a problem to solve.

I was running a rpi3 an the sevosix controller board that connects to the gpio on the pi.
the board reads python code to work. .py

First you need to add an extra tab to the carousel in retropie where the consoles show up.
Follow these instructions.
https://weekendengineer.wordpress.com/2014/09/15/adding-an-apps-tab-in-emulationstation/

Then on the new tab called rotate put 2 small .sh programs
located where the test probram is in the instructions.
These .sh programs are links to run your .py program to rotate 0 or rotate 90.

make rotate0 rotate90 executable in the es file manager
with advanced chown rwx rwx rwx

I havent included any code because your setup will be different from mine.

I had this setup and working with a test sevo on the bench
the reason I decided against this system was :-

Your looking at your at your retropie menu, you will have to navigate to a new tab, rotate the monitor 90 deg
now you will have to navigate to your game with the text and picture still in landscape.
start the game having added rom.zip.cfg to rotate the picture. only works with lr cores.
when you exit the game you will have to navigate back to the rotate tab with the picture landscape and rotate the monitor back to horizontal.

In my opinion this was way too clunky a method of operation.

I decided to that full automation was not the way for me. so opted for a latching switch method.

I used the sparkfun servo trigger, this is a great easy to use product one board, power in, switch in, output to servo, two position to set the servo at,
perfect for a rotation monitor setup.

https://www.sparkfun.com/products/13118

This is working for me right now.

There is another method i found that could possibly operate a servo. I HAVE NOT TESTED this option out
it might be perfect for someone.

In retropie you can do a runcommand -onstart runcommand -onend
to run a program at the start or when exiting a rom.

https://retropie.org.uk/docs/Runcommand/#runcommand-onstart-and-runcommand-onend-scripts

Hope this helps someone.
Thanks

 

« Last Edit: September 15, 2017, 04:53:36 pm by subz »

takoni

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 15
  • Last login:February 07, 2019, 07:13:17 am
  • I want to build my own arcade controls!
thanks so much!! I am working in the 3 option, (runcommand -onstart runcommand) to run a sh that launch 3v over GPIO to tell Arduino to rotate 90, when you push ESC to exit any game it rotates 0 the monitor.... i wil notice you about my progress. thanks

takoni

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 15
  • Last login:February 07, 2019, 07:13:17 am
  • I want to build my own arcade controls!
I have got to launch rotation from retropie, atrack mode using the run command-o start.sh

Here is the script , when a Rom is vertical it launch a python file that launch HIGH to gpio

Then arduino listens the GPIO and rotated the monitor.

takoni

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 15
  • Last login:February 07, 2019, 07:13:17 am
  • I want to build my own arcade controls!