Close
0%
0%

PiTrac - The DIY Golf Launch Monitor

Launch monitor using low-cost Raspberry pi and camera hardware to determine ball launch speed, angles and spin

Similar projects worth following
The PiTrac project is a fully-functional golf launch monitor that avoids the need for expensive high shutter-speed and high frame-rate cameras. We've developed techniques for high-speed, infrared, strobe-based image capture and processing using cameras such as the Pi Global Shutter camera (~US$50 retail) and Raspberry Pi single board computers.

PiTrac determines ball speed, launch angles, and spin in 3 axes. Its output is accessible on a stand-alone web app. Interfaces to popular golf-course simulators including GsPro and E6 are working. 2k/TopGolf never responded to our requests.

See the Project Log (https://hackaday.io/project/195042-pitrac-the-diy-golf-launch-monitor#menu-logs) for the latest news, especially a comparison against a commercial LM!

We are releasing the project as open-source--3D printed enclosure first and software next: https://github.com/jamespilgrim/PiTrac.

Please consider supporting the PiTrac project here: https://ko-fi/PiTrac.

Overview

One of the goals has been to use this project as a learning platform.  So far, we’ve been able to explore all sorts of software and hardware that we hadn’t worked with previously, including new technology, techniques, libraries, and platforms.  This has also forced us to spin up on our linear algebra again.  

Technologies

Some of the technologies in use so far are:

The software is written almost entirely in C++, with the goal of having the codebase look close to commercial standards in terms of testability, architecture, and documentation.  There are some utilities (for functions like camera and lens calibration) that were easier to implement in Python and/or Unix scripts.  

NOTE:  Raspberry Pi is a trademark of Raspberry Pi Ltd.  The PiTrac project is not endorsed, sponsored by or associated with Raspberry Pi or Raspberry Pi products or services.

Cost

We’d like to have the entire system cost less than US$300. We're currently over-budget by about a hundred dollars, but have plans that should bring that price down.  For example, the new Raspberry Pi 5 should be able to support both of the system cameras, which could decrease the price by around $50 by avoiding a second Pi.

The high-level parts list at this time:

Additional Project Videos (see the full set on our youtube channel):

First DIY LM Enclosure 2.jpg

Prototype LM Enclosure

JPEG Image - 4.34 MB - 10/01/2024 at 19:48

Preview

  • When are y'all going to release the darn C++ source code?!

    James Pilgrim6 days ago 1 comment

    A fair question.  We're working on it!  A couple folks have asked - what's taking so long?  So, we figured we'd provide a couple examples of the stuff we are having to do now.  Which to be fair, probably should've been done a while ago.  But in any case...

    PiTrac has interfaces to a couple of golf simulators as well as a multi-threaded socket-based framework to connect to future systems.  Which is great!  But those interfaces also introduced an issue as we're preparing to release the code.  Turns out some of the interfaces use 'secret' codes that are specific to each launch monitor vendor -- which now includes PiTrac.  Those codes have to be protected because of the NDA that allowed us to interface to those systems in the first place.

    The decision has been to put the code around the key exchange in a separate object file or link library that will be distributed with the rest of the source code.  So far, so good.  But it turns out, the keys (and some related information) could still be discernable by a determined person by various de-compiling tools and other techniques.  Thus, we need to obfuscate (essentially encrypt) the data strings in the object file that will contain the proprietary information.  Not too hard - there's C++ packages for that, so ok.  But, then it turns out that the obfuscation code doesn't easily work in a multi-threaded environment (long story), and yes--of course--the simulator interface is multi-threaded.  So, we're working on that.  Of course, it will entail additional testing with the third-party golf simulators, which also takes time.

    Anyway, that's one example of some of the work going on right now.  :/

    Other work has been related to making it easier for the average--ish person to build PiTrac.  For example, we have been working to move to a different, standard version of the Gnu compiler that is currently being packaged with the Raspbian Pi Operating System (Version 12.2.0).  Until recently, we've been relying on C++20 or later versions of the compiler for all our projects, including PiTrac.  But we've recognized that having to compile your own compiler just to get a more modern development platform is not an easy task.  So, we've spent some time porting some our more-recent C++ code and libraries back to the version of the compiler that is currently distributed with the Pi O/S.  Which also involves more testing, of course.

    Still, despite all of this, it's still a great project to work on!

  • What Is PiTrac? And What Is NOT?

    James Pilgrim12/17/2024 at 19:50 1 comment


    PiTrac(*) - What is it?  And What is it Not?

    Yes, of course - PiTrac is an open-source golf launch monitor that you can build yourself, that you never need to pay a subscription for, and–if you’re willing–that you can add your own features to.  But, it’s more than that, and we wanted to let folks know what it’s all about.

    PiTrac is just a starting point of a DIY launch monitor to jump off from.  It’s a starting line, not a finish line.  We hope it can act as a seed that will grow further innovation.  It’s still early in its development.  We don’t even have left-handed golfer support yet. :/

    PiTrac is a fun build journey.  By building one of these systems, you’ll push yourself through 3D printing, soldering, scripting, large(ish) software system build tools, linux utilities, web-based systems, interprocess communications, and maybe even some coding. PiTrac is a project that is sufficiently complicated and uses enough technologies that it can be a great learning platform.  If someone with few tech skills (but enthusiasm and a willingness to learn new things) took on building a PiTrac, they would come out the other end with a pretty good introduction to everything from 3D printing to Linux to building custom hardware.

    PiTrac is something you can build without a full stable of equipment.  We’ve tried to design things so that, for example, you can 3D print the parts on the type of small-bed 3D printer you can find at many public libraries nowadays.  There’s only a single custom PCB part that you can generally have fabricated for a couple dollars and no surface mount chips or other things that need specialized equipment.  All of the third-party software relied upon by the system is free.

    PiTrac is a photometric-based system.  We think that ball spin is pretty important from a ball-flight physics perspective.  Which is why we built a photometric system, not a radar-based system.  Some radar systems appear to work decently for spin, especially if you add little stickers to the ball, but we thought a photometric system would have the best potential for really accurate spin analysis.

    PiTrac is an aggregation of several sub-projects.  Even if you’re not into golf simulation, we hope that at least some parts of the code will be helpful.  Maybe you just need a 3D model for a gimbal mount for a Raspberry Pi camera?  Maybe you’re a photographer into nichey high-speed droplet pictures and just want software that can trigger a flash and a camera shutter?  We hope there’s something here for you.

    We also hope that the open-source nature of the system will promote a better understanding of the precision and accuracy of these types of simulated sports systems.  If a few other engineers can get interested enough to pick apart the current system’s shortcomings (there are many!:) and work to publish testing results, folks can get to know exactly how close the simulation is.  And hopefully work to improve it!  That sort of information isn’t really available in detail from current manufacturers.

    Finally, we believe PiTrac is a tiny part of a quiet grassroots innovation movement of folks who want to build and control their own technology.  Even complicated tech!  Specifically, it’s a little push-back against a world where a lot of tech is available only from large organizations and where no one knows how the tech they rely on works, let alone how to build it themselves.  A gentle nudge against products that originally cost quite a lot to design and build–and were priced accordingly–but whose high retail prices have not kept up with the progression of technology.  A dream that building your own (possibly clunky) device is more satisfying than just buying that device, especially if it’s otherwise financially out of reach.  And we’re pretty sure that the growing number of hackerspaces, fablabs and makerspaces and...

    Read more »

  • GitHub Public Repository Now Online!

    James Pilgrim12/17/2024 at 19:48 1 comment

    The public GitHub Repo is now up here:  https://github.com/jamespilgrim/PiTrac.   All of the designs for the 3D parts and the custom Connector Board PCB as well as most of the draft documentation are there.  Please consider starring it!

    We never did hear back from the GitHub folks about what (if anything) was wrong with the original PiTrac-specific site. 

    If you're looking to see what building a PiTrac is going to entail, you can start at the overview document here.  

    Although we're still working to get the software finalized and pushed out, preliminary instructions on how to get the Pi computers ready to build that software is here.  

    Please let us know any feedback you have, especially any mistakes you see!

  • PiTrac Physical Enclosure Models Completed - New Video

    James Pilgrim12/09/2024 at 19:56 0 comments

    The 3D models are finalized, and we've gone through the internal build instructions to try to make sure they are correct.  We're still waiting on a #github problem, however. The new site was flagged for some reason.  It's been 9 days, but we understand the tech-support folks at github are a little underwater right now.  If it doesn't get fixed soon, we'll just switch to the old site.

    In the meantime, here's a goofy video of the final (for the first release, at least) PiTrac enclosure.

  • Rebranding to PiTrac (well, we never actually had a brand in the first place...;)

    James Pilgrim11/30/2024 at 18:29 0 comments

    We are rebranding the DIY LM to PiTrac !

    The new platforms (which should be permanent going forward) are:

    Reasons for the change were to try to make the project look a little more professional, memorable, and to make it less personal to the original authors.  We'd like this project to move forward with contributions from others, so we thought this would help signal that it's not just one or two folks involved.

    As usual, we'd appreciate any feedback!

  • Hardware Design Release (and PCB availability)

    James Pilgrim11/30/2024 at 17:42 0 comments

    We've released the schematics, PCB layout, and other design artifacts for the small amount of custom hardware currently used by PiTrac.  See github, here.

    On a related note, if anyone is planning on building their own PiTrac DIY LM, we have a few already-manufactured PCB boards in the Maker-Lab.  The first few people to private-message us here on Hackaday.io have the exciting opportunity to purchase a PiTrac Connector Board for US$1 plus whatever shipping is necessary to get where you exist. 

  • First (Tiny) Github Release - Would Appreciate Any Feedback!

    James Pilgrim11/25/2024 at 18:49 1 comment

    We're working to get our processes in order to release the components of the DIY LM into the wild on github.  Being noobs at this, we're still not exactly sure which artifacts will be necessary for folks to productively make use of (and hopefully someday contribute to!) the project's work product. 

    To that end, we just put up a small  sub-component of the physical enclosure of the LM here:  https://github.com/jamespilgrim/Pi-Camera-Light-Filter-Holder.  Frankly, releasing the software code is still a little bit off in time.

    We'd appreciate any feedback on this, as we'd expect to release the rest of the enclosure with approximately the same file types and documentation.  If we're doing something that the community doesn't expect, it would be great to know now before we set everything up.

  • Please Help Support PiTrac (the DIY LM Project)!

    James Pilgrim11/22/2024 at 00:36 0 comments

    Consider supporting the project here: https://ko-fi.com/PiTrac

    Please and Thank You! 

  • Theory of Operation

    James Pilgrim11/22/2024 at 00:30 0 comments

    We love that everyone wants to know how it works! :) Here's an overview of how the DIY golf launch monitor operates. Please leave any questions in the comments and we'll try to answer them!

    Also, please consider supporting the project here: https://ko-fi.com/jamespilgrim

  • Inside the DIY Launch Monitor

    James Pilgrim11/20/2024 at 23:31 0 comments

    Folks have asked about what's inside the DIY LM.  Here's a short video that shows off the major components.

    We're expecting to release the 3D model for the enclosure soon.  It will be compatible with the great new FreeCad 1.0 system.

