Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steering does not work when using drive , but does in calibration . Earlier commit works . #989

Closed
c1505 opened this issue Feb 7, 2022 · 14 comments
Assignees

Comments

@c1505
Copy link

c1505 commented Feb 7, 2022

Issue description

Steering does not work when using drive , but does in calibration and it works when using an earlier commit. Seeing that another person in discord reported the same problem and that downgrading to 4.2.1 fixed it , I tried a more recent commit d5b91301ff904873e70b9caba72823fe3454feb6. It fixed the problem. I am using a Jetson nano 2gb and the other person has a raspberry pi so it seems to not be related to the particular board used. I went back and reinstalled dev and created a new car to make sure that the problem replicated for me before opening this issue.

Steps to reproduce the issue

  1. Follow software setup as described here for the jetson nano
  2. create donkeycar from template
  3. perform calibration and modify myconfig.py
  4. changes to myconfig.py for my car
PCA9685_I2C_BUSNUM = 1
CAMERA_TYPE = "CSIC"   # (PICAM|WEBCAM|CVCAM|CSIC|V4L|D435|MOCK|IMAGE_LIST)
IMAGE_W = 224
IMAGE_H = 224
PCA9685_I2C_BUSNUM = 1
STEERING_LEFT_PWM = 460         #pwm value for full left steering
STEERING_RIGHT_PWM = 260        #pwm value for full right steering
THROTTLE_FORWARD_PWM = 420      #pwm value for max forward throttle
THROTTLE_STOPPED_PWM = 370      #pwm value for no movement
THROTTLE_REVERSE_PWM = 320      #pwm value for max reverse throttle
  1. initiate driving from the car folder python manage.py drive
  2. navigate to browser
  3. press j multiple times to try to turn wheels left
  4. press k multiple times to try to turn wheels right
  5. also tested on mobile with the touch interface

What's the expected result?

  • wheels turn

What's the actual result?

  • wheels do not turn

Additional details / screenshot

  • the webrowser UI shows changes to the steering, but no changes happen in the car. The throttle still works.
  • the working commit d5b91301ff904873e70b9caba72823fe3454feb6 is from December 30th of 2021. I have not tested other commits yet. I figured that someone more familiar with the code would be able to narrow down where the problem originated better than me.
  • the jetson nano install instructions is the only one that says to install from dev. The rest say to install from master which seems like it is the same as the most recent release and I am assuming would have also worked for me.
  • Should the docs say to install from dev or master for the jetson nano and what should it be for the other devices? @Ezward it looks like you made that change . If you could provide feedback, that would be helpful.
@Ezward
Copy link
Contributor

Ezward commented Feb 7, 2022

So that change got made to docs because we almost always tell folks to use dev when they have a problem. However, I believe you have found a pretty big bug in dev; we have duplicated this in another branch that branched from dev. As a work around, I think the I2C_SERVO drivetrain will work; it worked in that other branch. Thanks for reporting this bug.

@Ezward
Copy link
Contributor

Ezward commented Feb 7, 2022

I'm going to revert that change to docs because it will lead folks to a bad experience. We will leave this bug open so we fix that actual issue in dev.

Ezward added a commit to autorope/donkeydocs that referenced this issue Feb 8, 2022
We have a bug in dev branch that causes the default drivetrain to not operate correctly autorope/donkeycar#989  This commit reverts the change from December where we started specifying dev branch.
@c1505
Copy link
Author

c1505 commented Feb 8, 2022

Thanks for the fast response @Ezward . This is a really cool project! I appreciate the work you all are doing improving it and keeping it going 🥇

@TCIII
Copy link
Contributor

TCIII commented Feb 8, 2022

@c1505

SBC: Nano 4GB
OS: JP 4.6
Template: Path_follow.py

I am a DC Maintainer and have duplicated your issue using DRIVE_TRAIN_TYPE = "PWM_STEERING_THROTTLE" with both a gamepad (PS4) and the webui when running the 'path_follow.py' template.
I have throttle control, but no steering control.
If I set DRIVE_TRAIN_TYPE = "I2C_SERVO" I have throttle and steering control with both the gamepad and the webui.

TCIII

@Ezward
Copy link
Contributor

Ezward commented Feb 11, 2022

I believe what is going on here is that the PWM_STEERING_PIN configuration values is used in several DRIVETRAIN_TYPE configurations, each with a different default value. If you just set the DRIVETRAIN_TYPE = "PWM_STEERING_THROTTLE", but don't uncomment the PWM_STEERING_PIN value, then the default of a different drivetrain get's used.

So a workaround is to just uncomment PWM_STEERING_PIN in the PWM_STEERING_THROTTLE sections.

I will create a real fix and make a pull request for dev.

@Ezward Ezward self-assigned this Feb 11, 2022
@Ezward
Copy link
Contributor

Ezward commented Mar 2, 2022

Proposed fix is in this branch. https://github.com/autorope/donkeycar/tree/989-namespace-drivetrain-configurations @c1505 Corey if you get a change to try this it would be appreciated.

@c1505
Copy link
Author

c1505 commented Mar 2, 2022

@Ezward Thanks ! I'll give it a try today or tomorrow. Want to open a draft PR as well to have the automated tests kick off and to make the changes more easily visible ?

@c1505
Copy link
Author

