roboball2d.ball_gun package¶
Submodules¶
roboball2d.ball_gun.default_ball_gun module¶
-
class
roboball2d.ball_gun.default_ball_gun.
DefaultBallGun
(ball_config)¶ Bases:
object
A ball gun provides, via its method ‘shoot’, an initial ball position (x,y), angle (radian), linear velocity (vx,vy) and angular velocity (or spin). Users can use an instance of DefaultBallGun, as documented here, or create new ball guns objects (which just need to implement a ‘shoot’ method).
DefaultBallGun initialize balls by sampling normal distribution to determine the balls initial positions and velocities. User code may change the values of the attributes after construction to match his/her need
- initial_pos_x : float
- in meters
- initial_height_mean : float
- in meters
- initial_height_std : float
- in meters
- speed_mean : float
- in meters per second
- speed_std : float
- in meters per second
- spin_std : float
- in radians per second
- vel_angle_min : float
- in radians per second
- vel_angle_max : float
- in radians per second
Creates an instance of ball gun setting default values to all attributes.
- ball_config :
roboball2d.ball.BallConfig
- used to set the radius of the ball that will be shot
-
__init__
(ball_config)¶ Creates an instance of ball gun setting default values to all attributes.
- ball_config :
roboball2d.ball.BallConfig
- used to set the radius of the ball that will be shot
- ball_config :
-
initial_height_mean
¶
-
initial_height_std
¶
-
initial_pos_x
¶
-
shoot
()¶ - a list: position (x,y),angle (radian),
- linear_velocity (vx,vy), angular_velocity (or spin, radian per second). These values are created by sampling the normal distributions.
-
speed_mean
¶
-
speed_std
¶
-
spin_std
¶
-
vel_angle_max
¶
-
vel_angle_min
¶
roboball2d.ball_gun.drop_ball_gun module¶
-
class
roboball2d.ball_gun.drop_ball_gun.
DropBallGun
(x, y)¶ Bases:
object
Drops a ball, with zero initial velocities, from a desired position. See :py:method:`roboball2d.physics.b2_world.B2World.reset`
- x : float
- horizontal position
- y : float
- vertical position
- x : float
- horizontal position from which the ball will be droped
- y : float
- vertical position from which the ball will be droped
-
__init__
(x, y)¶ - x : float
- horizontal position from which the ball will be droped
- y : float
- vertical position from which the ball will be droped
-
shoot
()¶ - a list: position (x,y),angle (radian),
- linear_velocity (vx,vy), angular_velocity (or spin, radian per second). The angle and the velocities will be zeros