Python classes relation between request.duration and moving time

Hi, In the following code, the screenshot is attached below, we have defined the moving_time variable but we haven’t defined any value for it, what if say we want to assign a duration of 4 seconds to it.


Another thing is that in the corresponding server.py(screenshot is attached below), we are using request.duration but we haven’t defined it’s value anywhere which we earlier defined in client(bb8_move_in_circle_cliet.py). So, how the moving_time and request.duration are related. image

Hello @navjotsinghsodhi52 ,

The moving_time variable has to be defined when you call the function move_bb8. For instance:

move_bb8(4)

This will assign a value of 4 to the moving_time variable.

As for the request variable, these values are taken from the request message of the service client. So, it is defined when you call the service either from the shell (rosservice call ...) or creating a client in a Python script.

1 Like

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