NTNUJAVA Virtual Physics LaboratoryEnjoy the fun of physics with simulations! Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
September 19, 2018, 06:32:34 pm
 Welcome, Guest. Please login or register.Did you miss your activation email? 1 Hour 1 Day 1 Week 1 Month Forever Login with username, password and session length

 Home Help Search Login Register
"Vision, mission and action." ...Wisdom

 Pages: [1]   Go Down
 Author Topic: Need a simulation of two wheels cars and a ball please  (Read 12944 times) 0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
pescamillam
Newbie

Offline

Posts: 7

 « Embed this message on: May 06, 2009, 06:30:59 am » posted from:BogotÃ¡,Cundinamarca,Colombia

The problem I have is I need to simulate two wheel cars each car having an independent velocity in each wheel and also there must be a ball in the field the mass of each car is about 1kg and the mass of the ball is about 12 gr. the cars are cubes (7.5 cms each side) and the ball has 1.5 cm of radious. thou my main problem is solving the interaction between the cars. If I didn't explain me fine please make your questions and if its needed I'll make a drawing of my needs. Thank you
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3080

 « Embed this message Reply #1 on: May 06, 2009, 08:36:29 am » posted from:Taipei,T\'ai-pei,Taiwan

Are you going to simulate two cars, and each car has it's own speed independent to each other?
If there is an interaction between cars then their speed is not independent to each other any more.
What do you really want? What is the role for the ball?
What are the constraints for the car: moving in straight line? or circular motion? or ....
Where is the interaction force coming from?
 Logged
pescamillam
Newbie

Offline

Posts: 7

 « Embed this message Reply #2 on: May 06, 2009, 09:28:29 am » posted from:BogotÃ¡,Cundinamarca,Colombia

I'm trying to create a simulation to simurosot ( http://www.fira.net/soccer/simurosot/overview.html ) in java.
Each wheel must have it's own speed and each car must have its own speed  also. the interaction comes when these cars with dynamic odometry crash the others.
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3080

 « Embed this message Reply #3 on: May 06, 2009, 09:30:41 pm » posted from:Taipei,T\'ai-pei,Taiwan

To create a simulation: a model must be specified.
What factors determined the speed of the car and the wheel? What are the constraints?
what are the rules to control the speed or directions?
You need to provide detail information. I am not fully understand what you really want?
I need to fully understand  to be able to help!
 Logged
pescamillam
Newbie

Offline

Posts: 7

 « Embed this message Reply #4 on: May 08, 2009, 10:51:13 pm » posted from:BogotÃ¡,Cundinamarca,Colombia

I hope this make it easier

the initial idea is this, the world has two cars with some walls that won't let them pass, there is also a ball they can hit, also the cars can hit each other, and the speed of each wheel of each car can be changed at any time there can be a max speed but right now it doesn't matter also the friction or spin of the ball shouldn't matter

This is what each car has, two wheels, a square chasis and one speed for each wheel
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3080

 « Embed this message Reply #5 on: May 09, 2009, 12:35:11 am » posted from:Taipei,T\'ai-pei,Taiwan

I understand it better now. But I need more information:

1. Rule when car hit the wall?
2. Rule when two car collide?
3. Rule when car hit ball?

Because this is not an elastic collision. You need to specify what need to be changed when collision occured. i.e.
How to calculate final velocity for both objects after the collision from initial conditions.
What is the purpose for the simulation? Is it a study? or Is it just a game?
 Logged
pescamillam
Newbie

Offline

Posts: 7

 « Embed this message Reply #6 on: May 09, 2009, 03:42:18 am » posted from:BogotÃ¡,Cundinamarca,Colombia

1. The car will still try to keep the speed on the wheels when it hits the wall
2. The cars will try to keep moving, if one is applying more speed than the other it should push it
3. The car shouldn't be affected when it hits the ball unless this one is against something (another car or a wall), the ball should move according to car's angle and speed

