MakeCode EV3 motor invert not working with motor.xx.tank - lego-mindstorms

I'm using the beta MakeCode for Mindstorms EV3 at https://makecode.mindstorms.com/ and I've found an issue that might be a bug.
I'm using the Motor Invert block to reverse the direction of my motors.
When I check the result on the simulator, I see the direction of the motors change, but when I download the .uf2 file to the EV3, the motor's direction of rotation doesn't change. I've tried putting the "inverted" setting to "on" and "off" and I see that affecting the simulation but not on the physical robot.
I tried changing the EV3 output ports but that didn't help.
Here is the Javascript version of my code.
brick.buttonUp.onEvent(ButtonEvent.Pressed, function () {
brick.setStatusLight(StatusLight.Green)
motors.largeB.setInverted(true)
motors.largeC.setInverted(true)
motors.largeBC.tank(50, 50)
sensors.touch4.pauseUntil(ButtonEvent.Pressed)
motors.stopAll()
})
brick.setStatusLight(StatusLight.GreenFlash)
Is there a problem with how I'm reversing the direction of rotation?
As a test I tried replacing the motors.xxxx.tank with motors.xxxx.run and then it does reverse the direction of rotation both on the simulator and the physical robot.
motors.largeB.run(50)
motors.largeC.run(50)

Thanks for reporting this bug.
It does indeed look like the tank block doesn't respect the inverted state of the motors.
For now, you can use:
motors.largeBC.tank(-50, -50)
to reverse the motors using the tank block.
I've filed a bug on our end to track this issue. Thanks!

Related

Adding a DC Motor to a Simscape Model

I want simulate an inverted pendulum via Simcape. For this, i created a Model with SolidWorks and tranformed it to Simscape. So far so good. Everything worked and my Simulation shows the predicted physical Behavior.
But now i want to add a dc motor to my simulation, which is hooked to the sledge via belt.
I tried to connect the dc motor block with the revolute joint of the pulley, but it seems Matlab has some issues with it. It shows the error shown below.
Further you can see my simscape modell of my inverted pendulum and how i connectet the Dc motor block to the revolute jo
Has anybody an idea how to connect the dc motor correctly or is there somthing wrong with my simscape model?
I´m kind of running out of ideas and I´m gratefull for any help I can get.
enter image description here
It says one of your componenet that needs to rotate, is strictly connected to the world. I believe you need yo change that.

Jitter using ConstantForce2D (relative) in Unity

I'm currently trying to create a 2D plane game (a bit Retry like), and I just discovered an annoying
problem : the plane motion has a lot of jitters (didn't saw it earlier because I didn't zoom enough to see it).
I'm using a ConstantForce2D on the plane to move, and the arrow keys (in FixedUpdate) to rotate the object. I tried change Interpolate mode to "interpolate" and "extrapolate", extrapolate is worse, and the first one works only when strictly moving on x axis (jitters when there's a small rotation).
I'm quite stuck on this :/
Has someone found a solution on this problem?
(I wasn't sure if any code was needed)

Rope with pin joints and limits appear compressed, curling up

I have a rope with pin joints between chain rings. It had worked perfectly.
I now want to simulate real chain, so I added limits for pin joints as such:
pinJoint.upperAngleLimit = CGFloat(M_PI / 6)
pinJoint.lowerAngleLimit = CGFloat(-M_PI / 6)
pinJoint.shouldEnableLimits = true
However, when I use a ball-like start of the chain, I get pictures 3-4 (shown below)
I tried to use constraints, but they weren't really helpful
Have you tried to use Matti's rope module? This worked pretty well for me. The simulation became very unstable based on the mass of the ball. Try reducing the mass of the rope links and the ball. Also, if the rope spins too fast the physics will also become unstable.
I think next time I will try using Verlet integration like this example. This also has the advantage of being able to attach on both ends.

Is this a physics bug with WheelCollider or am I doing something wrong?

I am trying to create a drivable car model using Unity's WheelColliders and I have set up my CarControl.cs script like this: https://gist.github.com/victorbstan/e5903829576eaf6ce5e3
I am encountering two problems:
The car slightly turns without any steering being applied on a completely flat surface.
The vehicle accelerates and decelerates inconsistently given the torque applied to it.
To get a better idea of what I mean, I made a video recording of the setup and play-through: https://www.youtube.com/watch?v=XuMT_AzRHbA&feature=youtu.be
Without really digging into it, my initial impression is that your WheelCollider friction values are probably too low. Increasing the forward friction will probably help with your inconsistent acceleration and the sideways friction will probably address your steering issue.

Animating a turntable using Matlab's GUIDE

I have an application where I have a stepper motor connected to a turntable. The stepper motor's driver is controlled serially via Matlab.That is, I can control the angle through which the stepper motor turns the turntable and the speed at which it is happening by sending data to the stepper motor using a serial port in Matlab. Once the stepper motor turns by the required angle, it returns its current angle back to another serial port.
I am trying to build a GUI where the user can input the speed and the angle to which the turntable must be turned.I want to be able to illustrate the rotation of the turntable on my GUI itself, using the data about the current angle that the stepper motor returns to me.
Can anyone suggest a good way to creat and animate the turntable's rotation using MATLAB's GUIDE? The animated figure must be able to display the current angle with its initial reference angle. What I have in mind looks like the figure below.
Just plot eveything with lines and update the lines accordingly, don't be afraid to start using some math to calculate the angles and line end points, and to plot the circles. This is something pretty easy to do.