c1505 commented Mar 5, 2022

Sorry I had a busy week and am away this weekend. I will give it a shot Monday. Thanks again for the fix!

@BrianHenryIE
Copy link
Contributor

BrianHenryIE commented Mar 7, 2022

I tried:

git checkout -b 989-namespace-drivetrain-configurations origin/989-namespace-drivetrain-configurations

with no other changes and it did not work.

Then I...

just uncomment PWM_STEERING_PIN in the PWM_STEERING_THROTTLE sections.

That worked. Thank you.

@Ezward
Copy link
Contributor

Ezward commented Mar 7, 2022

I tried:

git checkout -b 989-namespace-drivetrain-configurations origin/989-namespace-drivetrain-configurations

with no other changes and it did not work.

@BrianHenryIE can you give me a little more info on this; what did you do? Did you create a new mycar? Did you update your prior mycar using donkey createcar --overwrite --path <yourcar>? Did it fail the exact same way or a different way?
Thanks

@BrianHenryIE
Copy link
Contributor

I did not create a new mycar, nor did I update. (my existing mycar was vanilla – I had reinstalled from scratch as I tried to troubleshoot).

The fail was in the same way, i.e. no error message, just no working steering when launched.

@Ezward
Copy link
Contributor

Ezward commented Mar 7, 2022

I did not create a new mycar, nor did I update. (my existing mycar was vanilla – I had reinstalled from scratch as I tried to troubleshoot).

The fail was in the same way, i.e. no error message, just no working steering when launched.

Ok, then it failed because there was no change to myconfig.py; so it failed in the same way. The issue is with how myconfig.py was being generated (with duplicate values in different sections). Thank you for the details.

DocGarbanzo pushed a commit that referenced this issue Mar 17, 2022
* Use python dict to namespace the various drivetrain configurations
- There is one configuration for choosing the drivetrain.
- However, each drivetrain has it's own lengthy set of configurations.
- Some of these are shared among several drivetrains OR to avoid
  that they are prefixed and so identifiers become very long.
- This commit moves each drivetrain's configuration into a python
  dict, effectively namespacing the configuration.
- This allowed me to shorten the names of some configs since
  a prefix is not needed to disambiguate them.  So some config
  names have changed
- The bigger issue for users is that now, if they want to  change
  any drivetrain config, they will need to uncomment the entire
  dictionary block, not just a single line of configuration.
  That should be obvious when looking at the code, but it could
  trick a newbie that does not understand python.  I would say that
  is fine, because they will learn something important from it.
- If you look at the resulting config.py you will see that it
  is much cleaner.

* path_follow.py only support I2C_SERVO drivetrain
- so I updated the configuration to reflect this
- removed the DRIVETRAIN_TYPE configuration, since it is not used
- removed the other drivetrain configurations which are not used

* Change webui info log to debug log

* Put drivetrain config in dictionary to address isssue #989

* remove spurious beta character and extra commas.

* version="4.3.6"

Co-authored-by: Ezward <Ezward@github.com>
@c1505
Copy link
Author

c1505 commented Mar 21, 2022

Appreciate the fix @Ezward . I tested it with a new car for the steering and throttle for driving. If you don't uncomment everything in the PWM_STEERING_THROTTLE dictionary in the myconfig.py file, it fails with a key error, but otherwise works. I imagine that could be addressed in code, but I also think most people should be able to figure it out if they look at the error message.

Unless there was a different fix that was put into the release, I think this fix should also be in the release. Otherwise, I the release is broken for at least nano users and based on the discord message I saw, possibly also raspberry pi folks.

DocGarbanzo pushed a commit that referenced this issue Apr 4, 2022
* Use python dict to namespace the various drivetrain configurations
- There is one configuration for choosing the drivetrain.
- However, each drivetrain has it's own lengthy set of configurations.
- Some of these are shared among several drivetrains OR to avoid
  that they are prefixed and so identifiers become very long.
- This commit moves each drivetrain's configuration into a python
  dict, effectively namespacing the configuration.
- This allowed me to shorten the names of some configs since
  a prefix is not needed to disambiguate them.  So some config
  names have changed
- The bigger issue for users is that now, if they want to  change
  any drivetrain config, they will need to uncomment the entire
  dictionary block, not just a single line of configuration.
  That should be obvious when looking at the code, but it could
  trick a newbie that does not understand python.  I would say that
  is fine, because they will learn something important from it.
- If you look at the resulting config.py you will see that it
  is much cleaner.

* path_follow.py only support I2C_SERVO drivetrain
- so I updated the configuration to reflect this
- removed the DRIVETRAIN_TYPE configuration, since it is not used
- removed the other drivetrain configurations which are not used

* Change webui info log to debug log

* Put drivetrain config in dictionary to address isssue #989

* remove spurious beta character and extra commas.

* version="4.3.6"

Co-authored-by: Ezward <Ezward@github.com>
(cherry picked from commit cffec78)
@Ezward
Copy link
Contributor

Ezward commented Jun 17, 2022

Yes, need to update docs to instruct user to uncomment the entire dictionary block for the chosen drivetrain. What would be better is that they are just uncommented to start, since they do not conflict. Then setting the DRIVETRAIN_TYPE will just choose the right one. I'll look and see if we can do that.

@Ezward Ezward closed this as completed Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants