Closed belledon closed 4 years ago
here is some reference code to get things started (not debugged yet)
You can now specify initial velocities when you add objects to a ramp scene (note this is a new, 3ball class, from galileo_ramp import Ball3World, Ball3Sim
)
In the new sim class Ball3Sim
this gets passed to pybullet and updates initial velocities
with the above code (that you will probably have to debug a little) can you please make an aptly named script that for now generates 1 trial with two parts, where A:B:C is 1:1:1 but after AB collision, the ratio becomes 1:2:1
The way I would go about this is instead of just saving the scene.json in https://github.com/CNCLgithub/galileo-ramp/blob/26231526e56e353930ff4c4d5ff8ede131860c23/scripts/stimuli/create_3ball_scene.py#L73-L75, I would have the trial be a directory that contains several files:
trial # /
first_scene.json # A:B:C = 1:1:1
first_trace.npy # simulation of first_scene
second_scene.json # A:B:C = 1:2:1
second_trace.npy # simulation of second scene
full_trace.npy # just a concatenation of the two traces to have a seamless trace
take a look at https://github.com/CNCLgithub/rigid_body_world/blob/master/examples/marbles.py to see how to use scene data to create a simulation.
The output of simulation is a few matrices where the rows represent time. the first matrix pla
is a Tx3XNx3
array where N
is the number of objects. The second axis is either positions (0), linear velocity (1) and angular velocity (2). The second array, rot
is a TxNx4
describe the rotation of each object as a quaternion (wxyz). lastly cols
describes a collision map that you can use to find the time stamp of collision
The dataset class that is used under the hood for allot of the code does something very similar https://github.com/CNCLgithub/galileo-ramp/blob/26231526e56e353930ff4c4d5ff8ede131860c23/galileo_ramp/exp1_dataset.py#L92-L109
You should be able to
t = c
the same way the dataset code doest = c + 1
and pass it into 3BallWorld
3BallSim
to simulate the second stagenp.save
@jeffzma2000 ,
For the next stage of the experiment we need to generate stimuli where the second ball, B, has a change in mass between collisions AB and BC.
There are several ways to go about this (open to suggestions) but I think the simplest method is as follows:
t = c+1
).t = c+1
).