Skip to content

Commit

Permalink
Python tutorial code snippet updates. (#532)
Browse files Browse the repository at this point in the history
Signed-off-by: Sreekanth Rajan <[email protected]>
  • Loading branch information
sreekanthr authored Sep 11, 2024
1 parent 591c313 commit f7a303c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tutorials/06_python_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,9 @@ We can declare the throttling option using the following code :
# Setting the throttling option
opts = AdvertiseMessageOptions()
opts.msgs_per_sec = 1
pub = node.advertise(topic_name, StringMsg, opts);
if (!pub):
pub = node.advertise(topic_name, StringMsg, opts)
if not pub:
print("Error advertising topic" + topic_name)
return False
```

### Walkthrough
Expand All @@ -280,7 +279,7 @@ it to set the publishing rate (the member `msgs_per_sec`), In our case, the rate
specified is 1 msg/sec.

```{.py}
pub = node.advertise(topic_name, StringMsg, opts);
pub = node.advertise(topic_name, StringMsg, opts)
```

Next, we advertise the topic with message throttling enabled. To do it, we pass opts
Expand Down Expand Up @@ -341,8 +340,8 @@ We can declare the topic remapping option using the following code:
# Create a transport node and remap a topic.
nodeOpts = NodeOptions()
nodeOptions.add_topic_remap("/foo", "/bar");
node = Node(nodeOptions);
nodeOpts.add_topic_remap("/foo", "/bar")
node = Node(nodeOpts)
```

You can modify the publisher example to add this option.
Expand Down

0 comments on commit f7a303c

Please sign in to comment.