Dijkstra's algorithm


Hi,
I have implemented the dijkstra’s algorithm in unit 2. But when i ran the algorithm it shows the above error. Please help me where i am making mistake?

Please provide more details:

  • which command are you running?
  • The full output of the terminal
  • which map are you providing and where in the code
  • any other relevant data

Hi @rtellez , it is course “basics of path planning” unit 2.
I have implemented the Dijkstra’s algorithm in the given file “unit2_exercise.py”.
I have used the following command:
roslaunch unit2 unit2_exercise.launch

Map: given in the course map : (launch file )catkin_ws/src/path_planning_course/unit2/maps/map_unit2_74x74x20cm.pgm

I didnt tweaked any code in unit2_exercise_server.py.

Also, I have made sure correctness of Dijkstra’s algorithm and added few print statements for understanding purpose. But I cant debug that code individually. I need to run the launch file only? Also help me about how to degug individual py file in ros env?

Thanks in advance!

Hello @dhanaprakaashg,

you have not provided the exercise number in which you are currently in, so I must assume that you have followed and completed all these exercises:

  • Exercise 2.7.1
  • Exercise 2.7.2
  • Exercise 2.7.3
  • Exercise 2.7.4

This is important, because only after having complete all exercises the algorithm will be complete and run without this error. If the algorithm is not complete you will get the error that you see (just as described in the course in Exercise 2.3.1).

All exercises ( Exercise 2.7.1, Exercise 2.7.2, Exercise 2.7.3, Exercise 2.7.4) provide a solution, you can click on “Click HERE for the solution” and it will be displayed. Use this feature after having written your own solution and use it to correct any issues that you might realize in your code.

Now, if you are still stuck, there is also a solution launch file:
roslaunch unit2 unit2_solution.launch

And a python script to compare your file with against it, it is this one here: ~/catkin_ws/src/path_planning_course/unit2/scripts/unit2_solution.py

Please compare the solution your own file to find out where your have an error. I recommend to analyze and really understand why there was a mistake in your code, this way you will learn and gain the most knowledge out of it.

Should you have any other doubt, don’t hesitate to reach out again here at the forum.

Regards,

Roberto

1 Like

Hi @rzegers, Thanks a lot for your suggestions. I will work out those !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.