Ros2 Basics in 5 Days (Pthon), Unit 4 Quiz, List index out of range

Hello,

I got some error in quiz 4 when I’m launching the client with “ros2 launch services_quiz services_quiz_client.launch.py” :

My Client code is:

When I am calling the service with “ros2 run services_quiz services_client “Left” 2.0 2” it’s work properly.

Why do I get the error? what’s should be my lists indexes so they won’t get out of range?

Thank you

Could it be that the launch file is not inputting the values when calling the program? That would mean that there are less (or none) elements in sys.argv and the IndexError would make sense. Could you please share the contents of your launch file?

Client Launch File:
Client Launch File

How do I input values in the launch file? I don’t remember that from previous examples

Solved. It was a misunderstanding of the quiz. Now all work good.
Thank you for the help

1 Like

This topic was automatically closed after 20 hours. New replies are no longer allowed.