From b6db2b37f4c61c242cdc1281cd5739af31093296 Mon Sep 17 00:00:00 2001 From: ldania <27964546+ldania@users.noreply.github.com> Date: Thu, 8 Dec 2022 09:43:16 +0100 Subject: [PATCH] Small changes for cleanup for next PR (#143) --- notebooks/ROS2_Keyboard_Input.ipynb | 2 +- notebooks/ROS2_Publisher_Subscriber.ipynb | 121 +++------------------- 2 files changed, 15 insertions(+), 108 deletions(-) diff --git a/notebooks/ROS2_Keyboard_Input.ipynb b/notebooks/ROS2_Keyboard_Input.ipynb index 2529939..3169a56 100644 --- a/notebooks/ROS2_Keyboard_Input.ipynb +++ b/notebooks/ROS2_Keyboard_Input.ipynb @@ -111,7 +111,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/notebooks/ROS2_Publisher_Subscriber.ipynb b/notebooks/ROS2_Publisher_Subscriber.ipynb index 890e0c0..9466261 100644 --- a/notebooks/ROS2_Publisher_Subscriber.ipynb +++ b/notebooks/ROS2_Publisher_Subscriber.ipynb @@ -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", @@ -28,7 +15,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -41,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -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", @@ -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,