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

Small Changes for cleanup for next PR #143

Merged
merged 1 commit into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion notebooks/ROS2_Keyboard_Input.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
121 changes: 14 additions & 107 deletions notebooks/ROS2_Publisher_Subscriber.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,10 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Rclpy not yet initiated\n"
]
}
],
"outputs": [],
"source": [
"## Relative pathing to the Jupyros module (jupyter-ros/jupyros), due to difficulty with with development install\n",
"## Remove at PR if Dev Install successful \n",
"import sys\n",
"sys.path.append(\"./../\")\n",
"##\n",
"import rclpy as rp\n",
"import jupyros.ros2 as jr2\n",
"from geometry_msgs.msg import Pose, Point\n",
Expand All @@ -28,7 +15,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -41,7 +28,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -50,45 +37,23 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# def cb(msg):\n",
"# lx = msg.linear.x\n",
"# ly = msg.linear.y \n",
"# lz = msg.linear.z\n",
"# ax = msg.angular.x \n",
"# ay = msg.angular.y \n",
"# az = msg.angular.z \n",
"# return lx, ly, lz, ax, ay, az\n",
"\n",
"def cb(msg):\n",
" print(\"this is the function\")\n"
" print(\"This function prints the msg\", msg)\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "48eee7984bd54806b49d40550bd40dad",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HBox(children=(Button(description='Start', style=ButtonStyle()), Button(description='Stop', sty…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"#Method 1 of subscribing and printing data\n",
"sub = jr2.Subscriber(test_node, Pose, '/Pose', cb, print_incoming_msg=True)\n",
Expand All @@ -97,82 +62,24 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#Method 2 of subscribing and printing data\n",
"#jr2.Subscriber(test_node, Pose, '/Pose', cb, print_incoming_msg=True).display()"
]
"source": []
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "354392faba0340f583844e07605387f4",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(Label(value='position'), HBox(children=(Label(value='x', layout=Layout(width='100px')), FloatTe…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"#Method 1 of publishing to node\n",
"pub = jr2.Publisher(test_node, Pose, '/Pose')\n",
"pub.display()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "44ef0659e85746b3b543b67940667178",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HBox(children=(Button(description='Start', style=ButtonStyle()), Button(description='Stop', sty…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#Method 1 of subscribing and printing data\n",
"sub = jr2.Subscriber(test_node, String, '/pose_stream', cb, print_incoming_msg=True)\n",
"sub.display()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down