コード例 #1
0
    # Definition of the front shape
    #io.addPrimitiveShape('Front', 'Box', (100, 0.5, 50.))

    # Definition of a non smooth law. As no group ids are specified it
    # is between contactors of group id 0.
    io.addNewtonImpactFrictionNSL('contact', mu=0.3)

    # The cube object made with an unique Contactor : the cube shape.
    # As a mass is given, it is a dynamic system involved in contact
    # detection and in the simulation.  With no group id specified the
    # Contactor belongs to group 0
    for i in range(n_row):
        for j in range(n_col):
            for n in range(n_cube):
                io.addObject('cubeCS' + str(n) + '_' + str(i) + '_' + str(j), [
                    Contactor('CubeCS' + str(n) + '_' + str(i) + '_' + str(j))
                ],
                             translation=[3.0 * i, 3.0 * j, 2.05 * (n + 1)],
                             velocity=[
                                 10 * (1.0 + 2.0 *
                                       (random.random() - 1.0) / 2.0), 10 *
                                 (1.0 + 2.0 * (random.random() - 1.0) / 2.0),
                                 0, 1, 1, 1
                             ],
                             mass=1)

    # io.addObject('cube2', [Contactor('CubePrim')], translation=[0, 3, 2],
    #              velocity=[10, 0, 0, 1, 1, 1],
    #              mass=1)

    # the ground object made with the ground shape. As the mass is
コード例 #2
0
ファイル: two_cubes.py プロジェクト: yushuiqiang/siconos
    # Alternative to the previous convex shape definition.
    io.addPrimitiveShape('CubePrim', 'Box', (2, 2, 2))

    # Definition of the ground shape
    io.addPrimitiveShape('Ground', 'Box', (100, 100, .5))

    # Definition of a non smooth law. As no group ids are specified it
    # is between contactors of group id 0.
    io.addNewtonImpactFrictionNSL('contact', mu=0.3)

    # The cube object made with an unique Contactor : the cube shape.
    # As a mass is given, it is a dynamic system involved in contact
    # detection and in the simulation.  With no group id specified the
    # Contactor belongs to group 0
    io.addObject('cube1', [Contactor('CubeCS')], translation=[0, 0, 2],
                 velocity=[10, 0, 0, 1, 1, 1],
                 mass=1)

    io.addObject('cube2', [Contactor('CubePrim')], translation=[0, 3, 2],
                 velocity=[10, 0, 0, 1, 1, 1],
                 mass=1)

    # the ground object made with the ground shape. As the mass is
    # not given, it is a static object only involved in contact
    # detection.
    io.addObject('ground', [Contactor('Ground')],
                 translation=[0, 0, 0])


# Run the simulation from the inputs previously defined and add
コード例 #3
0
    io.addPrimitiveShape('Mass2', 'Sphere', (r2, ))

    # Definition of the ground shape
    io.addPrimitiveShape('Ground', 'Box', (100, 100, .5))

    # the brick shape
    io.addPrimitiveShape('Brick', 'Box', (bx, by, bz))

    # Definition of a non smooth law. As no group ids are specified it
    # is between contactors of group id 0.
    io.addNewtonImpactFrictionNSL('contact', mu=0.1)

    # first branch + first mass the center of gravity is at the center of the
    # Mass1
    io.addObject('arm1', [
        Contactor('Mass1'),
        Contactor('Arm1', relative_translation=[0, r1 + l1 / 2., 0])
    ],
                 translation=[0, 0, r2 + gap + r2 + l2 + r1 + hgap],
                 orientation=((1, 0, 0), pi / 2),
                 mass=m1)

    # second branch + second mass
    io.addObject('arm2', [
        Contactor('Mass2'),
        Contactor('Arm2', relative_translation=[0, r2 + l2 / 2., 0])
    ],
                 translation=[0, 0, r2 + gap],
                 orientation=((1, 0, 0), pi / 2),
                 velocity=[0, 20, 0, 0, 0, 0],
                 mass=m2)
コード例 #4
0
ファイル: misc.py プロジェクト: yushuiqiang/siconos
    io.addNewtonImpactFrictionNSL('contact2',
                                  mu=0.7,
                                  collision_group1=1,
                                  collision_group2=1)

    # Definition of a non smooth law between groups 0 and 0
    io.addNewtonImpactFrictionNSL('contact3',
                                  mu=0.1,
                                  collision_group1=0,
                                  collision_group2=0)

    # A 'two boxes object made with two Contactors.
    # As a mass is given, it is a dynamic system involved in contact
    # detection and in the simulation.
    io.addObject('twoboxes', [
        Contactor('BigBox', collision_group=0, relative_translation=[0, 0, 0]),
        Contactor('LongBox', collision_group=1, relative_translation=[0, 0, 0])
    ],
                 translation=[0, 0, 3],
                 velocity=[10, 0, 0, 1, 1, 1],
                 mass=1)

    # the ground object made with the ground shape. As the mass is
    # not given, it is a static object only involved for contact
    # detection.
    io.addObject('ground', [Contactor('Ground', collision_group=1)],
                 translation=[0, 0, 0])

