{
"cells": [
{
"cell_type": "markdown",
"id": "9ed828cb-43ae-4592-a06c-6b41275be43e",
"metadata": {},
"source": [
"## Tutorial to use ros param widgets"
]
},
{
"cell_type": "markdown",
"id": "4e853e6e-b262-4634-8419-743b78a0eb2b",
"metadata": {},
"source": [
"Prepare the environment for roscpp"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8210c14f-cdbc-45a7-bc90-7f25829883ce",
"metadata": {},
"outputs": [],
"source": [
"! python3 ../scripts/generate_cling_3rd_party.py roscpp"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "197ce37a-1dba-4e24-850e-c353053afa42",
"metadata": {},
"outputs": [],
"source": [
"#include \"load_roscpp.h\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7e106b28-e60f-46c5-8a23-10ef1912319a",
"metadata": {},
"outputs": [],
"source": [
"#include \"jupyter_ros_utils/ros1_param.hpp\""
]
},
{
"cell_type": "markdown",
"id": "1181dbdc",
"metadata": {},
"source": [
"### Start node"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "35bcbb65-2a54-4244-8651-05b6bc277627",
"metadata": {},
"outputs": [],
"source": [
"ros_init(\"param_widget\")"
]
},
{
"cell_type": "markdown",
"id": "7d34edfa",
"metadata": {},
"source": [
"### Create Param Widget"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f3cdf144-bc08-45fa-86a3-5f11fc397088",
"metadata": {},
"outputs": [],
"source": [
"ZeusParam zp1(\"/asd\");\n",
"zp1.display();"
]
},
{
"cell_type": "markdown",
"id": "22e13bc2-8ce1-4ad0-ae19-e078f8e6aeb4",
"metadata": {},
"source": [
"### Control Param Widget\n",
"`Set Param` button sets ros parameters.
\n",
"This parameter starts to be monitored after pressing `Start Waiting` button.
\n",
"Before running the code below, try to press \"Start Waiting\" on the widgets above.\n",
"You'd be able to see the changes from ❌ <-> ✅ after running the `rosparam set` or `rosparam delete`"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fd8543c3-283f-43ed-bfb1-51ffa8dcd4bd",
"metadata": {},
"outputs": [],
"source": [
"! rosparam set /asd some_value"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "31ab2084-4c6a-4e04-90c6-754eec3685a2",
"metadata": {},
"outputs": [],
"source": [
"! rosparam delete /asd "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2965b62b-79d0-4743-93f9-09ae968e9cc9",
"metadata": {},
"outputs": [],
"source": [
"! rosparam set /asd new_value"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "C++17",
"language": "C++17",
"name": "xcpp17"
},
"language_info": {
"codemirror_mode": "text/x-c++src",
"file_extension": ".cpp",
"mimetype": "text/x-c++src",
"name": "c++",
"version": "17"
}
},
"nbformat": 4,
"nbformat_minor": 5
}