Trying to model the ball and beam problem - modelica

I am trying to model the well-known ball and beam problem with Modelica. Now I have struggle to model the ball rolling down an inclined plane depending on the angle. I intended to use the MultiBody libraray. Has anybody an idea how to handle that? Or has anybody dealt with a similar problem?

For hints and reference you might take a look at the simple vehicle model in the MSL translational package:
Modelica.Mechanics.Translational.Components.Vehicle
Check out how the inclined plane is implemented with idealRollingWheel to calculate gravity based acceleration on the vehicle.
Slight modification of that should deliver what you require for your tilted plane.
MultiBody provides a Wheel as well, but since you are investigating a 2D scenario keeping things simple might be helpful.

Related

Directional Friction

I want to have the friction of a Physic Material depend on the direction. I found this documentation from Unity 5.2 that lets you set two directions and friction coefficients but that is missing from the newest api. Is there a way to do this in the new version or am I going to have to do it manually?
I'm trying to use wheel colliders to provide similar functionality but they are behaving very strangely. They fall through the floor, jump unexpectedly, bounce weirdly.
This is a very good question as I was having the same problem a while back!
Unfortunately, what I have gathered from both unity developers and the current documentation is that the feature you described is not implemented into the current Unity engine as you have assumed.
Some work arounds that I would suggest is reverting back to a previous version of the engine if you are able or create your own friction system that would take data from the velocity vector of a physics object to determine which direction it is travelling. More information on finding a Physics object's velocity can be found on this page https://docs.unity3d.com/ScriptReference/Rigidbody-velocity.html
Best of luck on your Unity Project!

Is it possible to obtain the shape of an IRL object from the slam algorithm to hide 3D objects?

I want to do some test with the AR in Unity, so my idea is to use the ground plane detection of the arcore to instantiate a ring. The ring is made of segments and I want to use an obstacle between the camera and some segment to hide these segments.
I have thought to use the slam to get the shape of the obstacle and use the coordinates to hide (disable or change shader/material) or not the segments behind the obstacle.
I do some researches about Vuforia and I know they use the slam but it does not seem that we can access the shape directly from Vuforia so I thought to use the arcore directly. I think it may be done with spatial mapping.
Because I am not very experienced I prefer to ask about the possibility to do it and if I am in the good way.
If I understand correctly, the term you are looking for should be "Occlusion Management". Vuforia. There is a sample package in the asset store, but I don't know how much value it can offer to your cause. Look here
You could as well take a manual approach and integrate your obstacle as Image- or Model-Target, so that you can simply use a virtual replica of your obstacle that hides everything behind it. This however means that your obstacle would have to be always the same object, so I am not sure if this approach is suited for your needs. But this would be the easiest and cleanest way imho.
You can find many tips to get around occlusion problems here

How to use accelerometer, CMMotion data to locate a point in 3D space?

I am creating an application. In which iPhone will be placed (a separate cover is made for it) with golf club(racket). I want to get array of points which state the path of the racket movement.
For example, I start collecting the data when racket is on the ground. After then user prepares himself for shot. So, he will take the racket back side and then he will hit the shot by moving racket forward. I want to catch all these points in 3D and want to plot them on screen (2D projection). I saw many similar questions, accelerometer, CMMotion framework documents. But could not find a way to doing so.
I hope, I have explained the question properly. Can you suggest me some formula or how to process the data to achieve it?
Thanks in advance.
You cannot track these movements in the 3D space.
But you can track the orientation of the racket and that should work well.
I have implemented a sensor fusion algorithm for the Shimmer platform, not a trivial task. I would use Core Motion and I would not try to create my own sensor fusion algorithm.
Hope this helps, good luck!
i tried the sensors fusion algorithm developed by Madgwick, but the output, on my device, it's similar to the CoreMotion Attitude output.
I don't have the possibility to test the attitude outputs from other iPhone, but in my case, the problem it's the yaw angle, even if the iphone it's fixed on the table the yaw angle tend to be unstable, probably due to the distinct chip-placement of z-axis gyro.

Box2d wind resistance

I'd like to make game with some windmill in it and want to make wind via b2vec2 gravity vector. I can't find some clear explanation about wind resistance. Is it possible with box2d? May I ask you to point me to necessary functions and documentation please.
What you are trying to do is most likely impossible with box2d, as that would involve the physics being simulated in 3d, while box2d only does 2d physics. If I was you, I would just fake the animation. By having the blades of the windmill in a separate CCSprite than the body of the windmill and then rotating the blades around the z-axis using a CCAnimation that matches the wind speed.
For games
Depending on the game, you may not need to worry about drag force (wind resistance). You could probably get away with pushing objects in the direction the wind is blowing, using an ApplyForce or messing with gravity (like you mentioned in the question).
If you really want to model wind resistance
Looks like linearDampening could be helpful, though unrealistic. True air resistance isn't linear.
You could also do an ApplyForce every frame, opposite the velocity. Unfortunately its been a while since I've taken my mechanics class, so I can't help you with the code, but you could look at this wikipedia article for the formulas
I stole most of this info from this thread:
http://www.box2d.org/forum/viewtopic.php?f=3&t=2718
If you are still having problems
I made some assumptions in my answer. I assumed that you're making rudimentary approximations of things like wind and air resistance. I also assumed you're not truly trying to model a gas pushing a fan, as you probably won't have much luck doing that in 2D, and even if you tried, I can't imagine it adding much to your game.
If you're still confused, try adding some example code to your question, or describe what you are trying to simulate in more detail.

catapult effect in cocos2d

How to catapult animation in cocos2d.
Iam doing animation of streching stick like rubber, does not get any luck yet,
anyone knows please help.
Thank You.
It's hard to answer your question without more specifics. For instance, are you using one of the physics libraries (Box2D, Chipmunk) or are you rolling your own physics? Are you just trying to model a launched projectile (which is a simple parabola), or do you need to model the physics that actually launches the projectile (which will require a much more detailed model)?
If it's the former, as I said, the animation will just follow the arc of a parabola, but rather than computing the parabolic equation, it's probably easier to animate if you just give the projectile a velocity vector, and apply a gravity vector to it over time.
If it's the latter, I think you need to translate what you want into the physics involved. You mention a catapult, which is about levers, but then you mention a "stretching stick like rubber" which sounds more like spring forces, so the answer to your question is going to depend heavily on what exactly you're trying to achieve.