Python Forum
Help understanding code section
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help understanding code section
#1


Hi everyone.

Need a little help interpreting the following bit of code. Keep in mind this is all brand new to me but am keen to lean.

I am working on a previously created project as I like to learn by doing and seeing the effects of what I do directly.

The following is a bit of code is a small section that is designed to output the signal from a xbox style controller to move steppers on a robotic arm. (think I have the right section anyway)

The issue I am having is that the motor output (0) on the driver likes to interpret the signal from the controller and tell the motor to keep moving in one direction perpetually.
It is like the neutral point of the stick on the controller is somehow offset.

all I need to know is if I am reading this correctly.....

Are the " -1500" and "5000" sections the areas that define the thresholds for the stick movement on the controller? or the central point offset?

Or is it the (1, 35) and (0, 35)

if event.code == 'ABS_X':
value = event.state
if value < -1500:
if not joints[0].isBusy(): joints[0].run(1, 35)
elif value > 5000:
if not joints[0].isBusy(): joints[0].run(0, 35)
else:
if not joints[0].isBusy(): joints[0].softStop()

Or am I reading this wrong?

links to the github section of this project here - https://github.com/Roboteurs/rbx1-softwa...r/robot.py
Reply


Messages In This Thread
Help understanding code section - by raz631 - Dec-14-2017, 01:23 AM
RE: Help understanding code section - by Larz60+ - Dec-14-2017, 03:22 AM
RE: Help understanding code section - by raz631 - Dec-14-2017, 03:34 AM
RE: Help understanding code section - by buran - Dec-14-2017, 05:10 AM
RE: Help understanding code section - by raz631 - Dec-14-2017, 09:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to add multi-line comment section? Winfried 1 223 Mar-24-2024, 04:34 PM
Last Post: deanhystad
  Code understanding: Need help in understanding dictionary code jt123 0 478 Jul-09-2023, 01:13 PM
Last Post: jt123
  New to python/coding Need help on Understanding why this code isn't working. Thanks! mat3372 8 1,764 May-09-2023, 08:47 AM
Last Post: buran
  Append data to Yaml section tbaror 0 7,010 Feb-09-2022, 06:56 PM
Last Post: tbaror
  Understanding a piece of code Michael1 4 1,431 Jan-20-2022, 07:14 PM
Last Post: Michael1
  Beginner: I need help understanding few lines of a code. hop_090 1 1,697 Sep-07-2020, 04:02 PM
Last Post: Larz60+
  Extracting Rows From Data Frame and Understanding The Code JoeDainton123 0 1,446 Aug-03-2020, 04:08 PM
Last Post: JoeDainton123
  Create an isolated section in bash? yxk 1 1,961 Feb-27-2020, 11:16 AM
Last Post: Larz60+
  Help Understanding Code Variables 1 1,920 May-02-2019, 05:53 PM
Last Post: micseydel
  Best section to do a while loop in my code mrapple2020 0 1,654 Apr-15-2019, 01:14 AM
Last Post: mrapple2020

Forum Jump:

User Panel Messages

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