Quick Update - Working on Pi Code Today!!

The more technical aspects of Spirit, and carry-over discussion from Kickstarter updates.
Kevin
Posts: 180
Joined: Tue Jul 28, 2015 12:56 am

Quick Update - Working on Pi Code Today!!

Postby Kevin » Sat Feb 03, 2018 7:00 pm

Hello everyone!! Sorry to be missing for a while there. We got all the units shipped and there were some other things in life I couldn't put off any longer. I'm back in it today. I'll be going through the Pi code and hopefully getting something posted today or tomorrow at the latest. It's been a long time since I looked at the code but it'll all come back to me.

One of the main things that held me up of just posting it, is I wanted to provide a novice level "how to" guide, but that's a whole other thing and some of you have offered to help with this. What I'm going to do is post what I have with some quick instructions that many of you will understand just fine. I'm impressed with how much you all are doing already with essentially zero guidance from me. :)

By default the I2C isn't very reliable due to a known bug in the Broadcom chip they use on the Pi. We can't control this but the I2C code I've written uses some small programmable timing delays to get around this. It works pretty well and will allow you to do almost everything from the Pi that you are able to do from the Arduino processor.

I'll get it out there then hopefully you can help each other a bit with any questions, then we'll try to get back on track of getting a novice level guide together.

Thanks for being so patient everyone. I'm getting much more sense of community on this project than on the others and many of you are really skilled in this so I'm excited for sure.

-Kevin

User avatar
esba1ley
Posts: 58
Joined: Sun Jan 01, 2017 2:15 am
Location: Pasadena, CA
Contact:

Re: Quick Update - Working on Pi Code Today!!

Postby esba1ley » Sat Feb 03, 2018 11:10 pm

Kevin! Welcome back! So glad you had a chance to get a "break."

Let us know how we can help... with a kit as complex as this, you've got folks on this forum with varying skills in all kinds of areas.

Do you have a GitHub repo with the code somewhere? I have my own hackings in a repo here:

https://github.com/esba1ley/SpiritRover

But I'm really hoping for something you put out from which I can fork, and then do pull requests back to you with new stuff.

Have you thought of managing this OpenSource style using GItHub? Anyone else want a setup like that?

-Erik
----------
Erik S. Bailey
Entry, Descent, and Landing Aerospace Engineer
Maker, and Musician
SpiritRover Kickstarter Backer #460

Kevin
Posts: 180
Joined: Tue Jul 28, 2015 12:56 am

Re: Quick Update - Working on Pi Code Today!!

Postby Kevin » Sat Feb 03, 2018 11:16 pm

Thanks to you and the others for your offers to help. I really appreciate it.

I do have a git hub but each time I try to sync to it, it's a massive hassle. There's just nothing easy about it. I eventually get it figured out but it takes a while and a lot of frustration. Just the aspect of pushing out material in a way that is understandable to normal people has always been a challenge. :(

We'll get there eventually.

User avatar
esba1ley
Posts: 58
Joined: Sun Jan 01, 2017 2:15 am
Location: Pasadena, CA
Contact:

Re: Quick Update - Working on Pi Code Today!!

Postby esba1ley » Sat Feb 03, 2018 11:48 pm

I can help with that, too, Kevin. I use Git daily at work, and for managing my own little side projects. Just say the word.
----------
Erik S. Bailey
Entry, Descent, and Landing Aerospace Engineer
Maker, and Musician
SpiritRover Kickstarter Backer #460

User avatar
esba1ley
Posts: 58
Joined: Sun Jan 01, 2017 2:15 am
Location: Pasadena, CA
Contact:

Re: Quick Update - Working on Pi Code Today!!

Postby esba1ley » Sat Feb 03, 2018 11:55 pm

For any of you who want to de-mystify Git, there is a great visualization of the different "spaces" Git manages, and the commands that are used to go between them here:

http://ndpsoftware.com/git-cheatsheet.html

My group at work finds this very useful to jog memories of what to do in certain situations and which commands to use (and why).

The biggest hurdle folks had to realize is that there is a "Local" repo (something that every git setup has) and a "remote" repo that requires syncing (something used only for collaboration and/or backup in case of "local" disasters). The workflow is:

1.) identify a tract-able nugget to work on.
2.) create a branch dedicated to that nugget (isolates you from the main trunk, allowing you to work in parallel)
3.) Develop on the new branch, merging the trunk as it evolves in parallel with you
4.) when you're done, do a pull request to merge your stuff back into the trunk (which everyone else should do, too)
5.) Your stuff gets merged back into the trunk (usually "master" branch).

My company takes it a step further, and has a "devel" branch from which we pull and push, and we only update "master" with legit releases -- that way the development churn doesn't effect the main pulls for users of the code unless there are critical changes or scheduled releases. Having a game plan like this is KEY to preventing chaos in the system... and as usual, it comes down to communication over the tool. (Sorry -- no getting around that!)

Something like GitHub or GitLab adds a social-media type layer to the Git tool, and is really a separate project. Git in and of itself works without those glossy web interfaces that add all kinds of metrics visualization etc.

Back in the day, we used RCS, then CVS, then SVN... Git is WAAAAAAY better. Kudos to Linus Torvalds and his Linux development team for inventing it to manage the parallel development of the Linux Kernel.

-E
----------
Erik S. Bailey
Entry, Descent, and Landing Aerospace Engineer
Maker, and Musician
SpiritRover Kickstarter Backer #460

Kevin
Posts: 180
Joined: Tue Jul 28, 2015 12:56 am

Re: Quick Update - Working on Pi Code Today!!

Postby Kevin » Sun Feb 04, 2018 9:19 pm

Hey everyone.... another quick update here....

If you're a novice then skip over this. For the more advanced users that are eager to get started, here's the plan. I'm still working this today and plan to continue tomorrow. Now that I've got my head back around it, I'm going to at least get to where we have a working framework for everyone to start using.

I've spent the weekend just re-absorbing the overall organization of the code. It's been a year since I really dug into it. Going back to it, it's all coming back to me now but I'm still a bit disoriented as I had a few different directories and versions, various stuff named "test" (which I really try to avoid, but you know it happens).

I'm making up a list of quick start instructions to get WiFi up, get a few packages installed, I2C and SPI turned on, etc.

Then I've got 2 main parts of the Spirit code. One is a python script I wrote a looong time ago that manages the neopixels from one of the Pi pins. Because this pin needs root, I kick it off in the background at boot via a cron entry. I've then got a second script that is included at the top of the user's main python code. Calls to this second script use a socks call in the background to talk to the background process that actually runs the pixels. It does cool stuff like fades and streaks and stuff.

Then I also have a spirit_core.py file, which is the bulk of the functions used to talk to the main board via I2C (the Pi talking to the PIC that is), and also the Pi talking to the Arduino processor via SPI. The only thing we talk to the Arudino for right now is motor control. So motor signals are picked up by the Arduino, which actually runs the motors, and all other functions go to the PIC which of course controls everything else.

I've almost got my head back around it then I'll do some final edits to the spirit_core.py file to make sure all the functions are there. It's probably 95% done and compete as it is.

I think I'll do another gitbook with the setup instructions and release the files via zip I'll just upload to our website.

It sounds like I've got some outside support from the user base here which I really appreciate, and hopefully I can have some help there getting things pushed to our github.

That should at least give everyone a framework and we can continue to document from there.

I also need to document how to use UART on the PIC. It's slightly complicated, but once it's understood it's not bad. (For anyone eager to start playing with UART, have a look at the Arduino code tab with all the communication functions and search it for UART. With a bit of trial and error the advanced users should be able to figure it out).

Then after that we'll start looking at vision options.

Thanks for hanging in there everyone!
-Kevin

User avatar
esba1ley
Posts: 58
Joined: Sun Jan 01, 2017 2:15 am
Location: Pasadena, CA
Contact:

Re: Quick Update - Working on Pi Code Today!!

Postby esba1ley » Sun Feb 04, 2018 9:47 pm

Thanks, Kevin! We're eagerly awaiting the instructions for those of us who are knowledgable-and-fearless... (two of us were ready to start burning to the Arduino via the ISP header until we realized that we weren't selecting the right options from the Arduino IDE!)

I'm going to continue working with my hacked-together python code until you release your code which should hopefully solve my I2c kludges/woes.

I'm hoping to write an automatic panorama taker/stitcher using OpenCV today... which leads me to ask:

How do you want users from the community to contribute code BACK to a common pool for the rest of us to use? This is why I suggested Git earlier...
----------
Erik S. Bailey
Entry, Descent, and Landing Aerospace Engineer
Maker, and Musician
SpiritRover Kickstarter Backer #460

Kevin
Posts: 180
Joined: Tue Jul 28, 2015 12:56 am

Re: Quick Update - Working on Pi Code Today!!

Postby Kevin » Mon Feb 05, 2018 5:09 pm

That's a good question about the community. I'd be open to whatever suggestions you have. I think git is probably best. We prob want to use whatever method would be most comfortable to the most users. Most of the high level code, sharing, and documentation is beyond what I'm familiar with. I can write the low level driver level code to flip pins and design the boards, but when it comes to sticking parts of code together inside linux to do things, that's where I get lost. Which is okay since that's where most other people have the most experience. :)

gpvillamil
Posts: 75
Joined: Fri Jan 26, 2018 5:03 pm

Re: Quick Update - Working on Pi Code Today!!

Postby gpvillamil » Mon Feb 05, 2018 6:54 pm

Thanks for the update!

What I would find incredibly useful is a simple way of sending and receiving strings between the Arduino and the Pi using SPI. It would be straightforward to work up a simple protocol for the Pi to send commands to the Arduino (given my background probably based on OSC or something similar). That way the Pi programs can be relatively hardware agnostic.

Kevin wrote:...

Then I also have a spirit_core.py file, which is the bulk of the functions used to talk to the main board via I2C (the Pi talking to the PIC that is), and also the Pi talking to the Arduino processor via SPI. The only thing we talk to the Arudino for right now is motor control. So motor signals are picked up by the Arduino, which actually runs the motors, and all other functions go to the PIC which of course controls everything else.

...

Kevin
Posts: 180
Joined: Tue Jul 28, 2015 12:56 am

Re: Quick Update - Working on Pi Code Today!!

Postby Kevin » Sat Feb 10, 2018 2:43 am

Good question. I'll post it as a separate topic. (Pi to Arduino via SPI that is).


Who is online

Users browsing this forum: No registered users and 1 guest