Jump to content
THIS IS THE TEST SITE OF EUROBRICKS!
THIS IS THE TEST SITE OF EUROBRICKS!

Dragon50

Eurobricks New Members
  • Joined

  • Last visited

  1. Thank you Munchkin255. This won't solve my current problem because I need to reach the angle via the shortest path and there's no way of knowing beforehand if the motor has to rotate clockwise or anticlockwise. I started another thread yesterday describing the problem. I've a mental note of your suggestion and it may well be useful for a future project.
  2. My current project uses "run_to_position(0, direction='shortest path')" to set two motors to a known position before the rest of the code runs. However, this doesn't always work. If I run another of my creations, usually by mistake, before running my current project the motors can end up in some odd position and running code that begins with "run_to_position(0, direction='shortest path')" does not correct the situation. I can correct this either by switching the hub off and then back on and select the correct programme or run the Charlie scratch version provided by Lego. The scratch code contains a "calibration block". I'm attempting to simulate that block by running "run_to_position(0, direction='shortest path')". It seems that the block contains more that run_to_position and that I need a piece of Python code that is the equivalent of the "calibration block. Can anyone offer any suggestions?
  3. Thank you for your replies. I have a very slow Internet connection at my present location which also keeps dropping out so I'm not sure what this reply is going to look like. Gimmick. No need to be sorry, any reply is better than no reply. I tried to use Chromium (not Google's Chrome) and I did enable the experimental mode and install the udev rules file for Mindstorms. I was in contact with one of Pybrick's developers via Github some time ago and he confirmed that chromium won't work if it's been installed as a snap package and that a fix was in the pipeline. I'm using Kubuntu 21.04. I'm reluctant to experiment with Pybricks if there's a chance that I'll lose the Lego firmware. It took a long time to download the latest Android Lego update. Munchkin255. Regarding the simulations movement of a pair of motors. It's not a big deal to have to move the motors one at a time, I was just trying to convert the block code for the Charlie skier project. What I have skies correctly, it just doesn't bring the arms down to the zero start position at the same time before the skiing loop begins. I'm always interested to see how others have solved a problem. Are you using Pybricks? I'm new to Lego and I haven't played with the hub gyro yet.
  4. Thank you Gimmick for your reply. I have, as you can see in my original post, that I have already tried your suggestion. I'm trying to have two motors (a pair of motors) move to position 0 simultaneously. The software that I'm using is the MicroPython hub API. https://lego.github.io/MINDSTORMS-Robot-Inventor-hub-API/class_motorpair.html?fbclid=IwAR2dxMRRsGTPTg_wlBTHbN_1nFPRN6NgGQ-XbIj87XzjpeYF0_q5pFDZ2To Pybricks wasn't working using chromium if it was installed as a snap package. That may have been fixed by now. There were plans to have dual boot, I wonder if that has been implemented yet? I'm a bit hesitant to wipe out the original Lego firmware.
  5. Thank you Lok24 for your reply. The problem is that the run_to_position method is blocking which means that the next instruction won't start until the motor has finished moving. I'd like both motors to move simultaneously. I note that Pybricks gets around this problem with a don't wait option. The last time I checked Pybricks is not an option for Linux users, so Pybrick's documentation doesn't really help me at all at the moment.
  6. Thank you fore reading this, my first posting and I have searched the forum for an answer. The MotorPair class doesn't have a a run_to-position method and so I've been experimenting with the MicroPython hub module run_to_position method but the positioning of the motors is quite erratic so I must not be using the class correctly. This is what I've tried: motor_left = port.B.motor motor_right = port.F.motor motor_pair = motor_left.pair(motor_right) motor_pair.run_to_position(0, 0) A kind person from the FaceBook group suggested that I try adding the following in the setup section before the code runs to set the absolute position: motor_left.mode(0) motor_right.mode(0) However, this doesn't seem to work either. What I'd like is the equivalent to "run_to_position(0, direction='shortest path')" but for a pair of motors. By the way, I've not been able to find any example code for the hub module, just the documentation.
Sponsored Links