LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FRC Game Tools Game Controller Gyro

Is there currently a way to get the 2026 FRC tools to recognize gyro and accelerometer data from a Switch/Switch 2/PS4/PS5 controller to use as inputs for a robot?

0 Kudos
Message 1 of 10
(428 Views)

LabVIEW has a set of VIs that use Windows calls to support Joysticks.  It is possible it can also "see" Game Controllers.  The Functions that support Joysticks are on the "Input Device Control" functions found on the "Connectivity" palette.  They also will support X-Box controllers (I don't know about other controllers).

 

Rather then try to describe the "Joystick" VIs, I suggest you watch some You-Tube videos on "LabVIEW xbox controller".  Note that Buttons map to Booleans, the "analog" controls (Thumb controls, triggers, bumpers) map to analog values, and I don't remember what the D-pad maps to, but it should be obvious if you write yourself a little test program.

 

Bob Schor

 

0 Kudos
Message 2 of 10
(302 Views)

I got that part down, I just need to figure out to how to read gyro data from a non xbox controller

0 Kudos
Message 3 of 10
(225 Views)

@Thanone wrote:

I just need to figure out to how to read gyro data from a non xbox controller


You have given us very little information!  What hardware are you using?  What software do you plan to use?  Given that this is the "LabVIEW Forum", I expected you were planning to use LabVIEW, and because you were so vague on the "robotic hardware", I assumed it might be something like a Joystick (or xbox controller)

, which "just plugs in" on a USB port and can read a number of passive values (like stick position, triggers, etc.).

 

What, exactly, is a "non xbox controller"?  What do you mean by "gyro data"?  [I was not aware that xbox controllers had an accelerometer output -- I thought they just plugged into a USB port and were readable "as though they were" a Joystick.

 

Bob Schor

0 Kudos
Message 4 of 10
(216 Views)

> Is there currently a way to get the 2026 FRC tools to recognize gyro and accelerometer data from a Switch/Switch 2/PS4/PS5 controller to use as inputs for a robot?

this is my original post, I know how to implement all of the axis, buttons and d-pad, I'm trying to find out if there's a way to use the gyro and accelerometer as inputs through the FRC Driver Station and other associated tools. Is there further information you need?

0 Kudos
Message 5 of 10
(208 Views)

Hi. @Thanone.

 

     I'm sorry that I wasn't clear.  I know that National Instruments has been involved with FRC, and has provided hardware that you can use in your Robotics creation.  However, other than the myRIO (now no longer in active production, and no software updates since the 2021 version of the myRIO Toolkit released in 2022), I am not familiar with the sensors and the hardware that constitute the "brains" of the FRC robots.

 

     I have worked on a "small primate car" driven by a Joystick (which is how I knew about the functions that you can use with Joysticks and X-box Controllers).  But your question was about an accelerometer and gyro (are both tri-axial?  I've worked with 3D Accelerometers, and wrote code to auto-calibrate it, but have no "practical" experience with multi-axis gyros.

 

     Can you provide us (or, at least, me) a better description of the sensors, effectors, and "brains" (meaning the hardware that reads analog and digital inputs and outputs digital and analog "effectors" (wheels, both providing "translation" power and "steering" (2-d path), motors, etc.)  Do you use stepper motors for steering?  That's yet another technology (digital pulse trains!) to consider.

 

Bob Schor

0 Kudos
Message 6 of 10
(196 Views)

Bob, apologies if you know this already, but the controllers he's talking about have buttons, joysticks, etc. but also have built-in accelerometers and gyros. That data is transmitted the same way buttons and joysticks are transmitted. He's able to use the LabVIEW Joystick functions to read the joysticks, but he needs to know how to access the Gyro information that's coming from the same controller. I may be undercaffeinated but it sounds like you think he may be using a separate accelerometer/gyro- in fact, it's all the same device.

 

Thanone, apologies but I don't know the answer to your question. There are a handful of libraries out there, though- have you tried this one? https://www.vipm.io/package/lvh_ps4/

 

You may need to modify it to work with your FRC code. I am not familiar with that ecosystem either, unfortunately.

Message 7 of 10
(155 Views)

Thanks, Bert.  I just Googled "code to read accelerometers gyros in ps5 controller" and got a number of Python and C/C++ "hits".  So "all you'd need to do" would be to create the LabVIEW link ...

 

Bob Schor

0 Kudos
Message 8 of 10
(149 Views)

OP- I don't have a system to test, but any chance you could post the results of "Query Input Devices.vi" from the joystick/etc palette? You might get lucky and find the accelerometers show up as "joystick like devices".

0 Kudos
Message 9 of 10
(145 Views)

The problem you're running into here is there's a special section of the NI site for FRC discussions.

 

When you leave that space, you get into folks that touch a wide range of academic and commercial applications.  The folks here on the LabVIEW threads aren't going to be aware of what FRC is (and as you'll see from the other replies, will get stuck looking trying to help because the products and software contained no longer get sold outside of the FRC ecosystem).

 

You'll want to restart this thread over at https://forums.ni.com/t5/Support/ct-p/Support to get in touch with the team working with the FRC release.

 

As a typical starting point, ni.com/frc is the way you want to engage with the ni site.

 

It's also worth noting the Chief Delphi forums have a space carved out specifically for LabVIEW questions (and the other languages if you're looking to use those API instead) to discuss how to use these in the FRC context.

As far as the explicit question here, I haven't touched those sensors so I'd generally be a bad answer here.  You'd want to understand how to communicate with them.  You've got ports for CAN.  There's also a few other ports with different connections if they require different inputs.  Does the device have its own FRC driver?  Have you used this in past years?

 

As a quick edit - if they're the gyro on the controller itself, do you see these show up as analog entries in the joystick section of your Driver Station?  That's usually the quickest way to integrate with what the controller is sending back to your robot.

0 Kudos
Message 10 of 10
(50 Views)