Skip to content
Prev Previous commit
add doc and remove debug prints
  • Loading branch information
knmcguire committed Mar 30, 2023
commit db3f5ab90e215a6355abbe7780906100c0822a86
5 changes: 4 additions & 1 deletion examples/multiranger/multiranger_wall_following.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@

This examples uses the Flow and Multi-ranger decks to measure distances
in all directions and do wall following. Straight walls with corners
are advised to have in the test environment
are advised to have in the test environment.
This is a python port of c-based app layer example from the Crazyflie-firmware
found here https://github.com/bitcraze/crazyflie-firmware/tree/master/examples/
demos/app_wall_following_demo

For the example to run the following hardware is needed:
* Crazyflie 2.0
Expand Down
9 changes: 5 additions & 4 deletions examples/multiranger/wall_following/wall_following.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
Helper class for the wall following demo

This is a python port of c-based app layer example from the Crazyflie-firmware
found here https://github.com/bitcraze/crazyflie-firmware/tree/master/examples/
demos/app_wall_following_demo

"""
import math
from enum import Enum
Expand Down Expand Up @@ -161,9 +166,6 @@ def wall_follower(self, front_range, side_range, current_heading,
# Handle state transitions
match self.state_wf:
case self.StateWF.FORWARD:
print('front', front_range)
print('ref_distance_from_wall', self.ref_distance_from_wall)
print('buffer', self.ranger_value_buffer)
if front_range < self.ref_distance_from_wall + self.ranger_value_buffer:
self.state_wf = self.transition(self.StateWF.TURN_TO_FIND_WALL)
case self.StateWF.HOVER:
Expand All @@ -187,7 +189,6 @@ def wall_follower(self, front_range, side_range, current_heading,
case self.StateWF.TURN_TO_ALIGN_TO_WALL:
align_wall_check = self.logic_is_close_to(
self.wrap_to_pi(current_heading - self.prev_heading), self.wall_angle, self.angle_value_buffer)
print(self.wrap_to_pi(current_heading - self.prev_heading), self.wall_angle)
if align_wall_check:
self.state_wf = self.transition(self.StateWF.FORWARD_ALONG_WALL)
case self.StateWF.FORWARD_ALONG_WALL:
Expand Down