Error exercise 6.3

Hi, I got an error in exercise 6.3 and I need your help to solve it.
While I’m opening the server, I get the following error:

My package = exercise_63
The files in my folders are:
launch: start_bb8_move_custom_service_server.launch


src:
bb8_move_custom_service_server.py

I have built the new service message (MyCustomServiceMessage.srv) in the package: my_custom_srv_msg_pkg according to the Unit6 theory of the course.

Could you help me ?

Thank you very much

Hi,

Have you compiled your workspace and source it? This error usually means that.

You can check this with

roscd my_custom_srv_msg_pkg

if nothing happens, then it needs to be compiled

Hello.
My query isn’t exactly the same, but its a small one related to exercise 6.3 itself. So not creating a new topic altogether. I wrote the following python code for bb8_move_custom_service_server.py :

#! /usr/bin/env python

import rospy
from my_custom_srv_msg_pkg.srv import MyCustomServiceMessage, MyCustomServiceMessageResponse
from geometry_msgs.msg import Twist

def callback(request):
    my_response = MyCustomServiceMessageResponse()
    i=0
    while i<=request.duration:
        move.linear.x=0.3
        move.angular.z=0.3
        rate.sleep()
        i=i+1
    else:
        move.linear.x=0
        move.angular.z=0
        my_response.success = True
        return my_response
    pub.publish(move)
    

rospy.init_node('circling_ex_63')
move_bb8_in_circle_custom=rospy.Service('/move_bb8_in_circle_custom', MyCustomServiceMessage, callback)
move=Twist()
pub = rospy.Publisher('/cmd_vel', Twist, queue_size=1)
rate=rospy.Rate(1)
rospy.spin()


I run the file in first terminal –

rosrun unit_5_services bb8_move_custom_service_server.py

and call the service in second terminal using (duration 15 I write after pressing TAB-TAB)–

rosservice call /move_bb8_in_circle_custom "duration: 15"

In second terminal, I get the output –

success: True

But robot does not move at all. It keeps standing at the same place. May i please know what is wrong with my code?
Thank You.

Good Morning,
I have followed your recommendations (Image 1) and I still get the same error (Image 2).
I have noticed that the devel/include file does not show the exercice_63 and its corresponding .h files (Image 3). I have also tried the following commands and it does not remove the error.
cd /home/user/catkin_ws
catkin_make
source devel/setup.bash
rospack profile
Could you help me correct the error?

Image 1:

Image 2:

Image 3:

Captura12

Thank you very much

Hi, maybe the condition is never being met where you set the velocity? You can add a print in the first while to check if this is the case

Maybe this will need you removing the build and devel folders:

cd ~/catkin_ws
rm -rf build/ devel/
catkin_make
source devel/setup.bash
1 Like

I have executed the commands that you have advised me but when I compile again (catkin_make), I get another error:

Could you help me?

Thank you very much for all your help

Again when launching the server, I get the same initial error again

Ok so you have identified the problem to be during compilation. If your workspace doesn’t compile, then you can’t trust anything inside it to work, including your launch file.

You should go through your CMakeLists.txt and package.xml to ensure you have included everything necessary for your workspace to build my_custom_srv_msg_pkg correctly