Bot'n Roll ONE A+ - Raspberry Pi 5 library
 
Loading...
Searching...
No Matches
onepi.utils.shape_generator.ShapeGenerator Class Reference

Public Member Functions

 __init__ (self, BnrOneAPlus one, slip_factor=1.0, robot_params=RobotParams())
 
PoseSpeeds rotate_angle_deg_at_speed (self, angle_deg, speed=50, radius_of_curvature_mm=0, slow_down_thresh_deg=0)
 
 move_straight_at_speed (self, distance, speed=200, slow_down_distance=0)
 
PoseSpeeds rotate_90_deg_ccw (self, speed, slow_down_thresh_deg=30)
 
 polygon (self, side_mm, num_sides, speed=200)
 
 rounded_polygon (self, side_mm, num_sides, speed=200)
 
 triangle (self, side_mm, speed=200)
 
 square (self, side_mm, speed=150)
 
 circle (self, radius_mm, speed=200)
 
 semi_circle (self, radius_mm, speed=200)
 
 fibonacci_spiral (self, seed_radius, num_segments, speed=200)
 
 archimedean_spiral (self, spiral_factor, total_angle_deg, speed=200)
 
 snake (self, length_mm=700, num_elements=7, speed=50, snaking_angle_deg=60, turning_rate_deg=0)
 
 heart (self)
 

Protected Member Functions

 _compute_fibonacci_sequence (self, number_of_elements)
 

Protected Attributes

 _mg = MotionGenerator(one, slip_factor, robot_params)
 

Member Function Documentation

◆ _compute_fibonacci_sequence()

onepi.utils.shape_generator.ShapeGenerator._compute_fibonacci_sequence ( self,
number_of_elements )
protected
computes a fibonacci sequence with a predetermined number of elements
Note: number_of_elements should be more than 1

◆ archimedean_spiral()

onepi.utils.shape_generator.ShapeGenerator.archimedean_spiral ( self,
spiral_factor,
total_angle_deg,
speed = 200 )
The archimedean spiral has an increasing radius of curvature
radius_of_curvature = a * theta, where a is a constant (spiral_factor)

◆ circle()

onepi.utils.shape_generator.ShapeGenerator.circle ( self,
radius_mm,
speed = 200 )
describes a circular motion with radius given as input parameter

◆ fibonacci_spiral()

onepi.utils.shape_generator.ShapeGenerator.fibonacci_spiral ( self,
seed_radius,
num_segments,
speed = 200 )
The fibonacci spiral changes the radius of curvature every 90 degrees
according to the fibonacci sequence:
1, 1, 2, 3, 5, 8, 13, ...

The seed_radius is the initial radius of the spiral.
num_segments specifies the number of segments of 90 degrees of the spiral.

◆ heart()

onepi.utils.shape_generator.ShapeGenerator.heart ( self)
example on how to set a motion with the shape of a heart

◆ move_straight_at_speed()

onepi.utils.shape_generator.ShapeGenerator.move_straight_at_speed ( self,
distance,
speed = 200,
slow_down_distance = 0 )
wrapper for move_straight_at_speed in motion_generator

◆ polygon()

onepi.utils.shape_generator.ShapeGenerator.polygon ( self,
side_mm,
num_sides,
speed = 200 )
describes a polygon shaped motion given the side length and the number of sides

◆ rotate_90_deg_ccw()

PoseSpeeds onepi.utils.shape_generator.ShapeGenerator.rotate_90_deg_ccw ( self,
speed,
slow_down_thresh_deg = 30 )
generate a spot rotation of 90 degrees counterclockwise

◆ rotate_angle_deg_at_speed()

PoseSpeeds onepi.utils.shape_generator.ShapeGenerator.rotate_angle_deg_at_speed ( self,
angle_deg,
speed = 50,
radius_of_curvature_mm = 0,
slow_down_thresh_deg = 0 )
wrapper for rotate_angle_deg_at_speed in motion_generator

◆ rounded_polygon()

onepi.utils.shape_generator.ShapeGenerator.rounded_polygon ( self,
side_mm,
num_sides,
speed = 200 )
describes a polygon shaped motion given the side length and the number of sides

◆ semi_circle()

onepi.utils.shape_generator.ShapeGenerator.semi_circle ( self,
radius_mm,
speed = 200 )
describes a semi-circle motion with radius given as input parameter

◆ snake()

onepi.utils.shape_generator.ShapeGenerator.snake ( self,
length_mm = 700,
num_elements = 7,
speed = 50,
snaking_angle_deg = 60,
turning_rate_deg = 0 )
describes an ondulatory motion (like a snake)
All arguments are optional.
You can specify the length of the motion, the number of ondulatory elements and the speed.
By adjusting the snaking angle you can tween the amplitude of the ondulatory motion.
And by setting a turning rate you can also curve the ondulatory motion.
By adjusting these last two parameters you can create interesting moving patterns.

◆ square()

onepi.utils.shape_generator.ShapeGenerator.square ( self,
side_mm,
speed = 150 )
describes a quared motion with side given as input parameter

◆ triangle()

onepi.utils.shape_generator.ShapeGenerator.triangle ( self,
side_mm,
speed = 200 )
moves by decribing a triangular motion with side given as the input parameter

The documentation for this class was generated from the following file: