I followed the instructions for this assignment and was able to get it to work correctly once and then I moved onto the quiz and that did not let me compile anything. I now returned to the exercise above the quiz, and it no longer works and seems very glitchy. I have restarted the software, and this does not fix anything.
Based on your description, it sounds like you are trying to run a service client node that has worked as expected before.
The most likely reason for this is that the terminal you are running the command in hasn’t sourced the workspace correctly. For this, you can simply run source ~/ros2_ws/install/setup.bash before trying to run the node again.
I am curious when you say
I moved onto the quiz and that did not let me compile anything.
Does that mean that your workspace is not compiling correctly? This would also explain the package not being found. Could you share a little more information on the error output if that’s the case?
This was also what I was thinking when initially debugging and tried running source ~/ros2_ws/install/setup.bash with no success. I was not able to compile anything correctly in the quiz when attempting it and I used up many of my quiz attempts because of this. I then tried the exercise above the quiz to see if that could still compile and it also could not. I finally switched PC’s after restarting on my current PC with no success and the problem seemed to resolve using the same exact code on the same account. I was hoping you could reset my quiz attempts because this seems to be a bug in the software if I used the same exact setup on a different PC and had no issues.
To further on this issue I just attempted to return to the original PC that seems to be having trouble. I just re-ran the colcon build and setup.bash commands for both srv packages and the package holding the client/ server. After re-building everything I am able to run the server launch file in terminal 1 but cannot run the turn left turn right commands in terminal 2. This however works fine with the same code on a different PC and I am able to see the simulation run correctly. I also seem to not be able to drop more than one screenshot in this message box showing terminal 1 and 2.
Hi @boyercd, you now have more attempts, but here is the thing:
It is really hard to understand what you are talking about without more context and just a couple of long paragraphs, that is why I asked for terminal outputs.
I really doubt that this is a software issue as you claim, since this is most likely confusion over sourcing a workspace before you run ROS 2 nodes. Screenshots are also very helpful, and snippets of code.
What you are doing in this quiz is the following:
Run a service server node.
Run a service client node.
That is it. I believe compilation is introducing confusion on what you are trying to achieve here.
You say
I was not able to compile anything correctly in the quiz when attempting it and I used up many of my quiz attempts because of this.
This doesn’t make sense. Please do not submit your quiz if you compilation does not complete successfully. If your workspace doesn’t compile correctly, then you can’t expect that running any nodes in that workspace will work.
I really don’t understand what you mention about a separate PC, so let me clarify some things.
If you mean that you switchet to another PC and then opened The Construct on your browser, then that is exactly the same thing. The workspace will be saved and is the same in every computer you open this course on.
You say that
After re-building everything I am able to run the server launch file in terminal 1 but cannot run the turn left turn right commands in terminal 2. This however works fine with the same code on a different PC and I am able to see the simulation run correctly.
If you mean that you compiled the workspace on a different PC, then you must mean that you downloaded the workspace and compiled it in the different PC, and that this PC is a Linux machine. If the code is the same, the it must be a sourcing issue.
So basically,
You claim running the server works fine, but not the client, after a rebuild. This is because you didn’t source the workspace in the terminal you ran your client in after the compilation. This would also explain why sometimes it works and sometimes it doesn’t.
Make sure there are two executables setup in setup.py, once for your server and one for your client.
Try to call the server without the client! once you run the server, you’ll see that there is a service advertised with ros2 service list. You can call it by doing ros2 service call /service_name [service_type] [data]. If this works, then this means there is a problem with your client node.
I was able to pass all the marks for the services quiz and have moved on. I found that there seems to be a glitch where if something does not execute correctly and then I try to re-run the launch files I get errors. I found that exiting the construct web browser did not help but reloading all the terminals, IDE, and simulation every time seemed to clear whatever error was present.