GPS sensor gopigo from command line

I did the code here
https://www.dexterindustries.com/GoPiGo/projects/python-examples-for-the-raspberry-pi/example-project-a-raspberry-pi-gps-guided-robot-with-the-gopigo/
but with a changed path (Desktop/GoPiGo/Software/Python/Examples/GPS_Bot/) and it works!

well its says that it recognizes this directory

when I try to make it do something (sudo python gps.py) but it just talks about the directory

I’ve never programmed with the command line, is there a way to adapt this to python? What am I doing wrong? Can you just find directories in the command line?

Hi @ikhouider,

Can you paste the screenshot of the error that you get and also you have said that you have changed the path to Desktop/GoPiGo/Software/Python/Examples/GPS_Bot/ so after changing to this location, can you type ls on the command line and paste the output with your reply.

-Shoban

You technically could do everything you do in the terminal in python, but it is highly unconventional. It would kinda be like using a Volkswagen INA NASCAR race. If you really want to you can look into the is library for Python. Though it would be harder.

If you typed CD to go into the directory and it gives an error about GPS.py, it most likely means there is no GPS.py. You can also type pwd into the terminal to see what directory your in. Like @Shoban said post in the output of GPS.py would be helpful.

This is what I got when I did what you asked.

I’m kind of confused right now but is there a way i could do this in python

You need to type cd before the file path. So you would type it like this:
cd Desktop/GoPiGo/Software/Python/Examples/GPS_Bot/

The cd command switches you to the directory you specify in front of it. Just typing the directory will just produce output on whether it exists or not. I would suggest that you may want to find a quick tutorial on the command line, it’ll make your life much easier! :slight_smile:

I’m so sorry to bother you about something this stupid…
At least now I know that the GPS sensor is working!

Is there a way to program it on python? I can’t find anything…

Thanks again for all the help

Its unable to read sudo python gps.py

Could you expand on program in python? And it’s not a stupid question, It’s fine, that’s what the forums are for. I checked and there is indeed a gps.py in Desktop/GoPiGo/Software/Python/Examples/GPS_Bot/ on raspbian for robots. Are you sure youre in that directory when you run sudo python gps.py? You can also type this command to run it from the home directory: sudo python Desktop/GoPiGo/Software/Python/Examples/GPS_Bot/gps.py

It says thats its unable to access that library…
I don’t know
Thanks so much @graykevinb for all the help you’ve been giving me.
I’m just trying to get the GPS sensor to print its coordinates in python whenever its asked. At first I thought I could link the command line to python or something. That was stupid

I’m now just looking for a way to program this on python. I really don’t understand what commands I can use for this sensor. The only sensor I’ve programmed before is the sound sensor which is totally different then this and I can’t find anything online. I was wondering if you could point me towards a tutorial for this for this grove sensor or any tips or how to acess this library on python

Thanks again @graykevinb and @Shoban for all the help so far :grinning:

You can run terminal commands with os.system("your command") Check out the official wiki by the gps’s manufacturor. Scroll down till you see it talk about using g the raspberry pi and the you go! Have fun! :slight_smile: Is that everything then? Feel free to ask more questions if you need to.

Hi @ikhouider,

Adding on to what @graykevinb has said, we also have a brief explanation on using this sensor here and also a small project on GPS Bot here. You can refer to more of our projects there and let us know your comments.

-Shoban

thanks @Shoban but the code you linked was the same I used before and wasn’t in python.

And thanks @graykevinb I understand the command module now!

I now know how to change the output for google maps Ect. but I just need to make it do what it does in the command module in python.

Is there a way to change that command module to make it in python?
That way I can both get the coordinates and get it on google maps at the same time!

Thanks so much again and sorry for all my questions

No need to apologize. That’s what the forum is for. :slight_smile:

Thanks :slight_smile:

Do you know of any way I can adapt this to python?

Thanks again :smile:

Could you clarify on what you mean by use python?

Be able to access the same library I could access in the command line but in python and print GPS coordinates in python
so i could say

print (GPS_coordinates)

and that would print

like I would make GPS_coordanate a variable that connects to that library… If that makes any sense?
Like in the sound sensor you would

print (something_value)

I may have forgot what that value is called but you get the idea

Gotcha. Look at the code of the GPS example and that’s how you use the GPS in python. U fortunately there is no easier way. :frowning:

Could you expand?
Do I put the exact same thing from the command module in python? Is there a certain way? Or do you just not know?
I’m absolutely hopless on the command module, sorry

It is identical to terminal. So are you just wanting to run the GPS.py python script from another python script?