Rosject 1 support

Hi there, I am working on rosject 1, but I am facing few problems .

The first problem is the error whose screenshot is attached below

. I have made a package named wall and I am importing srv from it but it is showing no module error. Below is the screenshot of my package structure.
. Can someone tell me what am I doing wrong here. Thanks

  1. The other problem pertains to the subscriber and service. Both of them are associated with callback function but here my question is whether we need to have two different functions for both of them or can we have only one function. Please check the code below and let me know what is the right approach, thanks.

Hi,

For the first issue, check that you have compiled ( catkin_make) and that you sourced it ( source devel/setup.bash )
Then check with rossrv show that your services are there ( check the unit of custom services of ROS basics course )

As for the second, normally the best way to do this is to encapsulate all in a class so that you have access to the data from the subscriber and then use it anywhere ( in the service callback for example ).

Hi, do I need to learn python course to know about this encapsulation or is the classes in python topic of ros in 5 days course sufficient, or should I do both. Thanks

I would do both, because the python course is focused on python related topics. Once you know that, ROS basics will be a bit easier

1 Like

Thanks a lot for your help, one last thing, do you know about any example where I can see how the subscriber data is encapsulated inside a class and then used in the service callback. This is the step where I am bit confused, until now I was using procedural programming for all the tasks, so I am finding it bit diffcult. After this I will be able to finish services part of Rosject. For the procedural way, I will have to define, two functions, one for the subscriber and other function for the service but I don’t want that because the scan readings start without me calling the service which I don’t want. Thanks

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