Issue with creating ROS-based block (Python)

Dear Yonohub Team,

I followed this tutorial to create a ros-based Python block and it worked as expected. However, when trying to create a ros-based block with Python code instead of C++ and following the same steps, the Python code of my block is not visible in step 4 “Configure the Splitter Block” in the linked tutorial (Please see the image below)

.
I can only see entries related to the libraries used, e.g. sensor_msgs. Why is my Python file not detected?

Thanks,
Rizanne

Can you please change the permissions of the Python file to make it executable?

chmod +x algorithm.py

Please let me know if this fixes the issue so that I can close the ticket.

Thanks for the reply.

I changed the permission of the file using Jupyter by accessing the directory in MyDrive where the file is, then rebuilt. I tried again after it was release-ready but unfortunately it didn’t work.
Is there anything wrong with the sequence I followed?

could you try building your project from a gitlab repo where the python file’s permission is already changed to executable.

Thanks Ibrahim.
I built from gitlab and now the Python file is visible.
I reach the point where I should edit input ports, output ports and properties:


What are the correct values for the keys of the ports? I believe they should be obtained from the code? The following lines in the code create the publisher and subscriber (as far as I understand):
self.data_sub = rospy.Subscriber(’/’ + topicName + ‘/Mics’, MicsArray, self._calbak)
self.modelpub = rospy.Publisher(’/’ + topicName + ‘/SndClass’, Bool, queue_size=1)
self.img_pub = rospy.Publisher(‘Classifier/image’, Image, queue_size=1)
So, for example should the input port have key “Mics” and an arbitrary name? or should the value of topicName be included in the key?

Thanks,
Rizanne

As mentioned in the docs, key is unique and without spaces. In YonoArc APIs, use it to identify the port of the incoming/outgoing message.

Key is arbitrary, so you can use anything. It doesn’t have to match the topic name you use inside the ROS node.

Please find the docs for all the block attributes here.

I will close this issue since it is resolved by having the Python file executable, which is required by ROS.

Ok, thanks for the reply.