# Run the simulation from the inputs previously defined and add
# results to the hdf5 file. The visualisation of the output may be done
# with the vview command.
コード例 #5
0
ファイル: moving_block.py プロジェクト: yushuiqiang/siconos
    ground_slope = 0.29
    ground_size = (100., 400, 2.)
    io.addPrimitiveShape('Ground', 'Box', ground_size)
    io.addPrimitiveShape('Ground2', 'Box', ground_size)
    block_size = (50., 20., 20.)
    io.addPrimitiveShape('Block', 'Box', block_size)

    # Definition of a non smooth law. As no group ids are specified it
    # is between contactors of group id 0.
    io.addNewtonImpactFrictionNSL('contact', mu=0.3)

    #first branch + first mass the center of gravity is at the center of the
    #Mass1
    ppos = [0, -10., 15]
    io.addObject(
        'arm1', [Contactor('Mass1'),
                 Contactor('Arm1', relative_translation=[0, r1 + l1 / 2., 0])],
        translation=ppos,
        orientation=((1, 0, 0), pi / 2),
        velocity=[0, -5, 0, 0, 0, 0],
        mass=m1)

    io.addJoint('joint2', 'arm1',
                pivot_point=[ppos[0], ppos[1], ppos[2] + l1],
                axis=[1, 0, 0],
                joint_class='PivotJointR')

    # the ground object made with the ground shape. As the mass is
    # not given, it is a static object only involved in contact
    # detection.
    shift = -0.5 * ground_size[2] - sin(ground_slope) * ground_size[1] * 0.5
コード例 #6
0
ファイル: cube.py プロジェクト: yushuiqiang/siconos
    # Alternative to the previous convex shape definition.
    # io.addPrimitiveShape('Cube1', 'Box', (2, 2, 2))

    # Definition of the ground shape
    io.addPrimitiveShape('Ground', 'Box', (100, 100, .5))

    # Definition of a non smooth law. As no group ids are specified it
    # is between contactors of group id 0.
    io.addNewtonImpactFrictionNSL('contact', mu=0.3)

    # The cube object made with an unique Contactor : the cube shape.
    # As a mass is given, it is a dynamic system involved in contact
    # detection and in the simulation.  With no group id specified the
    # Contactor belongs to group 0
    io.addObject('cube', [Contactor('Cube')],
                 translation=[0, 0, 2],
                 velocity=[10, 0, 0, 1, 1, 1],
                 mass=1)

    # the ground object made with the ground shape. As the mass is
    # not given, it is a static object only involved in contact
    # detection.
    io.addObject('ground', [Contactor('Ground')], translation=[0, 0, 0])

# Run the simulation from the inputs previously defined and add
# results to the hdf5 file. The visualisation of the output may be done
# with the vview command.
with Hdf5(mode='r+') as io:

    # By default earth gravity is applied and the units are those
コード例 #7
0
  left_up_vertices=numpy.array([v1,v2,v3,v1_extruded,v2_extruded,v3_extruded])
  print left_up_vertices

  v1 = numpy.array([0, 0 , box_height])
  v2 = numpy.array([4.370-4.370*1.200/box_height,0.0, 1.200])
  v3 = numpy.array([ box_length, 0,1.200])
  v1_extruded = v1 + numpy.dot(plan_thickness,left_up_normal)
  v2_extruded = v2 + numpy.dot(plan_thickness,left_up_normal)
  v3_extruded = v3 + numpy.dot(plan_thickness,left_up_normal)

  left_up_vertices=numpy.array([v1,v2,v3,v1_extruded,v2_extruded,v3_extruded])
  print left_up_vertices

  io.addConvexShape('Left_up',left_up_vertices )
  io.addObject('left_up', [Contactor('Left_up')],
               translation=[0, 0, 0])

  
  ######### left_middle
  id_plan=id_plan+1
  body_collection['plan_id']["left_middle"]=id_plan

  v4 = numpy.array([4.370,1.280, 0.0])
  v5 = numpy.array([ 6.900-1.770, 1.280,0.0])

  left_middle_normal = normal_plane(v2,v4,v3)
  print('left_middle_normal=', left_middle_normal)

  v4_extruded = v4 + numpy.dot(plan_thickness,left_middle_normal)
  v5_extruded = v5 + numpy.dot(plan_thickness,left_middle_normal)
コード例 #8
0
    io.addPrimitiveShape('CubePrim2', 'Box',
                         (2 * edge_length, 2 * edge_length, 2 * edge_length))

    # Definition of the ground shape
    io.addPrimitiveShape('Ground', 'Box',
                         (plane_length, plane_length, plane_length / 10.0))

    # Definition of a non smooth law. As no group ids are specified it
    # is between contactors of group id 0.
    io.addNewtonImpactFrictionNSL('contact', mu=0.3, e=0.5)

    # The cube object made with an unique Contactor : the cube shape.
    # As a mass is given, it is a dynamic system involved in contact
    # detection and in the simulation.  With no group id specified the
    # Contactor belongs to group 0
    io.addObject('cube1', [Contactor('CubeCS1')],
                 translation=[0, 0, 2],
                 velocity=[
                     velocity_init, 0, 0, angular_velocity_init,
                     angular_velocity_init, angular_velocity_init
                 ],
                 mass=1)

    io.addObject('cube2', [Contactor('CubeCS2')],
                 translation=[0, 0, 2 + 3 * edge_length],
                 velocity=[
                     velocity_init, 0, 0, angular_velocity_init,
                     angular_velocity_init, angular_velocity_init
                 ],
                 mass=1)