Adding a DC Motor to a Simscape Model - matlab

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.

Related

Control 4 wheeled raspberry robot with Simulink

I am going to control 4 wh raspberry robot in Simulink. I found this one to control DC motor with simulink: https://www.mathworks.com/matlabcentral/fileexchange/41528-raspberry-pi-dc-motor-h-bridge-driver-block-sfunction?s_tid=srchtitle It is just for a one motor. My question: is it possible to build a simulink model for 4wheeled robot car by this model? I understood that, by changing to - or + value of block constant motor will drive anticlockwise or clockwise. How to be to turn left or right? It doesn't like Python or C programming, so it's stopped project. Especially for Simulink, any idea or suggestions would be greatly approtiated! Thank you so much in adwance!
I added images which i meant in comment. I am a newbie, so please, don't judge me quality)
enter image description here
enter image description here

3D vehicle visualisation in MATLAB/Simulink

I am new to the MATLABS platform and am trying to understand how to display the 3D visualisation with graphs shown at 11:40 and at 18:10 in the video below, I downloaded and ran the example code that he provided but only the two spectrograms are operning.
If anyone can point me in the right direction, it would be very much appreciated.
Thanks.
https://uk.mathworks.com/videos/radar-system-modeling-and-simulation-for-automotive-advanced-driver-assistance-systems-107121.html?elqsid=1551737420797&potential_use=Student
As per the voice over at about 11:32, they have run the first simulation model, which is set up to write data to the MATLAB Workspace, and then to generate the virtual reality simulation they are running a second model.
From the video, at about 11:36, the second model appears to be called VR_Simulation. This second model almost certainly requires the Simulink 3D Animation tools.

MakeCode EV3 motor invert not working with motor.xx.tank

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!

How to simulate fixed plane using SimScape Multibody Contact Forces Library?

I am trying to simulate the contact forces between a fixed plane and a sphere in MATLAB Simulink using the Multibody Contact Forces Library https://www.mathworks.com/matlabcentral/fileexchange/47417-simscape-multibody-contact-forces-library as shown in this MATLAB webinar https://www.youtube.com/watch?v=VZIG0HlBHC4 at 9:58. However, when I recreate the model and run the simulation myself, I get the following error.
External Force and Torque External_Force_and_Torque_PlaB has its follower port rigidly connected to the world frame; it has no effect. You can configure this diagnostic in the Simscape Multibody Configuration Parameters dialog.
I've tried adding another constraint/joint between the World Frame and the planar solid to resolve the issue, but I keep getting the same error? How can I fix this error?
I ran into the same problem. Have a look here: https://ch.mathworks.com/matlabcentral/answers/378561-rigidly-connected-port-error-with-simscape-multibody-contact-forces-library
This error is due to a default setting with new Simulink models, which is incompatible with the Contact Forces Library.
To resolve this:
Go to Simulation > Model Configuration Parameters
In the Simscape Multibody > Diagnostics pane, change the "Rigidly constrained block" diagnostic to "warning" or "none"

How to get the same motion in forward dynamics solution in Simulink?

I am new to Simulink and I am having some problems on building and running multibody models.
Shortly, here is my problem.
I have designed a 2 joint,2 body system. I actuate each joint with position, velocity and acceleration data (array format) and the system works perfectly. I connected joint sensors to each joint, torque produced by joints are saved to workspace. I have the same model but it analyzes the system in forward dynamics. So, joints in this model are actuated by torques obtained from inverse dynamics model. But the motion comes out from the forward dynamics model is not same with the inverse dynamics model, even it is not similar, it is completely absurd. I think I have checked everything but for sure not "everything". Can anyone help me in this?!