Topics are not accepted on the site(shell) (nanosaur, OpenClass#134)

I’m looking at OpenClass #134 using nanosau.
I set up a Real-Robots on the site and put a command into my robot.
I ran the ‘$ros2 topic list’ on the shell, but the robot’s topic didn’t come in.
I looked up several ways and tried again, but I failed.

If anyone has had the same experience as me and solved it, please let me know.
Or please let me know how to download the code on the site or use it in other ways.

Include relevant links and pictures of my topic.
ROS Developers OpenClass #134

Hi, welcome to the community!

There are a couple of things that you have to check:

  1. Is the robot turned on and with its ROS 2 drivers running?
  2. Are you able to control the robot locally if you SSH into it?
  3. Make sure your robot’s .bashrc is sourced again after our script installation and before running the robot drivers.

Thank you for suggesting a way.

I tried it but it didn’t work out.

The topic doesn’t come up in theconstruct, but when I access $source nanosaur command or ssh on my pc and check the status, it works fine.

I will ping my colleague @ralves here who will be able to help you more.

Hi @kazimciit,

in that Open Class we see that Alberto used Docker to launch the ROS2 nodes in the robot.

Could you tell us if you are using Docker, or running ROS2 directly on the host computer?

If you run the command below:

env |egrep 'RMW|CYC'

Do you have the output below?

CYCLONEDDS_URI=file:///var/lib/theconstruct.rrl/cyclonedds.xml
RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

If you are using docker, the command I mentioned above should be executed inside the Docker Container.

If using Docker, can you check the content of the file below?

cat /var/lib/theconstruct.rrl/cyclonedds.xml

Also, many times we cannot see the topics because we may be using different DOMAIN IDs.

If you check the ROS_DOMAIN_ID variable where ROS is running, what do you have in the output?

echo $ROS_DOMAIN_ID

If you see nothing, then it means the robot is running with ROS_DOMAIN_ID=0, because “0” is the default.

If you have any number different from zero, then this is the reason. If that is the case, you would have to export the same domain ID in the rosject terminal, kill the ros2 daemon and list the topics again, something like this:

export ROS_DOMAIN_ID=SAME_DOMAIN_AS_IN_THE_ROBOT

ros2 daemon stop

ros2 topic list

ros2 topic list

ros2 topic list

Also, if you had the nodes running in the robot before setting up the robot connection to The Construct, you may also have to stop the ros2 daemon in the robot.

I suppose you have sourced “source ~/.bashrc” before running the ROS2 nodes in the robot, right?

A simple test that I do is the following, after installing the script provided by The Construct:

  1. source ~/.bashrc
  2. Publish a simple message in the robot:
ros2 topic pub  /my_test_topic std_msgs/msg/String data:\ \'Alive\'\
  1. THen, in the rosject terminal I list the topics:
ros2 topic list

If it fails, I just try ros2 topic list again.

  1. If I can see the topic, I do a ‘ros2 topic echo’ on the rosject terminal:
ros2 topic echo /my_test_topic

If this simple test does not work, it means you may have a different ROS_DOMAIN_ID set or something else.

If this simple test does not work, then you have to solve whatever is pending to be solved.

Please let us know how your tests go.

Thank you for explaining the detailed process.

I proceeded one by one and found a problem.

Cyclonedds.xml in core_1(docker) exists as a directory, not as a file.
I cannot run cyclonedds.xml with the cat command.
I can go into cd command but nothing.

Please let me know if you know the solution.

Hi @kazimciit,

ok, if /var/lib/theconstruct.rrl/cyclonedds.xml is a folder instead of a file, it means that the docker was launched before you ran the script for connecting the robot to The Construct.

If /var/lib/theconstruct.rrl/cyclonedds.xml is a folder in the host, the process is the following:

  1. Stop the docker containers that are running
  2. If that is still a folder, remove that cyclonedds folder:
sudo rm -rfv /var/lib/theconstruct.rrl/cyclonedds.xml
  1. Restart the theconstruct.rrl service so that the XML file is created:
sudo service theconstruct.rrl restart

If it fails to launch that service, then you may have failed to setup the robot connection. Just run again the script provided by The Construct when setting up the robot.

  1. After a few seconds that you restarted theconstruct.rrl, the file cyclonedds file should be a file rather than a folder:
cat /var/lib/theconstruct.rrl/cyclonedds.xml
  1. If you now run Docker, it’s going to mount the file correctly, and you should be able to see the topics, BUT I suggest you to modify the docker-compose.yaml file in the following way:
    5.1 Instead of mounting the following volume
/var/lib/theconstruct.rrl/cyclonedds.xml:/var/lib/theconstruct.rrl/cyclonedds.xml

5.2 Mount the parent folder only (in the volumes section of the docker-compose.yaml file :

/var/lib/theconstruct.rrl/:/var/lib/theconstruct.rrl/

5.3 This way, you won’t have that cyclonedds.xml folder created.

The reason why it is a folder instead of a file is that DOcker automatically creates a folder when you try to mount a volume into a container but the file does not exist.

If you read carefully the instructions I put here, you will see that we restart the theconstruct.rrl service after stopping Docker for the file to be created. And the point 5.2 is to avoid creating a folder even if the file does not exist, so, when the theconstruct.rrl starts, the file will be created nicely because there won’t be a folder with the same name.

Please let us know how your tests go.

Thank you for your kind explanation again this time.

Unfortunately, I proceeded with the way you described it, but cyclonedds.xml still existed as a folder inside the docker.

I tried to re-install nanosaur and proceed with it by referring to how I explained it.
But this time, there is a problem that the theconstruct.rrl is not installed inside the docker.

The reply was delayed because I repeated the reinstallation to solve this problem.
I haven’t solved it yet and I can’t focus on nanosaur.

I don’t know how long it will take, but I’ll try again whenever I have time and I’ll write again if there’s a good result.
Thank you to the members of The Construct for helping me with my problems.

Hi @kazimciit,

If the folder still exists, I think you missed some step, because after doing the things in order, the folder should not exist anymore.
Remember, the steps IN ORDER are:

  1. Stopping docker containers
  2. Removing the folder
  3. Restarting the theconstruct.rrl service
  4. Modifying docker-compose.yaml to mount /var/lib/theconstruct.rrl/ instead of /var/lib/theconstruct.rrl/cyclonedds.xml

About theconstruct.rrl not being installed inside the Docker, this is not a problem. I is to be installed really only in the host computer, not in the Docker. When you mount the /var/lib/theconstruct.rrl/ folder inside the Docker, then ROS2 inside the Docker can connect to The Construct rosject.

Please, just try to follow the instructions carefully and you see that it will work.

I’m here in case you need further help.