Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rclpy minimal services #140

Merged
merged 21 commits into from
Dec 8, 2016
Merged

Rclpy minimal services #140

merged 21 commits into from
Dec 8, 2016

Conversation

mikaelarguedas
Copy link
Member

Simple service examples

@mikaelarguedas mikaelarguedas added the in progress Actively being worked on (Kanban column) label Nov 28, 2016
@mikaelarguedas mikaelarguedas self-assigned this Nov 28, 2016
@mikaelarguedas
Copy link
Member Author

This PR adds service examples with a similar behavior as the cpp examples added in #138

@mikaelarguedas mikaelarguedas added in review Waiting for review (Kanban column) in progress Actively being worked on (Kanban column) and removed in progress Actively being worked on (Kanban column) in review Waiting for review (Kanban column) labels Nov 28, 2016
@mikaelarguedas mikaelarguedas added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Nov 28, 2016


def test_copyright():
rc = main(argv=['.', 'test'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to be . and test? Isn't test a subfolder of the package root .?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in 4eddd82 see #139 (comment)

@mikaelarguedas mikaelarguedas added in progress Actively being worked on (Kanban column) and removed in review Waiting for review (Kanban column) labels Dec 7, 2016
1sec wait before sending

match cpp prints
@mikaelarguedas mikaelarguedas removed the in progress Actively being worked on (Kanban column) label Dec 7, 2016
@mikaelarguedas mikaelarguedas added the in review Waiting for review (Kanban column) label Dec 7, 2016
Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

req.a = 41
req.b = 1
# wait for connection to be established
# (no wait for service in Python yet)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend a TODO here then, so we remember to replace this with wait for service later. Or if there is a ticket to add wait for service in Python, you could link to this line of this file (at a specific commit) as a place to update after it is added. You might want to do both.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, ticketed here

req.a = 41
req.b = 1
# wait for connection to be established
# (no wait for service in Python yet)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO here as well

def __init__(self, node):
self.cli = node.create_client(AddTwoInts, 'add_two_ints')
# wait for connection to be established
# (no wait for service in Python yet)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO


def add_two_ints_callback(request, response):
response.sum = request.a + request.b
print('Incoming request\na: %d b:%d' % (request.a, request.b))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: b: %d

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done d6cb134

# when calling wait for future
# spin should not be called in the main loop
cli.wait_for_future()
print('Result of add_two_ints: for %d + %d = %d' % (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: wrap directly after parenthesis, e.g.:

print(
    'Result of add_two_ints: for %d + %d = %d' %
    (req.a, req.b, cli.response.sum))

Same below.

time.sleep(1)
cli.call(req)
while rclpy.ok():
if cli.response is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is not final API I would suggest to put a big todo above this line (and similar lines below).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about this TODO message? 5306074

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mikaelarguedas mikaelarguedas merged commit 81d7950 into master Dec 8, 2016
@mikaelarguedas mikaelarguedas deleted the rclpy_minimal_services branch December 8, 2016 02:44
@mikaelarguedas mikaelarguedas removed the in review Waiting for review (Kanban column) label Dec 8, 2016
haueck pushed a commit to haueck/examples that referenced this pull request Dec 8, 2016
* add add_two_ints examples

* rename targets

* add READMEs

* comment about node destruction

* match rclcpp minimal service examples

* update description strings

* remove local_function script because doesn't add any value

* add class examples

* move comment to proper location

* Null response in rclpy client code
1sec wait before sending

match cpp prints

* add TODO for wait for service

* add TODO for accessing response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants