DexterInd / GoPiGo3

The GoPiGo3 is a Raspberry Pi Robot!
https://gopigo.io
Other
98 stars 85 forks source link

Obstacle detection #290

Closed CleoQc closed 2 years ago

CleoQc commented 3 years ago

A few changes with this.

  1. the class will now keep track of the three DI sensors, if they are instantiated through their corresponding init_ method. This means it will now be possible to use gpg.distance_sensor for example. CAVEAT: this does not support multiple distance_sensors on the robot, just one. Any extra distance sensors would need to be tracked outside of the easygopigo3 instance.
  2. the drive_inches and drive_cm method now support an extra parameter: dist_to_obstacle. If this value is non-zero, and the distance sensor was instantiated using the init_distance_sensor method, the the drive_cm/drive_inches may get interrupted if an obstacle is detected before reaching the target.
  3. the init method has an extra parameter run_init which will determine whether we set some robot parameters or not. This is required if/when the robot is controlled via multiple processes.
CleoQc commented 2 years ago

Will revisit this issue and do a new PR.