A good library to use with a Logitech gamepad

Supporting 2.7 and 3.2+
Post Reply
Maxorzoom
Fresh meat
Posts: 2
Joined: Thu Mar 10, 2022 10:17 am
Contact:

A good library to use with a Logitech gamepad

Post by Maxorzoom »

This might seem like an easy beginner question (sorry to ask) but what library should I use if I want to use a brushless DC motor and control them with a controller. Also would I be able to initialized it such as motor.setTargetvelocity(controller input) or how would I go around starting it. Thank you for your time
User avatar
mparadis
Site Admin
Posts: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: A good library to use with a Logitech gamepad

Post by mparadis »

I'm not sure what kind of game controller libraries are out there, but there are probably lots of examples online if you search for "logitech controller python example" or something.

The implementation would be a bit more complicated than setTargetVelocity(controller input). I suspect the controller library will output the controller stick position in the form of an X,Y pair or an angle and magnitude. setTargetVelocity accepts a number from -1.0 to 1.0, where -1.0 is full speed reverse, and 1.0 is full speed forward. If you want the speed and direction of the motor to correspond to how far the controller stick is tilted, you'll have to do some math to convert from your XY or angle/magnitude values into a single duty cycle value for setTargetVelocity.
Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests