Python Forum
Joystick-controller in threadings
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Joystick-controller in threadings
#4
(Dec-05-2024, 03:23 PM)deanhystad Wrote: It is unclear from your description, but it sounds like the joystick will be some kind of integrator. The longer you hold the joystick up/down, the more it changes some value. Is that correct?

If so, I think your problem is opposite what you state. I think you need to add a delay to reading the joystick and sending the osc command. Something that makes the time between consecutive commands the same. I would use a threading timer to periodically call the send_OSC() function.

As far as sharing information, you can do that with a globally scoped variable, or you could write your code using classes and use instance variables. If you don't like either of those, you can use a mutable container object, like a list or dictionary.

A dataclass would be a great choice for this, but I don't think those are available in micropython.
All Joystick I tried so far send a float value from -1 to 1 with zero in middle for X and Y (like a potentiometer).

My normal proffesion is technician on a theater with a motorized hoist system. They use a square pulse to sync the movment between couple of motors to synchronize them. My idea is recalculate my float-value to trig against a square pulse and send my value 1 or -1... or if i just use couple of time variables, but I would keep my latecy as low as possible. :)
Reply


Messages In This Thread
Joystick-controller in threadings - by MacTommy - Dec-05-2024, 07:07 AM
RE: Joystick-controller in threadings - by MacTommy - Dec-06-2024, 07:20 AM
RE: Joystick-controller in threadings - by Larz60+ - Dec-05-2024, 04:27 PM
RE: Joystick-controller in threadings - by MacTommy - Dec-06-2024, 07:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python and DMX (aka, light controller) ScottAF 4 5,605 Apr-06-2023, 07:09 PM
Last Post: ScottAF
  How can flask find the controller? 3lnyn0 3 2,501 Jul-08-2022, 10:05 AM
Last Post: Larz60+
  Controller Buzzer as Distance Decreases barkster 6 3,794 Nov-01-2021, 03:26 PM
Last Post: barkster
  Pygame with joystick mmagner2022 1 2,428 Aug-06-2021, 07:56 PM
Last Post: SheeppOSU
  Auto re-pair / re-sync Controller via Script? User3000 2 3,229 Nov-30-2020, 11:42 AM
Last Post: User3000
  Tuning PID controller Sancho_Pansa 4 6,332 Nov-09-2020, 07:51 AM
Last Post: Sancho_Pansa
  mapping joystick axis to specific 'channels' in python DashOrion 1 3,895 Jul-07-2020, 04:26 PM
Last Post: DashOrion
  Xbox Controller arki 0 2,266 Jun-30-2020, 10:32 AM
Last Post: arki
  Please help! Akai APC20 midi controller script versusliveact 0 2,817 Feb-14-2020, 05:37 AM
Last Post: versusliveact
  managing command codes for external controller box Oolongtea 0 2,439 Sep-19-2019, 08:32 AM
Last Post: Oolongtea

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020