ivogeorg / FCND-Motion-Planning

Udacity FCND Project 2 - Planning in complex urban environment using udacidrone API
1 stars 0 forks source link

Hanging after `takeoff_transition` #16

Open ivogeorg opened 1 year ago

ivogeorg commented 1 year ago

The code irregularly hangs after takeoff_transition, possibly related to the messaging protocol (e.g. blocking waiting for message receive).

ivogeorg commented 1 year ago

Suspected dependence on long planning. If path planning is pulled up before the sequence of state transitions (#18), this might provide a clue.

ivogeorg commented 1 year ago

Limited goal distance to a small square around the start, but long paths still cause hanging. So do the impossible paths to goals that are unobstructed themselves but are enclosed by obstacles. The last would be solved perfectly by a bi-directional algorithm, which would stop advancing very soon after starting.

Clue: Once the program hangs after takeoff_transition, restarting python motion_planning.py doesn't fix the problem. The simulator needs to be reset.

ivogeorg commented 1 year ago
(fcnd) orbital@yocto-sandbox:~/git-repos/FCND-Motion-Planning$ /home/orbital/miniconda3/envs/fcnd/bin/python /home/orbital/git-repos/FCND-Motion-Planning/motion_planning.py
Logs/TLog.txt
Logs/NavLog.txt
starting connection
arming transition
Global home :  [-122.3974533   37.7924804    0.       ]
Global position:  [-122.3971478   37.7905706    0.207    ]
Local position:  [-2.12161575e+02  2.71234398e+01 -2.04146892e-01]
North offset = -316, East offset = -445
Starting from current position
Grid position (105, 474) is obstructed
Looking for an adjacent clear position...
Found clear grid position (104, 473)
Grid position (158, 483) is obstructed
Looking for an adjacent clear position...
Found clear grid position (166, 496)
Local Start and Goal:  (104, 473) (166, 496)
Searching for a path ...
**********************
     Found path!      
**********************
Path length:  285
Sending waypoints to simulator ...
takeoff transition
^CTraceback (most recent call last):
  File "/home/orbital/git-repos/FCND-Motion-Planning/motion_planning.py", line 415, in <module>
    drone.start()
  File "/home/orbital/git-repos/FCND-Motion-Planning/motion_planning.py", line 369, in start
    self.connection.start()
  File "/home/orbital/git-repos/FCND-Motion-Planning/udacidrone/connection/mavlink_connection.py", line 235, in start
    self.dispatch_loop()
  File "/home/orbital/git-repos/FCND-Motion-Planning/udacidrone/connection/mavlink_connection.py", line 113, in dispatch_loop
    msg = self.wait_for_message()
  File "/home/orbital/git-repos/FCND-Motion-Planning/udacidrone/connection/mavlink_connection.py", line 199, in wait_for_message
    msg = self._master.recv_match(blocking=True, timeout=1)
  File "/home/orbital/miniconda3/envs/fcnd/lib/python3.6/site-packages/pymavlink/mavutil.py", line 355, in recv_match
    self.select(timeout/2)
  File "/home/orbital/miniconda3/envs/fcnd/lib/python3.6/site-packages/pymavlink/mavutil.py", line 212, in select
    (rin, win, xin) = select.select([self.fd], [], [], timeout)
KeyboardInterrupt
(fcnd) orbital@yocto-sandbox:~/git-repos/FCND-Motion-Planning$ 
ivogeorg commented 1 year ago

Once the application hangs and is interrupted with Ctrl-C, consecutive restarts also hang (with some rare exceptions). The simulator has to be reset with Shft-R.