The purpose for the simulation is an study to test some strategies we have developed for Robo World cup in my university
(here is a link of what I need to simulate http://www.youtube.com/watch?v=WByIWjswlPA )
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3080

 « Embed this message Reply #7 on: May 09, 2009, 03:15:11 pm » posted from:Taipei,T\'ai-pei,Taiwan

You request two wheels for the same car can have different speed: for example v1, v2
the center of mass of the car will move with speed (v1+v2)/2 and it will also rotate with angular velocity (v1-v2)/d where d is the distance between two wheels.

Quote
1. The car will still try to keep the speed on the wheels when it hits the wall
If both wheel keep the same speed when it hit the wall, it means that there is no wall: the car will pass through the wall.
But I believe the wall is there to limit the car to move inside the bounary. So there is something wrong in your rule.
Should the car turn around? if so how much to turn before move forward again (away from the wall).
If the car did not rotate when it hit the wall, there is no way to keep the car moving if you want to limit the car inside the boundary-- and the speed of both wheel is not the same any more.

Quote
2. The cars will try to keep moving, if one is applying more speed than the other it should push it
Do you mean they will move together (would not separate any more?)?
What is the rule to determine the final speed:  conservation of momentum?

Quote
3. The car shouldn't be affected when it hits the ball unless this one is against something (another car or a wall), the ball should move according to car's angle and speed
What is the equation to determine the speed of the ball when the car hit the ball?
The speed of the car should depend on which part of the car hit the ball and the speed of the car.
You need to provide the equation because you are making your own rule (and you did not tell me how to calculate it).

I know much better from the youtube movie link. It is not the quite same as what you have described above.
For example: the car stop moving forward when it hit the wall (unless user change the wheel speed to make it turn and change speed again to move forward again.

There is a big differences:
It seems that all the cars shown in the game are controled by different person. (Is it correct?)

It is possible to create simulation with many cars with different wheel speeds, however, it is difficult to control all of them at the same time.
Do you have any solution to control many cars in a java applets at the same time?
May be a client-server approach is a solution. But this is not a small project.
 Logged
pescamillam
Newbie

Offline

Posts: 7

 « Embed this message Reply #8 on: May 10, 2009, 12:27:41 am » posted from:BogotÃ¡,Cundinamarca,Colombia

Each team has an IA strategy thats what controls each robot so there is no need to worry about how to control them. For the applet test I think we would use some slide bars for each wheel speed.
The part of controlling the robots is already made, I know this isn't an easy project thats why I'm asking for help because the collision detection, the movement, the intelligence, strategies and drawing are done, the real problem I have is with after collision part.

This is a video I made of how the simulator is working right now as you can see the cars just try to move but the collision just makes them to go the place they were thats what must be changed. The ball just changes its angle after a collision with a wall and the speed depending on how much it "went" into the car.

 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3080

 « Embed this message Reply #9 on: May 10, 2009, 09:52:14 am » posted from:Taipei,T\'ai-pei,Taiwan

In the previous youtube, the speed of the ball is about the same or less than the speed of the robot.
Especially, when the ball pushed by the robot and move together, it means that the speed of the ball is smaller than the robot. (Or their relative speed is very small)

But the speed of the ball seems to be much larger than the robot in the last youtube (your simulation).
I noticed that near the end , when a ball collided with the robot(which is not moving), the ball stopped, too!
Is it possible that you did not use relative speed when you calculated the speed of the ball after collision?
(It seems that you use the speed of the robot only to calculate the speed of the ball after collision. so the speed of the ball become zero when the robot is stopped).
 Logged
pescamillam
Newbie

Offline

Posts: 7

 « Embed this message Reply #10 on: May 10, 2009, 11:26:11 am » posted from:BogotÃ¡,Cundinamarca,Colombia

thats the problem right now I'm not using forces or energy to calculate the exit angle and speed thats what I want to improve but I'm not really sure how to do it
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3080

 « Embed this message Reply #11 on: May 10, 2009, 11:57:39 am » posted from:Taipei,T\'ai-pei,Taiwan

For collision in 1 D:
The velocity of two objecs after collision (V1',V2')can be calculated from velocity before collisions (V1,V2) and mass of two objects (m1,m2).

V1'= (m1-m2)*V1/(m1+m2) + 2*m2*V2/(m1+m2)= (m1V1+m2V2)/(m1+m2)+(V2-V1)*m2/(m1+m2)=Vcm+(V2-V1)*m2/(m1+m2);

V2'=2*m1*V1/(m1+m2)+(m2-m1)*V2/(m1+m2)=(m1V1+m2V2)/(m1+m2)+(V1-V2)*m1/(m1+m2)=Vcm+(V1-V2)*m1/(m1+m2);

Where Vcm=(m1V1+m2V2)/(m1+m2);
Before the collision, the velocity of m1 relative to Vcm is
V1-Vcm=V1-(m1V1+m2V2)/(m1+m2)=m2(V1-V2)/(m1+m2)
compare it with the second term in V1'

For your case: if m1 is the mass of the ball, m2 is the mass for the robot.
Since m2>>m1
So
V1'=-V1+2V2
V2'=V2
Which means that : the speed of the robot did not changed after collision. But the speed of the ball will be changed (if the speed of the robot is zero, then the ball should be reflected with the same magnitude).

Because your case is a motion in 2 D (Please check out collision in 2D)

Before you can break 2D problems into two 1D problem
1: in the direction normal to the surface the ball hit the robot: calculate the component of velocity for both (ball and robot) into this direction. and use the above formula to calculate velocity after collision.
2. in the direction prependicular to the above direction (parallel to contact surface), the velocity should not change before and after collision (unless you want to include the friction force which change the rotation speed of the ball, but this is a small effect for your case, you can ignore it).

3. combined the velocity in 1,2 after to get velocity after collision.

 Logged
pescamillam
Newbie

Offline

Posts: 7

 « Embed this message Reply #12 on: May 11, 2009, 07:26:03 pm » posted from:BogotÃ¡,Cundinamarca,Colombia

Thank you, now I think I can fix the ball problem, I'll try to make it for today, but how can I simulate the car against car part?
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3080

 « Embed this message Reply #13 on: May 11, 2009, 09:56:13 pm » posted from:Taipei,T\'ai-pei,Taiwan

It seems that cars are active device controlled by some other peoples.
If two car heading other and both cars are exactly the same (power), the result is those two cars will against each other at their contact position.
However, if one of the car is moving toward east, and another one is moving toward north, then both car will move toward north east.
It means that you can calculate the velocity for the center of mass of the system as the same velocity for both cars after there make contact with each other (i.e. moving together), unless the people who control the car want to change  moving direction for her/his car.
 Logged
kittykat4
Newbie

Offline

Posts: 1

 « Embed this message Reply #14 on: May 14, 2009, 12:58:25 am »

this is an interesting discussion.. thank you for sharing
-*-
 Logged
 Pages: [1]   Go Up
"Vision, mission and action." ...Wisdom