-
Notifications
You must be signed in to change notification settings - Fork 38
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
Control two medium motors #1044
base: master
Are you sure you want to change the base?
Conversation
Set the Revers symbol for a motor that is set to reverse.
Setting the text reverse even if the motor has not yet been activated.
Fix reverse label, fix angle
The most important changes in a long time
Implementation of support for installing one of the inversion motors, so that it is separately supported by the tank and steer motors.
Changes to turnRatio value calculations
Note for later correction |
So that you can get information about which motors were involved, so that when accessed through instance, the simulator does not start displaying this motor. I did this for an extension that will be able to access both motors in a pair and individual motors in a pair.
This is because the setInverted command gives the pwm command. I probably probably wrote it. Although the direction of rotation is set. |
I solved this by sending a command to stop the motors after setting the reverse (I added the setInverse() method inside). |
Previously, I added a static instances variable for the Motor class, to which the current instance is added, as well as a getAllInstances() method to get an array of these instances. I added this change for an extension I was developing. So that for the specified pair of motors in the chassis, it would be possible to work with the motors from this pair separately. And here is a link to my extension, which required these additional changes |
There are still problems with the simulator |
I seem to have solved the problems with synchronous motor control methods. |
Set the motor to setInverted(false) in the init() method only if it has not previously been used in a pair of motors.
Set the motor to setInverted(false) in the init() method only if it has not previously been used in a pair of motors. For what? All because if the Setinverted (true) method for motor marra was installed before, then in the class of the same engine when calling the Init() Setinverted(false) was called and the motor was lost. An example below.
The algorithm checks whether the engine was used in which of the SynchedMotorpair and if not, then setInverted(false) is called. Thus, this algorithm allows the setInverted SynchedMotorpair method to set all Motor objects of used motors to reverse, and not just SynchedMotorpair objects. |
Video with testing on hardware. Checking the reverse installation on the hardware. |
You need to check steer() for a design with medium motors, which will have a reverse for the right motor, but not for the left one. |
If possible, please make a separate version for this change after all other changes so that you can go back |
How can I make the reverse string that appears in the simulator translated using crowdin? |
I thought that this change should be revisited later. I think that it is necessary to leave only some methods for the two medium motors, such as stopping, and remove the methods for starting the motors, because the motors do not behave as they should in reality, such as spinning slower. Most likely, they are overlaid with software code that was developed exclusively for large motors. |
As part of this change, two middle motors are added as synchronized control of the two motors. Two middle motors in the chassis are usually used in competitions. The ev3 firmware itself seemed to allow control using its own methods, which it made for large motors with medium motors. In ev3-g you could use large motor blocks for your medium motors installed on the robot. But there is a nuance: one of the middle motors must have a reverse input, because... it's upside down. And the standard blocks in ev3-g did not allow the use of the reverse parameter for two motors in the chassis. These blocks ignore reverse. And the reverse in makecode is software. Makecode does not use the function from ev3 firmware. And good.
I want to add support for two medium engines. Motor reverse will be installed for all classes, one motor and two synchronized motors.
I also implemented the simulator to display a message that the motor is in reverse.
The next step is to make the run, tank, steer methods able to work with one reverse motor in a pair of two synchronized motors.