View all 29 project logs

Enjoy this project?

Share

Discussions

hansenf8 wrote 12/14/2024 at 00:35 point

can’t wait to build one and give it a spin, when can we expect to see everything being released? 

  Are you sure? yes | no

Ometry wrote 11/19/2024 at 21:25 point

Is your data sent as raw data? So it would be able to be read in real-time for each shot. That would be very cool to send directly to something like UE5. I don't think any other launch monitor lets you get that kind of data right now

  Are you sure? yes | no

James Pilgrim wrote 11/22/2024 at 00:49 point

Fairly raw - the data is sent using ActiveMQ.  ActiveMQ is an open-source message broker from Apache.  It supports a bunch of different wire protocols, so the LM should be able to talk to just about anything.  For example, the native LM's user interface is uses JMS (java messaging service) to talk to the LM. The DIY LM also supports sending shot data (and a few other messages) to certain golf simulators like E6 and GSPro.  Those systems are somewhat proprietary, but the data is out in the open, unencrypted.

  Are you sure? yes | no

Ometry wrote 11/22/2024 at 18:30 point

That's great news since unreal has a MQTT Plugin which should work fine with ActiveMQ. If you could send me an example message and its result in a sim, not exact just distance and height maybe, I build something quick I want to try out

  Are you sure? yes | no

JesperPed91 wrote 10/25/2024 at 07:02 point

Great stuff, looking forward to following future updates! enjoyed going through what you have done so far

  Are you sure? yes | no

cody wrote 10/21/2024 at 01:16 point

I can’t wait for this! I never could justify the crazy cost of monitors. I also don’t want to compromise with a Doppler monitor. Solid work! I’ll be following 

  Are you sure? yes | no

mp wrote 10/18/2024 at 15:23 point

Nice job!  Fun project.  The golf world could really use some open source projects to build on.

  Are you sure? yes | no

jjerome80 wrote 10/04/2024 at 13:41 point

Awesome project! Hopefully we can get a chance to build and test this project! 

  Are you sure? yes | no

mikeclowe wrote 09/14/2024 at 15:43 point

This is really neat!


Any idea when things might get to a place that we could try to build our own version?

  Are you sure? yes | no

James Pilgrim wrote 09/30/2024 at 17:11 point

I sure hope pretty soon. :)   Seriously, there's just a lot of clean-up and sanding down sharp edges (both literally and figuratively!) that still needs to be done before burdening the general public with this.  I'm still hoping this year.  Need to get the enclosure done, and we're still learning about 3D printing.  

Thank you!

  Are you sure? yes | no

Daniel Jurado wrote 09/07/2024 at 20:10 point

This project is so much fun!

What type of resolution and FPS are you getting out of the of the Shutter Sensors? It looks very clear

  Are you sure? yes | no

James Pilgrim wrote 09/30/2024 at 17:16 point

Fairly low by today's standards, I think.  I can pull about 500 fps from the first camera that watches for the ball to first move.  But with the strobing, I can get over 3,000 (effective) fps for the camera that actually watches the ball in flight.  Both are GS cameras that have max sensor resolutions of 1456 x 1088.

  Are you sure? yes | no

Alex Totheroh wrote 08/07/2024 at 18:20 point

Really amazing project! Would you have any concerns if I endeavored to write my own implementation with your hardware list and concepts? Considering making a few youtube videos as well to document for my portfolio, fully crediting you of course. Please reach out if you have any concerns: alextotheroh@gmail.com

  Are you sure? yes | no

yslau44 wrote 08/04/2024 at 08:25 point

I want to fund this project, and help source the components. I am a software developer in Hong Kong working to build a golf simulation software.

  Are you sure? yes | no

James Pilgrim wrote 09/30/2024 at 17:09 point

Thank you very much for the suggestion.  We are currently self-funded, but we appreciate your kind words.

  Are you sure? yes | no

ruezy wrote 04/25/2024 at 19:28 point

Great stuff and I wanted to comment some relevant info if anyone tries to go down the road of using AI models to help with the prediction. I assume this would lead to being able to make the predictions more accurate with less costly hardware, if some smart people were up to the task.

I found some relevant info from a video where someone uses similar tools to track players on a football field which brought up some interesting resources.
https://www.youtube.com/watch?v=neBZ6huolkg

A dataset of 1400 golf swing videos.
https://www.kaggle.com/datasets/marcmarais/videos-160/data

He uses Yolov8 deep learning object detection model, which seem to be something OpenCV handles already and it seems if anything Yolo runs faster and can be fine tuned.
https://github.com/ultralytics/ultralytics

  Are you sure? yes | no

James Pilgrim wrote 04/27/2024 at 16:41 point

How cool - thank you!  I've been thinking about this all morning now, and there's a number of great projects that I could imagine trying.  I haven't learned Yolo yet, but I can't wait to start digging in.  Of course, I'd better finish the Launch Monitor first... :/

  Are you sure? yes | no

robhedrick wrote 04/21/2024 at 18:24 point

How's this coming along? I would love to see some code! 

  Are you sure? yes | no

andrew wrote 04/06/2024 at 04:56 point

This is looking really good! Do you have a GitHub repo yet?  I have been looking for a backyard setup. 

  Are you sure? yes | no

James Pilgrim wrote 04/06/2024 at 13:32 point

Not quite ready for a public repo yet, but hopefully someday not too far in the future.  Outdoor setups may be better served with a radar-based LM.  The DIY project is currently very sensitive to large amounts of IR light.

  Are you sure? yes | no

James Pilgrim wrote 04/02/2024 at 16:40 point

Hi all!  Apologies for being pokey about responding to everyone's DMs.  I've ALMOST got GSPro integration working, and will hopefully have a little demo video out soon showing some actual shots on (simulated) greens. 

I hope to provide some thoughtful responses to folks as soon as I get the GSPro connection working consistently.  (And thanks to the great GSPro people- they've been very helpful).

  Are you sure? yes | no

Eric wrote 03/27/2024 at 12:54 point

Project looks great. In the latest photo looks like your hitting with an actual golf club. Just curious, are you still planning on open sourcing this?

  Are you sure? yes | no

James Pilgrim wrote 03/28/2024 at 13:39 point

Yes - at this point, all the testing is with real clubs and golf balls.  Although I'm still searching for enough room to try out a big driver.  That will be necessary to prove out the high-speed capability of the LM, which is only theoretical at this point. ;/  I may have to borrow a friend with some real golfing skill as well, given that I'm not sure I can hit a ball anywhere near 100m/s.

The intent is still to open source the LM.  That said, there have been a couple of recent developments that might affect that, but seems unlikely to change.

  Are you sure? yes | no

camab wrote 03/24/2024 at 16:42 point

This is really cool. Something I've been wanting to do for awhile now but never attempted it. How are you handling the image capture timing? I think I've read that Skytrak uses a laser curtain to tell when the golf ball has been hit. Are you just having the first camera detect a golf ball via machine learning and then wait for it to move to trigger the second camera? 

  Are you sure? yes | no

James Pilgrim wrote 03/26/2024 at 03:01 point

Yes - The first camera just watches in a tight loop for any ball movement.  Once it moves, the second camera is triggered.

  Are you sure? yes | no

James Pilgrim wrote 03/23/2024 at 15:25 point

Ha - Thank you - I can't wait to start using it with a real golf simulator setup myself! :)  Still lots of testing to do, but am edging closer to using it in a simulator bay with a driver and a big screen every day.

  Are you sure? yes | no

Dylan Walsh wrote 03/11/2024 at 23:27 point

This is so freaking cool. Can’t wait to try this out.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates