From 764d797e78ccdcf6357ab5ad14d2058b92913752 Mon Sep 17 00:00:00 2001 From: Henry Roncancio Date: Wed, 15 Feb 2023 13:56:21 -0800 Subject: [PATCH 01/38] Setup 2 --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 018616e..8b3d744 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Ref: https://docs.ros.org/en/foxy/Tutorials/Beginner-Client-Libraries/Creating-A cd ~ ``` -4. Go to src folder in your workspace +4. Go to src folder in your workspace. Change my_name_ws accordingly ```shell script cd my_name_ws/src/ @@ -55,6 +55,9 @@ sudo rosdep init rosdep update ``` +5. Open VSCode, got to the menu and select file, an then select open folder. This show our workspace in the VScode explorer + + ## Source Control Recommendations From 6cf756932a946fd01bf515b87d17bf12ee7c1a57 Mon Sep 17 00:00:00 2001 From: Carlos Reyes Date: Wed, 15 Feb 2023 17:40:47 -0500 Subject: [PATCH 02/38] SALUDO --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8b3d744..6e73623 100644 --- a/README.md +++ b/README.md @@ -69,3 +69,4 @@ rosdep update BUENOS DIAS :) +ADIOS From 165b125d2a378dc14b1987250aa08ccecead964e Mon Sep 17 00:00:00 2001 From: Henry Roncancio Date: Wed, 15 Feb 2023 14:44:38 -0800 Subject: [PATCH 03/38] Created pkg lolito --- lolito/CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++++ lolito/package.xml | 18 ++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 lolito/CMakeLists.txt create mode 100644 lolito/package.xml diff --git a/lolito/CMakeLists.txt b/lolito/CMakeLists.txt new file mode 100644 index 0000000..b7d1cb2 --- /dev/null +++ b/lolito/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 3.5) +project(lolito) + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() diff --git a/lolito/package.xml b/lolito/package.xml new file mode 100644 index 0000000..322108a --- /dev/null +++ b/lolito/package.xml @@ -0,0 +1,18 @@ + + + + lolito + 0.0.0 + TODO: Package description + roncanciovl + TODO: License declaration + + ament_cmake + + ament_lint_auto + ament_lint_common + + + ament_cmake + + From d0911435dc39d00353efdff249b78257d3b2a4c4 Mon Sep 17 00:00:00 2001 From: Carlos Reyes Date: Thu, 16 Feb 2023 08:28:48 -0500 Subject: [PATCH 04/38] willy loco --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6e73623..716737f 100644 --- a/README.md +++ b/README.md @@ -69,4 +69,5 @@ rosdep update BUENOS DIAS :) -ADIOS +ADIOS +hola willy From 8b09edb0791ab3b3cabce483ad53d868ed3a8851 Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Thu, 16 Feb 2023 08:39:48 -0500 Subject: [PATCH 05/38] cambio pa reyes --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 716737f..2b722b3 100644 --- a/README.md +++ b/README.md @@ -71,3 +71,4 @@ rosdep update BUENOS DIAS :) ADIOS hola willy +HOla reyes From 467b5d9436b59f6d0d06ffbe97449fe91008a89a Mon Sep 17 00:00:00 2001 From: Henry Roncancio Date: Thu, 16 Feb 2023 05:46:53 -0800 Subject: [PATCH 06/38] readme update --- README.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6e73623..1050577 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,25 @@ sudo rosdep init rosdep update ``` -5. Open VSCode, got to the menu and select file, an then select open folder. This show our workspace in the VScode explorer +5. Open VSCode, got to the menu and select file, an then select open folder and select our workspace in home. This show our workspace in the VScode explorer + +6. In a terminal go to your workspace + +```shell script +colcon build +``` + +7. Sourve the overlay according to your distro + +```shell script +source /opt/ros/foxy/setup.bash +``` +8. + +```shell script +. install/local_setup.bash +``` + @@ -69,4 +87,3 @@ rosdep update BUENOS DIAS :) -ADIOS From 965193f0b65e44df408c0f9023d0ee227e3b972d Mon Sep 17 00:00:00 2001 From: Carlos Reyes Date: Thu, 16 Feb 2023 08:57:30 -0500 Subject: [PATCH 07/38] saludos --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2b722b3..0839560 100644 --- a/README.md +++ b/README.md @@ -72,3 +72,5 @@ BUENOS DIAS :) ADIOS hola willy HOla reyes + +feliz cumpleaños willy \ No newline at end of file From 09fd0ec9e4120a82b8fea8623368f42d4281be9e Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Thu, 16 Feb 2023 08:58:26 -0500 Subject: [PATCH 08/38] hola --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0839560..0f0a577 100644 --- a/README.md +++ b/README.md @@ -73,4 +73,5 @@ ADIOS hola willy HOla reyes -feliz cumpleaños willy \ No newline at end of file +feliz cumpleaños willy +reyes engalochado \ No newline at end of file From 6b3768bc2bbce37298b0a06f5eb0d26bf8ebf38a Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Thu, 16 Feb 2023 08:59:45 -0500 Subject: [PATCH 09/38] hola --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 0f0a577..ad6cb0a 100644 --- a/README.md +++ b/README.md @@ -73,5 +73,4 @@ ADIOS hola willy HOla reyes -feliz cumpleaños willy reyes engalochado \ No newline at end of file From 907c486eed82cf2bc1a45f0811ba5c5b5e62729e Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Thu, 16 Feb 2023 09:00:32 -0500 Subject: [PATCH 10/38] g --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ad6cb0a..098db0b 100644 --- a/README.md +++ b/README.md @@ -73,4 +73,5 @@ ADIOS hola willy HOla reyes -reyes engalochado \ No newline at end of file +feliz cumpleaños willy +GOLFITO From b33a750d4e092d90e656331f4e634d410c24db40 Mon Sep 17 00:00:00 2001 From: Ayvan77 Date: Thu, 16 Feb 2023 09:01:40 -0500 Subject: [PATCH 11/38] ALo123 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f0a577..41cad20 100644 --- a/README.md +++ b/README.md @@ -74,4 +74,5 @@ hola willy HOla reyes feliz cumpleaños willy -reyes engalochado \ No newline at end of file +reyes engalochado +PAso por ti a las 2 ve arreglandote \ No newline at end of file From c01dfad47b973167288262f6ae8d0d3d86d0d608 Mon Sep 17 00:00:00 2001 From: Raul Urdaneta Date: Thu, 16 Feb 2023 09:02:15 -0500 Subject: [PATCH 12/38] alo --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 098db0b..d88fc3e 100644 --- a/README.md +++ b/README.md @@ -75,3 +75,5 @@ HOla reyes feliz cumpleaños willy GOLFITO + +Feliz cumpleaños willy :) \ No newline at end of file From 8185a00803f4d5163b62625f1480c3682c3c690e Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Thu, 16 Feb 2023 09:07:24 -0500 Subject: [PATCH 13/38] h --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f0a577..29acd9d 100644 --- a/README.md +++ b/README.md @@ -74,4 +74,4 @@ hola willy HOla reyes feliz cumpleaños willy -reyes engalochado \ No newline at end of file +GOLFITO \ No newline at end of file From f78c39bf2a668f222a653c4697c43d376e1a0891 Mon Sep 17 00:00:00 2001 From: Ayvan77 Date: Thu, 16 Feb 2023 09:07:30 -0500 Subject: [PATCH 14/38] A --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f0a577..c4f605e 100644 --- a/README.md +++ b/README.md @@ -74,4 +74,5 @@ hola willy HOla reyes feliz cumpleaños willy -reyes engalochado \ No newline at end of file +reyes engalochado +Paso por ti a las 2 ve arreglandote ;) From 7aeebf4d3008b00da47b5438d3803e7d0e8e71c1 Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Thu, 16 Feb 2023 09:11:11 -0500 Subject: [PATCH 15/38] pablesss --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 29acd9d..ff5e916 100644 --- a/README.md +++ b/README.md @@ -74,4 +74,8 @@ hola willy HOla reyes feliz cumpleaños willy -GOLFITO \ No newline at end of file +GOLFITO + + + +HOLA amigo BLESS chimba \ No newline at end of file From d03f377144c317a5b5d7b1fc05360bb9a6eb7849 Mon Sep 17 00:00:00 2001 From: Raul Urdaneta Date: Thu, 16 Feb 2023 09:13:03 -0500 Subject: [PATCH 16/38] alo --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9901d7c..b5b2bfd 100644 --- a/README.md +++ b/README.md @@ -76,3 +76,5 @@ HOla reyes feliz cumpleaños willy GOLFITO Paso por ti a las 2 ve arreglandote ;) + +Feliz cumpleaños willito :) From 7988783f5d35fa68346a29805f1bdfe80d15be28 Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Thu, 16 Feb 2023 09:15:02 -0500 Subject: [PATCH 17/38] hola --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 29acd9d..5cf32d2 100644 --- a/README.md +++ b/README.md @@ -74,4 +74,10 @@ hola willy HOla reyes feliz cumpleaños willy -GOLFITO \ No newline at end of file +GOLFITO + + + + + +AMIGO BLESS CHIMBA From 8735e6e2bbe9c0817a3847901bcf0539a99fc5cb Mon Sep 17 00:00:00 2001 From: Jacksiton Date: Thu, 16 Feb 2023 09:15:07 -0500 Subject: [PATCH 18/38] ALo --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b5b2bfd..b019efc 100644 --- a/README.md +++ b/README.md @@ -78,3 +78,4 @@ GOLFITO Paso por ti a las 2 ve arreglandote ;) Feliz cumpleaños willito :) +Buena willito kchon \ No newline at end of file From 34fe0b8ee8cc835ca19e2011c298c1bcb5c5b882 Mon Sep 17 00:00:00 2001 From: Ayvan77 Date: Thu, 16 Feb 2023 09:16:29 -0500 Subject: [PATCH 19/38] A12 --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index b019efc..b531c9f 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,4 @@ HOla reyes feliz cumpleaños willy GOLFITO Paso por ti a las 2 ve arreglandote ;) - -Feliz cumpleaños willito :) -Buena willito kchon \ No newline at end of file +De medallo vea pues \ No newline at end of file From b7b081663b45846b830e2789e96361fe82c385f4 Mon Sep 17 00:00:00 2001 From: Raul Urdaneta Date: Thu, 16 Feb 2023 09:17:27 -0500 Subject: [PATCH 20/38] alo --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0881c75..5d12362 100644 --- a/README.md +++ b/README.md @@ -82,4 +82,6 @@ GOLFITO AMIGO BLESS CHIMBA Paso por ti a las 2 ve arreglandote ;) -De medallo vea pues \ No newline at end of file +De medallo vea pues + +Feliz cumpleaños willito :) \ No newline at end of file From f4d794a2eec152048b12e28d4a38efaf7281169d Mon Sep 17 00:00:00 2001 From: Ayvan77 Date: Thu, 16 Feb 2023 09:20:11 -0500 Subject: [PATCH 21/38] A13 --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d12362..4986add 100644 --- a/README.md +++ b/README.md @@ -84,4 +84,9 @@ AMIGO BLESS CHIMBA Paso por ti a las 2 ve arreglandote ;) De medallo vea pues -Feliz cumpleaños willito :) \ No newline at end of file +Feliz cumpleaños willito :) +Que rompa la piñata no +que la rompa raulito no +que la rompa carlitos no +que la rompa WIllyto +SIUUU \ No newline at end of file From 5180be47811c625980ded4d73b2bc04c0527755d Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Thu, 16 Feb 2023 09:26:42 -0500 Subject: [PATCH 22/38] jh --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0881c75..f2ae19d 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ hola willy HOla reyes feliz cumpleaños willy + GOLFITO @@ -82,4 +83,5 @@ GOLFITO AMIGO BLESS CHIMBA Paso por ti a las 2 ve arreglandote ;) -De medallo vea pues \ No newline at end of file +De medallo vea pues +JH \ No newline at end of file From 819a5dcfe9094794a8335ac56e8f98b4917310fc Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Thu, 16 Feb 2023 09:53:03 -0500 Subject: [PATCH 23/38] cambiosclase --- lolito/package.xml | 4 +- lolito/scripts/__init__.py | 0 lolito/scripts/publisher_member_function.py | 39 ++++++++++++++++++++ lolito/scripts/subscriber_member_function.py | 37 +++++++++++++++++++ 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 lolito/scripts/__init__.py create mode 100644 lolito/scripts/publisher_member_function.py create mode 100644 lolito/scripts/subscriber_member_function.py diff --git a/lolito/package.xml b/lolito/package.xml index 322108a..b9a4cc7 100644 --- a/lolito/package.xml +++ b/lolito/package.xml @@ -6,7 +6,9 @@ TODO: Package description roncanciovl TODO: License declaration - + + rclpy + std_msgs ament_cmake ament_lint_auto diff --git a/lolito/scripts/__init__.py b/lolito/scripts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/lolito/scripts/publisher_member_function.py b/lolito/scripts/publisher_member_function.py new file mode 100644 index 0000000..fff0ae1 --- /dev/null +++ b/lolito/scripts/publisher_member_function.py @@ -0,0 +1,39 @@ +import rclpy +from rclpy.node import Node + +from std_msgs.msg import String + + +class MinimalPublisher(Node): + + def __init__(self): + super().__init__('minimal_publisher') + self.publisher_ = self.create_publisher(String, 'topic', 10) + timer_period = 0.5 # seconds + self.timer = self.create_timer(timer_period, self.timer_callback) + self.i = 0 + + def timer_callback(self): + msg = String() + msg.data = 'Hello World: %d' % self.i + self.publisher_.publish(msg) + self.get_logger().info('Publishing: "%s"' % msg.data) + self.i += 1 + + +def main(args=None): + rclpy.init(args=args) + + minimal_publisher = MinimalPublisher() + + rclpy.spin(minimal_publisher) + + # Destroy the node explicitly + # (optional - otherwise it will be done automatically + # when the garbage collector destroys the node object) + minimal_publisher.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/lolito/scripts/subscriber_member_function.py b/lolito/scripts/subscriber_member_function.py new file mode 100644 index 0000000..90b6807 --- /dev/null +++ b/lolito/scripts/subscriber_member_function.py @@ -0,0 +1,37 @@ +import rclpy +from rclpy.node import Node + +from std_msgs.msg import String + + +class MinimalSubscriber(Node): + + def __init__(self): + super().__init__('minimal_subscriber') + self.subscription = self.create_subscription( + String, + 'topic', + self.listener_callback, + 10) + self.subscription # prevent unused variable warning + + def listener_callback(self, msg): + self.get_logger().info('I heard: "%s"' % msg.data) + + +def main(args=None): + rclpy.init(args=args) + + minimal_subscriber = MinimalSubscriber() + + rclpy.spin(minimal_subscriber) + + # Destroy the node explicitly + # (optional - otherwise it will be done automatically + # when the garbage collector destroys the node object) + minimal_subscriber.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main() \ No newline at end of file From 3acfc1bf360338870a014dbd88d211880de34a0b Mon Sep 17 00:00:00 2001 From: Henry Roncancio Date: Thu, 16 Feb 2023 06:53:16 -0800 Subject: [PATCH 24/38] New node --- lolito/package.xml | 4 +++- lolito/scripts/pubhen.py | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 lolito/scripts/pubhen.py diff --git a/lolito/package.xml b/lolito/package.xml index 322108a..b9a4cc7 100644 --- a/lolito/package.xml +++ b/lolito/package.xml @@ -6,7 +6,9 @@ TODO: Package description roncanciovl TODO: License declaration - + + rclpy + std_msgs ament_cmake ament_lint_auto diff --git a/lolito/scripts/pubhen.py b/lolito/scripts/pubhen.py new file mode 100644 index 0000000..fff0ae1 --- /dev/null +++ b/lolito/scripts/pubhen.py @@ -0,0 +1,39 @@ +import rclpy +from rclpy.node import Node + +from std_msgs.msg import String + + +class MinimalPublisher(Node): + + def __init__(self): + super().__init__('minimal_publisher') + self.publisher_ = self.create_publisher(String, 'topic', 10) + timer_period = 0.5 # seconds + self.timer = self.create_timer(timer_period, self.timer_callback) + self.i = 0 + + def timer_callback(self): + msg = String() + msg.data = 'Hello World: %d' % self.i + self.publisher_.publish(msg) + self.get_logger().info('Publishing: "%s"' % msg.data) + self.i += 1 + + +def main(args=None): + rclpy.init(args=args) + + minimal_publisher = MinimalPublisher() + + rclpy.spin(minimal_publisher) + + # Destroy the node explicitly + # (optional - otherwise it will be done automatically + # when the garbage collector destroys the node object) + minimal_publisher.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main() \ No newline at end of file From 27b908154ce3934b10c87669c329d5b957c54099 Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Wed, 22 Feb 2023 18:01:19 -0500 Subject: [PATCH 25/38] hellou --- lolito/CMakeLists.txt | 17 +++++++++++++++++ lolito/package.xml | 6 ++++-- lolito/scripts/publisher_member_function.py | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lolito/CMakeLists.txt b/lolito/CMakeLists.txt index b7d1cb2..152a695 100644 --- a/lolito/CMakeLists.txt +++ b/lolito/CMakeLists.txt @@ -17,6 +17,23 @@ endif() # find dependencies find_package(ament_cmake REQUIRED) +find_package(ament_cmake_python REQUIRED) +find_package(rclpy REQUIRED) +find_package(std_msgs REQUIRED) + +ament_python_install_package(scripts/) + +install(PROGRAMS + scripts/publisher_member_function.py + DESTINATION lib/${PROJECT_NAME} +) + +install(PROGRAMS + scripts/subscriber_member_function.py + DESTINATION lib/${PROJECT_NAME} +) + + # uncomment the following section in order to fill in # further dependencies manually. # find_package( REQUIRED) diff --git a/lolito/package.xml b/lolito/package.xml index b9a4cc7..3551796 100644 --- a/lolito/package.xml +++ b/lolito/package.xml @@ -7,9 +7,11 @@ roncanciovl TODO: License declaration - rclpy - std_msgs ament_cmake + ament_cmake_python + rclpy + std_msgs + ament_lint_auto ament_lint_common diff --git a/lolito/scripts/publisher_member_function.py b/lolito/scripts/publisher_member_function.py index fff0ae1..438d1a1 100644 --- a/lolito/scripts/publisher_member_function.py +++ b/lolito/scripts/publisher_member_function.py @@ -15,7 +15,7 @@ def __init__(self): def timer_callback(self): msg = String() - msg.data = 'Hello World: %d' % self.i + msg.data = 'Hola blesssssssss %d' % self.i self.publisher_.publish(msg) self.get_logger().info('Publishing: "%s"' % msg.data) self.i += 1 From d6e930e69d4dc3fc8b9e145c329aeb0bc971ca9d Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Thu, 23 Feb 2023 09:50:01 -0500 Subject: [PATCH 26/38] clasehoy --- lolito/CMakeLists.txt | 2 +- lolito/scripts/publisher_member_function.py | 2 + lolito/scripts/subscriber_member_function.py | 1 + willy_pkg/package.xml | 21 ++++++++++ willy_pkg/resource/willy_pkg | 0 willy_pkg/setup.cfg | 4 ++ willy_pkg/setup.py | 27 ++++++++++++ willy_pkg/test/test_copyright.py | 23 +++++++++++ willy_pkg/test/test_flake8.py | 25 +++++++++++ willy_pkg/test/test_pep257.py | 23 +++++++++++ willy_pkg/willy_pkg/__init__.py | 0 .../willy_pkg/publisher_member_function.py | 41 +++++++++++++++++++ .../willy_pkg/subscriber_member_function.py | 38 +++++++++++++++++ 13 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 willy_pkg/package.xml create mode 100644 willy_pkg/resource/willy_pkg create mode 100644 willy_pkg/setup.cfg create mode 100644 willy_pkg/setup.py create mode 100644 willy_pkg/test/test_copyright.py create mode 100644 willy_pkg/test/test_flake8.py create mode 100644 willy_pkg/test/test_pep257.py create mode 100644 willy_pkg/willy_pkg/__init__.py create mode 100644 willy_pkg/willy_pkg/publisher_member_function.py create mode 100644 willy_pkg/willy_pkg/subscriber_member_function.py diff --git a/lolito/CMakeLists.txt b/lolito/CMakeLists.txt index 152a695..b1b4b9b 100644 --- a/lolito/CMakeLists.txt +++ b/lolito/CMakeLists.txt @@ -21,7 +21,7 @@ find_package(ament_cmake_python REQUIRED) find_package(rclpy REQUIRED) find_package(std_msgs REQUIRED) -ament_python_install_package(scripts/) +ament_python_install_package(scripts) install(PROGRAMS scripts/publisher_member_function.py diff --git a/lolito/scripts/publisher_member_function.py b/lolito/scripts/publisher_member_function.py index 438d1a1..71d3586 100644 --- a/lolito/scripts/publisher_member_function.py +++ b/lolito/scripts/publisher_member_function.py @@ -1,3 +1,5 @@ +#!usr/bin/env python 3 + import rclpy from rclpy.node import Node diff --git a/lolito/scripts/subscriber_member_function.py b/lolito/scripts/subscriber_member_function.py index 90b6807..1a8b749 100644 --- a/lolito/scripts/subscriber_member_function.py +++ b/lolito/scripts/subscriber_member_function.py @@ -1,3 +1,4 @@ +#!usr/bin/env python 3 import rclpy from rclpy.node import Node diff --git a/willy_pkg/package.xml b/willy_pkg/package.xml new file mode 100644 index 0000000..2f8fc0a --- /dev/null +++ b/willy_pkg/package.xml @@ -0,0 +1,21 @@ + + + + willy_pkg + 0.0.0 + TODO: Package description + willy + Apache License 2.0 + + rclpy + std_msgs + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/willy_pkg/resource/willy_pkg b/willy_pkg/resource/willy_pkg new file mode 100644 index 0000000..e69de29 diff --git a/willy_pkg/setup.cfg b/willy_pkg/setup.cfg new file mode 100644 index 0000000..bf24026 --- /dev/null +++ b/willy_pkg/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script-dir=$base/lib/willy_pkg +[install] +install-scripts=$base/lib/willy_pkg diff --git a/willy_pkg/setup.py b/willy_pkg/setup.py new file mode 100644 index 0000000..774a397 --- /dev/null +++ b/willy_pkg/setup.py @@ -0,0 +1,27 @@ +from setuptools import setup + +package_name = 'willy_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=[package_name], + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='willy', + maintainer_email='wrojaszabala@gmail.com', + description='TODO: Package description', + license='Apache License 2.0', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + 'talker = willy_pkg.publisher_member_function:main', + 'listener = willy_pkg.subscriber_member_function:main', + ], +}, +) \ No newline at end of file diff --git a/willy_pkg/test/test_copyright.py b/willy_pkg/test/test_copyright.py new file mode 100644 index 0000000..cc8ff03 --- /dev/null +++ b/willy_pkg/test/test_copyright.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/willy_pkg/test/test_flake8.py b/willy_pkg/test/test_flake8.py new file mode 100644 index 0000000..27ee107 --- /dev/null +++ b/willy_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \ + 'Found %d code style errors / warnings:\n' % len(errors) + \ + '\n'.join(errors) diff --git a/willy_pkg/test/test_pep257.py b/willy_pkg/test/test_pep257.py new file mode 100644 index 0000000..b234a38 --- /dev/null +++ b/willy_pkg/test/test_pep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/willy_pkg/willy_pkg/__init__.py b/willy_pkg/willy_pkg/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/willy_pkg/willy_pkg/publisher_member_function.py b/willy_pkg/willy_pkg/publisher_member_function.py new file mode 100644 index 0000000..71d3586 --- /dev/null +++ b/willy_pkg/willy_pkg/publisher_member_function.py @@ -0,0 +1,41 @@ +#!usr/bin/env python 3 + +import rclpy +from rclpy.node import Node + +from std_msgs.msg import String + + +class MinimalPublisher(Node): + + def __init__(self): + super().__init__('minimal_publisher') + self.publisher_ = self.create_publisher(String, 'topic', 10) + timer_period = 0.5 # seconds + self.timer = self.create_timer(timer_period, self.timer_callback) + self.i = 0 + + def timer_callback(self): + msg = String() + msg.data = 'Hola blesssssssss %d' % self.i + self.publisher_.publish(msg) + self.get_logger().info('Publishing: "%s"' % msg.data) + self.i += 1 + + +def main(args=None): + rclpy.init(args=args) + + minimal_publisher = MinimalPublisher() + + rclpy.spin(minimal_publisher) + + # Destroy the node explicitly + # (optional - otherwise it will be done automatically + # when the garbage collector destroys the node object) + minimal_publisher.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/willy_pkg/willy_pkg/subscriber_member_function.py b/willy_pkg/willy_pkg/subscriber_member_function.py new file mode 100644 index 0000000..1a8b749 --- /dev/null +++ b/willy_pkg/willy_pkg/subscriber_member_function.py @@ -0,0 +1,38 @@ +#!usr/bin/env python 3 +import rclpy +from rclpy.node import Node + +from std_msgs.msg import String + + +class MinimalSubscriber(Node): + + def __init__(self): + super().__init__('minimal_subscriber') + self.subscription = self.create_subscription( + String, + 'topic', + self.listener_callback, + 10) + self.subscription # prevent unused variable warning + + def listener_callback(self, msg): + self.get_logger().info('I heard: "%s"' % msg.data) + + +def main(args=None): + rclpy.init(args=args) + + minimal_subscriber = MinimalSubscriber() + + rclpy.spin(minimal_subscriber) + + # Destroy the node explicitly + # (optional - otherwise it will be done automatically + # when the garbage collector destroys the node object) + minimal_subscriber.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main() \ No newline at end of file From f99394a7ff52fa78aab2d39512e67a55edec4c2d Mon Sep 17 00:00:00 2001 From: Henry Roncancio Date: Tue, 28 Feb 2023 06:35:07 -0800 Subject: [PATCH 27/38] Settings in environment --- README.md | 38 ++++++++++++++++ henry_pkg/henry_pkg/__init__.py | 0 henry_pkg/henry_pkg/fis.py | 33 ++++++++++++++ henry_pkg/henry_pkg/my_pub.py | 39 ++++++++++++++++ henry_pkg/package.xml | 21 +++++++++ henry_pkg/resource/henry_pkg | 0 henry_pkg/setup.cfg | 4 ++ henry_pkg/setup.py | 26 +++++++++++ henry_pkg/test/test_copyright.py | 23 ++++++++++ henry_pkg/test/test_flake8.py | 25 +++++++++++ henry_pkg/test/test_pep257.py | 23 ++++++++++ lolito/CMakeLists.txt | 12 +++++ lolito/lolito/__init__.py | 0 lolito/lolito/scripts/pubhen.py | 42 ++++++++++++++++++ lolito/package.xml | 5 ++- lolito/scripts/__init__.py | 0 requirements.txt | 76 ++++++++++++++++++++++++++++++++ 17 files changed, 365 insertions(+), 2 deletions(-) create mode 100644 henry_pkg/henry_pkg/__init__.py create mode 100644 henry_pkg/henry_pkg/fis.py create mode 100644 henry_pkg/henry_pkg/my_pub.py create mode 100644 henry_pkg/package.xml create mode 100644 henry_pkg/resource/henry_pkg create mode 100644 henry_pkg/setup.cfg create mode 100644 henry_pkg/setup.py create mode 100644 henry_pkg/test/test_copyright.py create mode 100644 henry_pkg/test/test_flake8.py create mode 100644 henry_pkg/test/test_pep257.py create mode 100644 lolito/lolito/__init__.py create mode 100755 lolito/lolito/scripts/pubhen.py create mode 100644 lolito/scripts/__init__.py create mode 100644 requirements.txt diff --git a/README.md b/README.md index 2efc043..b7446b8 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,44 @@ source /opt/ros/foxy/setup.bash ``` +## Virtual Environment Setup in Linux + +https://docs.ros.org/en/foxy/How-To-Guides/Using-Python-Packages.html + +```shell script +sudo apt install python3-pip +``` + +```shell script +sudo apt install python3-virtualenv +``` +### Make a virtual env and activate it + +From your workspace directory run this command + +```shell script +virtualenv -p python3 ./venv +``` +```shell script +source ./venv/bin/activate +``` + +Make sure that colcon doesn’t try to build the venv +```shell script +touch ./venv/COLCON_IGNORE +``` + + +Next, install the Python packages that you want in your virtual environment: + +if any requirement file is in the src folder, then install them for command line + +```shell script +pip install -r src/requirements.txt +``` + +Now you can build your workspace and run your python node that depends on packages installed in your virtual environment. + ## Source Control Recommendations diff --git a/henry_pkg/henry_pkg/__init__.py b/henry_pkg/henry_pkg/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/henry_pkg/henry_pkg/fis.py b/henry_pkg/henry_pkg/fis.py new file mode 100644 index 0000000..cebfbda --- /dev/null +++ b/henry_pkg/henry_pkg/fis.py @@ -0,0 +1,33 @@ +import numpy as np +import skfuzzy as fuzz +from skfuzzy import control as ctrl + +# New Antecedent/Consequent objects hold universe variables and membership +# functions +quality = ctrl.Antecedent(np.arange(0, 11, 1), 'quality') +service = ctrl.Antecedent(np.arange(0, 11, 1), 'service') +tip = ctrl.Consequent(np.arange(0, 26, 1), 'tip') + +# Auto-membership function population is possible with .automf(3, 5, or 7) +quality.automf(3) +service.automf(3) + +# Custom membership functions can be built interactively with a familiar, +# Pythonic API +tip['low'] = fuzz.trimf(tip.universe, [0, 0, 13]) +tip['medium'] = fuzz.trimf(tip.universe, [0, 13, 25]) +tip['high'] = fuzz.trimf(tip.universe, [13, 25, 25]) + +rule1 = ctrl.Rule(quality['poor'] | service['poor'], tip['low']) +rule2 = ctrl.Rule(service['average'], tip['medium']) +rule3 = ctrl.Rule(service['good'] | quality['good'], tip['high']) + +rule1.view() + +tipping_ctrl = ctrl.ControlSystem([rule1, rule2, rule3]) + +def main(args=None): + print() + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/henry_pkg/henry_pkg/my_pub.py b/henry_pkg/henry_pkg/my_pub.py new file mode 100644 index 0000000..fff0ae1 --- /dev/null +++ b/henry_pkg/henry_pkg/my_pub.py @@ -0,0 +1,39 @@ +import rclpy +from rclpy.node import Node + +from std_msgs.msg import String + + +class MinimalPublisher(Node): + + def __init__(self): + super().__init__('minimal_publisher') + self.publisher_ = self.create_publisher(String, 'topic', 10) + timer_period = 0.5 # seconds + self.timer = self.create_timer(timer_period, self.timer_callback) + self.i = 0 + + def timer_callback(self): + msg = String() + msg.data = 'Hello World: %d' % self.i + self.publisher_.publish(msg) + self.get_logger().info('Publishing: "%s"' % msg.data) + self.i += 1 + + +def main(args=None): + rclpy.init(args=args) + + minimal_publisher = MinimalPublisher() + + rclpy.spin(minimal_publisher) + + # Destroy the node explicitly + # (optional - otherwise it will be done automatically + # when the garbage collector destroys the node object) + minimal_publisher.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/henry_pkg/package.xml b/henry_pkg/package.xml new file mode 100644 index 0000000..5bc66fc --- /dev/null +++ b/henry_pkg/package.xml @@ -0,0 +1,21 @@ + + + + henry_pkg + 0.0.0 + TODO: Package description + roncanciovl + Apache License 2.0 + + rclpy + std_msgs + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/henry_pkg/resource/henry_pkg b/henry_pkg/resource/henry_pkg new file mode 100644 index 0000000..e69de29 diff --git a/henry_pkg/setup.cfg b/henry_pkg/setup.cfg new file mode 100644 index 0000000..6beb4db --- /dev/null +++ b/henry_pkg/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script-dir=$base/lib/henry_pkg +[install] +install-scripts=$base/lib/henry_pkg diff --git a/henry_pkg/setup.py b/henry_pkg/setup.py new file mode 100644 index 0000000..cf51f02 --- /dev/null +++ b/henry_pkg/setup.py @@ -0,0 +1,26 @@ +from setuptools import setup + +package_name = 'henry_pkg' + +setup( + name=package_name, + version='0.0.0', + packages=[package_name], + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='roncanciovl', + maintainer_email='henryroncanciovelandia@gmail.com', + description='TODO: Package description', + license='Apache License 2.0', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + 'talker = henry_pkg.my_pub:main', + ], + }, +) diff --git a/henry_pkg/test/test_copyright.py b/henry_pkg/test/test_copyright.py new file mode 100644 index 0000000..cc8ff03 --- /dev/null +++ b/henry_pkg/test/test_copyright.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/henry_pkg/test/test_flake8.py b/henry_pkg/test/test_flake8.py new file mode 100644 index 0000000..27ee107 --- /dev/null +++ b/henry_pkg/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \ + 'Found %d code style errors / warnings:\n' % len(errors) + \ + '\n'.join(errors) diff --git a/henry_pkg/test/test_pep257.py b/henry_pkg/test/test_pep257.py new file mode 100644 index 0000000..b234a38 --- /dev/null +++ b/henry_pkg/test/test_pep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/lolito/CMakeLists.txt b/lolito/CMakeLists.txt index b7d1cb2..0d8df9a 100644 --- a/lolito/CMakeLists.txt +++ b/lolito/CMakeLists.txt @@ -17,6 +17,18 @@ endif() # find dependencies find_package(ament_cmake REQUIRED) +find_package(ament_cmake_python REQUIRED) +find_package(rclpy REQUIRED) +find_package(std_msgs REQUIRED) + +ament_python_install_package(${PROJECT_NAME}) + +install(PROGRAMS + lolito/scripts/pubhen.py + DESTINATION lib/${PROJECT_NAME} +) + + # uncomment the following section in order to fill in # further dependencies manually. # find_package( REQUIRED) diff --git a/lolito/lolito/__init__.py b/lolito/lolito/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/lolito/lolito/scripts/pubhen.py b/lolito/lolito/scripts/pubhen.py new file mode 100755 index 0000000..65e1fad --- /dev/null +++ b/lolito/lolito/scripts/pubhen.py @@ -0,0 +1,42 @@ + +#!/home/roncanciovl/ros2class_ws/venv/bin/python3 + +import rclpy +from rclpy.node import Node + +from std_msgs.msg import String + + +class MinimalPublisher(Node): + + def __init__(self): + super().__init__('minimal_publisher') + self.publisher_ = self.create_publisher(String, 'topic', 10) + timer_period = 0.5 # seconds + self.timer = self.create_timer(timer_period, self.timer_callback) + self.i = 0 + + def timer_callback(self): + msg = String() + msg.data = 'Hello World: %d' % self.i + self.publisher_.publish(msg) + self.get_logger().info('Publishing: "%s"' % msg.data) + self.i += 1 + + +def main(args=None): + rclpy.init(args=args) + + minimal_publisher = MinimalPublisher() + + rclpy.spin(minimal_publisher) + + # Destroy the node explicitly + # (optional - otherwise it will be done automatically + # when the garbage collector destroys the node object) + minimal_publisher.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/lolito/package.xml b/lolito/package.xml index b9a4cc7..59c8ed8 100644 --- a/lolito/package.xml +++ b/lolito/package.xml @@ -7,10 +7,11 @@ roncanciovl TODO: License declaration + ament_cmake + ament_cmake_python rclpy std_msgs - ament_cmake - + ament_lint_auto ament_lint_common diff --git a/lolito/scripts/__init__.py b/lolito/scripts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..a504033 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,76 @@ +action-tutorials-py==0.9.4 +ament-copyright==0.9.7 +ament-cppcheck==0.9.7 +ament-cpplint==0.9.7 +ament-flake8==0.9.7 +ament-index-python==1.1.0 +ament-lint==0.9.7 +ament-lint-cmake==0.9.7 +ament-package==0.9.5 +ament-pep257==0.9.7 +ament-uncrustify==0.9.7 +ament-xmllint==0.9.7 +demo-nodes-py==0.9.4 +domain-coordinator==0.9.2 +examples-rclpy-executors==0.9.4 +examples-rclpy-minimal-action-client==0.9.4 +examples-rclpy-minimal-action-server==0.9.4 +examples-rclpy-minimal-client==0.9.4 +examples-rclpy-minimal-publisher==0.9.4 +examples-rclpy-minimal-service==0.9.4 +examples-rclpy-minimal-subscriber==0.9.4 +henry-pkg==0.0.0 +launch==0.10.10 +launch-ros==0.11.7 +launch-testing==0.10.10 +launch-testing-ros==0.11.7 +launch-xml==0.10.10 +launch-yaml==0.10.10 +networkx==3.0 +numpy==1.24.2 +osrf-pycommon==0.1.11 +quality-of-service-demo-py==0.9.4 +ros2action==0.9.12 +ros2bag==0.3.9 +ros2cli==0.9.12 +ros2component==0.9.12 +ros2doctor==0.9.12 +ros2interface==0.9.12 +ros2launch==0.11.7 +ros2lifecycle==0.9.12 +ros2multicast==0.9.12 +ros2node==0.9.12 +ros2param==0.9.12 +ros2pkg==0.9.12 +ros2run==0.9.12 +ros2service==0.9.12 +ros2topic==0.9.12 +rosidl-runtime-py==0.9.1 +rpyutils==0.2.0 +rqt==1.1.2 +rqt-action==0.4.9 +rqt-console==1.1.2 +rqt-graph==1.1.3 +rqt-gui==1.1.2 +rqt-gui-py==1.1.2 +rqt-moveit==1.0.1 +rqt-msg==1.0.5 +rqt-plot==1.1.1 +rqt-publisher==1.3.0 +rqt-py-console==1.0.2 +rqt-reconfigure==1.0.8 +rqt-robot-dashboard==0.5.8 +rqt-robot-monitor==1.0.5 +rqt-robot-steering==1.0.0 +rqt-runtime-monitor==1.0.0 +rqt-service-caller==1.0.5 +rqt-shell==1.0.2 +rqt-srv==1.0.3 +rqt-tf-tree==1.0.2 +rqt-top==1.0.2 +rqt-topic==1.3.0 +scikit-fuzzy==0.4.2 +scipy==1.10.1 +sros2==0.9.5 +teleop-twist-keyboard==2.3.2 +topic-monitor==0.9.4 From 439eb57c07e35b9cb4612fe9654165ee05ca5e9e Mon Sep 17 00:00:00 2001 From: Henry Roncancio Date: Tue, 28 Feb 2023 06:36:10 -0800 Subject: [PATCH 28/38] Change location in files --- lolito/scripts/__init__.py | 0 lolito/scripts/pubhen.py | 39 -------------------------------------- 2 files changed, 39 deletions(-) delete mode 100644 lolito/scripts/__init__.py delete mode 100644 lolito/scripts/pubhen.py diff --git a/lolito/scripts/__init__.py b/lolito/scripts/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/lolito/scripts/pubhen.py b/lolito/scripts/pubhen.py deleted file mode 100644 index fff0ae1..0000000 --- a/lolito/scripts/pubhen.py +++ /dev/null @@ -1,39 +0,0 @@ -import rclpy -from rclpy.node import Node - -from std_msgs.msg import String - - -class MinimalPublisher(Node): - - def __init__(self): - super().__init__('minimal_publisher') - self.publisher_ = self.create_publisher(String, 'topic', 10) - timer_period = 0.5 # seconds - self.timer = self.create_timer(timer_period, self.timer_callback) - self.i = 0 - - def timer_callback(self): - msg = String() - msg.data = 'Hello World: %d' % self.i - self.publisher_.publish(msg) - self.get_logger().info('Publishing: "%s"' % msg.data) - self.i += 1 - - -def main(args=None): - rclpy.init(args=args) - - minimal_publisher = MinimalPublisher() - - rclpy.spin(minimal_publisher) - - # Destroy the node explicitly - # (optional - otherwise it will be done automatically - # when the garbage collector destroys the node object) - minimal_publisher.destroy_node() - rclpy.shutdown() - - -if __name__ == '__main__': - main() \ No newline at end of file From 592df4bba0726c07d432dab5705e5f0c61a6cd0f Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 1 Mar 2023 16:55:43 -0500 Subject: [PATCH 29/38] Com --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ff65c21..04c7297 100644 --- a/README.md +++ b/README.md @@ -94,3 +94,4 @@ que la rompa WIllyto SIUUU Hola chamito +hi From 84aa5dcc50ff7d9720aff41356069860d2e46ab1 Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Thu, 2 Mar 2023 10:01:03 -0500 Subject: [PATCH 30/38] siuu --- willy_pkg/willy_pkg/subscriber_member_function.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/willy_pkg/willy_pkg/subscriber_member_function.py b/willy_pkg/willy_pkg/subscriber_member_function.py index 1a8b749..5b8a1a6 100644 --- a/willy_pkg/willy_pkg/subscriber_member_function.py +++ b/willy_pkg/willy_pkg/subscriber_member_function.py @@ -8,7 +8,7 @@ class MinimalSubscriber(Node): def __init__(self): - super().__init__('minimal_subscriber') + super().__init__('willy poder') self.subscription = self.create_subscription( String, 'topic', From 0c1a0892833c05a4f21bd241e42e3904c05fbb23 Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Thu, 9 Mar 2023 08:23:07 -0500 Subject: [PATCH 31/38] cambiosparaul --- willy_pkg/setup.py | 2 + willy_pkg/willy_pkg/jh.jpg | Bin 0 -> 6913 bytes willy_pkg/willy_pkg/lineal_speed.py | 35 +++++++++++++++ .../willy_pkg/subscriber_member_function.py | 5 ++- willy_pkg/willy_pkg/subscriber_photo.py | 41 ++++++++++++++++++ 5 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 willy_pkg/willy_pkg/jh.jpg create mode 100644 willy_pkg/willy_pkg/lineal_speed.py create mode 100644 willy_pkg/willy_pkg/subscriber_photo.py diff --git a/willy_pkg/setup.py b/willy_pkg/setup.py index 774a397..97d49cc 100644 --- a/willy_pkg/setup.py +++ b/willy_pkg/setup.py @@ -22,6 +22,8 @@ 'console_scripts': [ 'talker = willy_pkg.publisher_member_function:main', 'listener = willy_pkg.subscriber_member_function:main', + 'willy = willy_pkg.lineal_speed:main', + 'jh = willy_pkg.subscriber_photo:main', ], }, ) \ No newline at end of file diff --git a/willy_pkg/willy_pkg/jh.jpg b/willy_pkg/willy_pkg/jh.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8c76a20277cb054ac4957d21a6651144f22b1773 GIT binary patch literal 6913 zcmZ{HWl)_>(B*S+4elD;16F2=Vdph=>UPftZ-^ zfBFC7|5k_zN#C>4l9DsOCnTifqhtQS!OhK0Od}{J$R*0g#mxaiLqo&Fz$C}UCg-A| zdC&EK!SOHT_;33E;UD*Jy!8TDNWd1b4hy0JV6Z^2SfIB-fb^e6c+h`R{}12+7+5$2 z5F*k)RtOV-0l~n*!owrN!ok4)+X8|CV6ot^-*do=t07RCI0fQxCKNOvN~k;c{kfnv z4NCmczlmFj2fqB5O#}j9|DU7(ONWJn|3@)k{UiPr2Mz=a3;(}w2EkyxhsEX)SA)Yb zp>j&V#iQnwcv}L{U_t-X!eRlUzoi`Wt^Q9(LdAHc2gNhlP@+qj;6ZR8w^c8eF&tG^sxE=&9aflVQqXkK0 z#o@4#pqR3hvBojQUnV~z*Mz}6i4U8c)b_Vybf{+EU6gY_?B&Mwc2C!PMlrV)?w>*H z)dQMFT>maSs38Bw+g3P|GHHd973N|r<}!v4utKVs&f~N4NuI*Q{R@X3I)v|nQ(Ws5 z%VZROU_on-uajoB-RZyRc#j?t5pw2;BWx)U;W{^v5H957ADUsT%?~=T(TXjT^kIz+ z+5sH61qy^RogcQ@XtnI(&M`$83coRw(Hm2Ia1>#`v1T-MgBqn(-ztMfv~jel*lids z0DZQ6bbfow)Z9t!J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launch/python_parameters_launch.py | 16 ++++++++++++++++ willy_pkg/setup.py | 5 ++++- willy_pkg/willy_pkg/lineal_speed.py | 8 ++++++-- willy_pkg/willy_pkg/subscriber_photo.py | 2 +- 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 python_parameters/launch/python_parameters_launch.py diff --git a/python_parameters/launch/python_parameters_launch.py b/python_parameters/launch/python_parameters_launch.py new file mode 100644 index 0000000..784c961 --- /dev/null +++ b/python_parameters/launch/python_parameters_launch.py @@ -0,0 +1,16 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +def generate_launch_description(): + return LaunchDescription([ + Node( + package='willy_pkg', + executable='willypoder', + name='cam_param', + output='screen', + emulate_tty=True, + parameters=[ + {'Radio': 0.10} + ] + ) + ]) \ No newline at end of file diff --git a/willy_pkg/setup.py b/willy_pkg/setup.py index 97d49cc..73f6498 100644 --- a/willy_pkg/setup.py +++ b/willy_pkg/setup.py @@ -1,4 +1,6 @@ from setuptools import setup +import os +from glob import glob package_name = 'willy_pkg' @@ -7,6 +9,7 @@ version='0.0.0', packages=[package_name], data_files=[ + (os.path.join('share', package_name), glob('launch/*launch.[pxy][yma]*')), ('share/ament_index/resource_index/packages', ['resource/' + package_name]), ('share/' + package_name, ['package.xml']), @@ -26,4 +29,4 @@ 'jh = willy_pkg.subscriber_photo:main', ], }, -) \ No newline at end of file +) diff --git a/willy_pkg/willy_pkg/lineal_speed.py b/willy_pkg/willy_pkg/lineal_speed.py index cd8a967..bc27755 100644 --- a/willy_pkg/willy_pkg/lineal_speed.py +++ b/willy_pkg/willy_pkg/lineal_speed.py @@ -5,7 +5,9 @@ class MyNode(Node): def __init__(self): - super().__init__('Willypoder') + super().__init__('willypoder') + self.declare_parameter('Radio', 0.10) + sub_topic = self.get_parameter('Radio').value self.publisher_ = self.create_publisher(String, 'lineal_speed', 10) self.subscription = self.create_subscription( String, @@ -16,7 +18,9 @@ def __init__(self): def listener_callback(self, msg): #self.get_logger().info('I heard: "%s"' % msg.data) - numin=(float(msg.data)/60)*2*3.141516*0.03 + Radio = self.get_parameter('Radio').value + + numin=(float(msg.data)/60)*2*3.141516*Radio print(numin) msg.data=str(numin) self.publisher_.publish(msg) diff --git a/willy_pkg/willy_pkg/subscriber_photo.py b/willy_pkg/willy_pkg/subscriber_photo.py index 4dd4ca0..c84e1a5 100644 --- a/willy_pkg/willy_pkg/subscriber_photo.py +++ b/willy_pkg/willy_pkg/subscriber_photo.py @@ -9,7 +9,7 @@ def __init__(self): super().__init__('image_publisher') # Create the publisher to publish images - self.publisher_ = self.create_publisher(Image, 'ALO', 1) + self.publisher_ = self.create_publisher(Image, 'ALO', 10) # Read the image file img = cv2.imread('/home/willy/Documentos/jh.jpg') From e010971e6607ea65434446f1d7338016c0bc8cbe Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Wed, 15 Mar 2023 11:07:23 -0500 Subject: [PATCH 33/38] aloo --- .../launch/python_parameters_launch.py | 4 ++-- willy_pkg/package.xml | 4 +++- willy_pkg/setup.py | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) rename {python_parameters => willy_pkg}/launch/python_parameters_launch.py (83%) diff --git a/python_parameters/launch/python_parameters_launch.py b/willy_pkg/launch/python_parameters_launch.py similarity index 83% rename from python_parameters/launch/python_parameters_launch.py rename to willy_pkg/launch/python_parameters_launch.py index 784c961..7c0f66b 100644 --- a/python_parameters/launch/python_parameters_launch.py +++ b/willy_pkg/launch/python_parameters_launch.py @@ -5,8 +5,8 @@ def generate_launch_description(): return LaunchDescription([ Node( package='willy_pkg', - executable='willypoder', - name='cam_param', + executable='lineal_speed', + name='Siuu', output='screen', emulate_tty=True, parameters=[ diff --git a/willy_pkg/package.xml b/willy_pkg/package.xml index 2f8fc0a..947b895 100644 --- a/willy_pkg/package.xml +++ b/willy_pkg/package.xml @@ -9,7 +9,7 @@ rclpy std_msgs - +ros2launch ament_copyright ament_flake8 ament_pep257 @@ -19,3 +19,5 @@ ament_python + + diff --git a/willy_pkg/setup.py b/willy_pkg/setup.py index 73f6498..a54376a 100644 --- a/willy_pkg/setup.py +++ b/willy_pkg/setup.py @@ -25,8 +25,8 @@ 'console_scripts': [ 'talker = willy_pkg.publisher_member_function:main', 'listener = willy_pkg.subscriber_member_function:main', - 'willy = willy_pkg.lineal_speed:main', + 'lineal_speed = willy_pkg.lineal_speed:main', 'jh = willy_pkg.subscriber_photo:main', ], }, -) +) \ No newline at end of file From ee5ce8001811616cd2e6ba3640081349edaa2136 Mon Sep 17 00:00:00 2001 From: Henry Roncancio Date: Wed, 15 Mar 2023 22:10:38 -0700 Subject: [PATCH 34/38] Created pkg lolito_interfaces --- henry_pkg/henry_pkg/server.py | 55 ++++++++++++++++++++++++++ henry_pkg/package.xml | 9 +++++ henry_pkg/setup.py | 1 + lolito_interfaces/CMakeLists.txt | 44 +++++++++++++++++++++ lolito_interfaces/package.xml | 26 ++++++++++++ lolito_interfaces/srv/CaptureImage.srv | 3 ++ 6 files changed, 138 insertions(+) create mode 100644 henry_pkg/henry_pkg/server.py create mode 100644 lolito_interfaces/CMakeLists.txt create mode 100644 lolito_interfaces/package.xml create mode 100644 lolito_interfaces/srv/CaptureImage.srv diff --git a/henry_pkg/henry_pkg/server.py b/henry_pkg/henry_pkg/server.py new file mode 100644 index 0000000..cfd482f --- /dev/null +++ b/henry_pkg/henry_pkg/server.py @@ -0,0 +1,55 @@ +import rclpy +from rclpy.node import Node +from sensor_msgs.msg import Image +from lolito_interfaces.srv import CaptureImage + + +class ImageCaptureServer(Node): + def __init__(self): + super().__init__('image_capture_server') + self.srv = self.create_service(CaptureImage, 'capture_image', self.capture_image_callback) + + def capture_image_callback(self, request, response): + # Aquí es donde capturamos la imagen y la enviamos como respuesta + image = self.capture_image() + response.image = image + return response + + def capture_image(self): + # En este ejemplo, utilizamos la biblioteca OpenCV para capturar la imagen + import cv2 + + # Capturamos la imagen de la cámara web + cap = cv2.VideoCapture(0) + _, frame = cap.read() + + # Convertimos la imagen capturada a un mensaje ROS + msg = Image() + msg.header.frame_id = 'camera' + msg.encoding = 'bgr8' + msg.height, msg.width, _ = frame.shape + msg.step = 3 * msg.width + msg.data = frame.tobytes() + + # Liberamos la cámara web + cap.release() + + return msg + + +def main(args=None): + rclpy.init(args=args) + + node = ImageCaptureServer() + + try: + rclpy.spin(node) + except KeyboardInterrupt: + pass + + node.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main() diff --git a/henry_pkg/package.xml b/henry_pkg/package.xml index 5bc66fc..abad098 100644 --- a/henry_pkg/package.xml +++ b/henry_pkg/package.xml @@ -9,8 +9,17 @@ rclpy std_msgs + sensor_msgs + example_interfaces + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + ament_copyright + ament_flake8 ament_pep257 python3-pytest diff --git a/henry_pkg/setup.py b/henry_pkg/setup.py index cf51f02..a3dc297 100644 --- a/henry_pkg/setup.py +++ b/henry_pkg/setup.py @@ -21,6 +21,7 @@ entry_points={ 'console_scripts': [ 'talker = henry_pkg.my_pub:main', + 'imageServer = henry_pkg.server:main', ], }, ) diff --git a/lolito_interfaces/CMakeLists.txt b/lolito_interfaces/CMakeLists.txt new file mode 100644 index 0000000..aef6e8c --- /dev/null +++ b/lolito_interfaces/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.5) +project(lolito_interfaces) + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(sensor_msgs REQUIRED) +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + "srv/CaptureImage.srv" + DEPENDENCIES sensor_msgs # Add packages that above messages depend on, in this case geometry_msgs for Sphere.msg +) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +ament_export_dependencies(rosidl_default_runtime) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() diff --git a/lolito_interfaces/package.xml b/lolito_interfaces/package.xml new file mode 100644 index 0000000..d5e7244 --- /dev/null +++ b/lolito_interfaces/package.xml @@ -0,0 +1,26 @@ + + + + lolito_interfaces + 0.0.0 + TODO: Package description + roncanciovl + TODO: License declaration + ament_cmake + sensor_msgs + + rosidl_default_generators + + rosidl_default_runtime + + rosidl_interface_packages + + + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/lolito_interfaces/srv/CaptureImage.srv b/lolito_interfaces/srv/CaptureImage.srv new file mode 100644 index 0000000..f0cd11e --- /dev/null +++ b/lolito_interfaces/srv/CaptureImage.srv @@ -0,0 +1,3 @@ +bool req +--- +sensor_msgs/Image my_image \ No newline at end of file From fe85b933023e87bce891be5084a21be29efa3913 Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Thu, 16 Mar 2023 08:38:12 -0500 Subject: [PATCH 35/38] sapo --- willy_pkg/package.xml | 10 ++++++++++ willy_pkg/setup.py | 1 + willy_pkg/willy_pkg/foto_cliente.py | 0 3 files changed, 11 insertions(+) create mode 100644 willy_pkg/willy_pkg/foto_cliente.py diff --git a/willy_pkg/package.xml b/willy_pkg/package.xml index 947b895..642b823 100644 --- a/willy_pkg/package.xml +++ b/willy_pkg/package.xml @@ -7,6 +7,15 @@ willy Apache License 2.0 + + cv_bridge + cv_bridge + image_transport + image_transport + sensor_msgs + sensor_msgs + OpenCV + OpenCV rclpy std_msgs ros2launch @@ -21,3 +30,4 @@ + diff --git a/willy_pkg/setup.py b/willy_pkg/setup.py index a54376a..e8e2907 100644 --- a/willy_pkg/setup.py +++ b/willy_pkg/setup.py @@ -27,6 +27,7 @@ 'listener = willy_pkg.subscriber_member_function:main', 'lineal_speed = willy_pkg.lineal_speed:main', 'jh = willy_pkg.subscriber_photo:main', + 'photo = willy_pkg.foto_cliente:main', ], }, ) \ No newline at end of file diff --git a/willy_pkg/willy_pkg/foto_cliente.py b/willy_pkg/willy_pkg/foto_cliente.py new file mode 100644 index 0000000..e69de29 From d101f42da8b2ecc4c0adb78787d97f85bda1865b Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Thu, 16 Mar 2023 08:51:12 -0500 Subject: [PATCH 36/38] hola 33Merge remote-tracking branch 'origin/test' into alopoder --- henry_pkg/package.xml | 30 +++++++++++++++++ henry_pkg/setup.cfg | 4 +++ requirements.txt | 76 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 henry_pkg/package.xml create mode 100644 henry_pkg/setup.cfg create mode 100644 requirements.txt diff --git a/henry_pkg/package.xml b/henry_pkg/package.xml new file mode 100644 index 0000000..abad098 --- /dev/null +++ b/henry_pkg/package.xml @@ -0,0 +1,30 @@ + + + + henry_pkg + 0.0.0 + TODO: Package description + roncanciovl + Apache License 2.0 + + rclpy + std_msgs + sensor_msgs + example_interfaces + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + + + ament_copyright + + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/henry_pkg/setup.cfg b/henry_pkg/setup.cfg new file mode 100644 index 0000000..6beb4db --- /dev/null +++ b/henry_pkg/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script-dir=$base/lib/henry_pkg +[install] +install-scripts=$base/lib/henry_pkg diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..a504033 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,76 @@ +action-tutorials-py==0.9.4 +ament-copyright==0.9.7 +ament-cppcheck==0.9.7 +ament-cpplint==0.9.7 +ament-flake8==0.9.7 +ament-index-python==1.1.0 +ament-lint==0.9.7 +ament-lint-cmake==0.9.7 +ament-package==0.9.5 +ament-pep257==0.9.7 +ament-uncrustify==0.9.7 +ament-xmllint==0.9.7 +demo-nodes-py==0.9.4 +domain-coordinator==0.9.2 +examples-rclpy-executors==0.9.4 +examples-rclpy-minimal-action-client==0.9.4 +examples-rclpy-minimal-action-server==0.9.4 +examples-rclpy-minimal-client==0.9.4 +examples-rclpy-minimal-publisher==0.9.4 +examples-rclpy-minimal-service==0.9.4 +examples-rclpy-minimal-subscriber==0.9.4 +henry-pkg==0.0.0 +launch==0.10.10 +launch-ros==0.11.7 +launch-testing==0.10.10 +launch-testing-ros==0.11.7 +launch-xml==0.10.10 +launch-yaml==0.10.10 +networkx==3.0 +numpy==1.24.2 +osrf-pycommon==0.1.11 +quality-of-service-demo-py==0.9.4 +ros2action==0.9.12 +ros2bag==0.3.9 +ros2cli==0.9.12 +ros2component==0.9.12 +ros2doctor==0.9.12 +ros2interface==0.9.12 +ros2launch==0.11.7 +ros2lifecycle==0.9.12 +ros2multicast==0.9.12 +ros2node==0.9.12 +ros2param==0.9.12 +ros2pkg==0.9.12 +ros2run==0.9.12 +ros2service==0.9.12 +ros2topic==0.9.12 +rosidl-runtime-py==0.9.1 +rpyutils==0.2.0 +rqt==1.1.2 +rqt-action==0.4.9 +rqt-console==1.1.2 +rqt-graph==1.1.3 +rqt-gui==1.1.2 +rqt-gui-py==1.1.2 +rqt-moveit==1.0.1 +rqt-msg==1.0.5 +rqt-plot==1.1.1 +rqt-publisher==1.3.0 +rqt-py-console==1.0.2 +rqt-reconfigure==1.0.8 +rqt-robot-dashboard==0.5.8 +rqt-robot-monitor==1.0.5 +rqt-robot-steering==1.0.0 +rqt-runtime-monitor==1.0.0 +rqt-service-caller==1.0.5 +rqt-shell==1.0.2 +rqt-srv==1.0.3 +rqt-tf-tree==1.0.2 +rqt-top==1.0.2 +rqt-topic==1.3.0 +scikit-fuzzy==0.4.2 +scipy==1.10.1 +sros2==0.9.5 +teleop-twist-keyboard==2.3.2 +topic-monitor==0.9.4 From 3deccb5a01c28afbd06da4125df982cf41868593 Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Wed, 22 Mar 2023 16:37:50 -0500 Subject: [PATCH 37/38] sapobless --- lolito/CMakeLists.txt | 52 ------------------ lolito/lolito/__init__.py | 0 lolito/lolito/scripts/pubhen.py | 42 --------------- lolito/package.xml | 21 -------- lolito/scripts/__init__.py | 0 lolito/scripts/publisher_member_function.py | 41 -------------- lolito/scripts/subscriber_member_function.py | 38 ------------- lolito_interfaces/srv/CaptureImage.srv | 2 +- willy_pkg/package.xml | 2 + willy_pkg/willy_pkg/foto_cliente.py | 55 +++++++++++++++++++ willy_pkg/willy_pkg/subscriber_photo.py | 56 ++++++++++++-------- 11 files changed, 93 insertions(+), 216 deletions(-) delete mode 100644 lolito/CMakeLists.txt delete mode 100644 lolito/lolito/__init__.py delete mode 100755 lolito/lolito/scripts/pubhen.py delete mode 100644 lolito/package.xml delete mode 100644 lolito/scripts/__init__.py delete mode 100644 lolito/scripts/publisher_member_function.py delete mode 100644 lolito/scripts/subscriber_member_function.py diff --git a/lolito/CMakeLists.txt b/lolito/CMakeLists.txt deleted file mode 100644 index e4cff8b..0000000 --- a/lolito/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(lolito) - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(ament_cmake_python REQUIRED) -find_package(rclpy REQUIRED) -find_package(std-_msgs REQUIRED) - -ament_python_install_package(scripts) - -install(PROGRAMS - scripts/publisher_member_function.py - DESTINATION lib/${PROJECT_NAME} -) - -install(PROGRAMS - scripts/subscriber_member_function.py - DESTINATION lib/${PROJECT_NAME} -) - - -# uncomment the following section in order to fill in -# further dependencies manually. -# find_package( REQUIRED) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() diff --git a/lolito/lolito/__init__.py b/lolito/lolito/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/lolito/lolito/scripts/pubhen.py b/lolito/lolito/scripts/pubhen.py deleted file mode 100755 index 65e1fad..0000000 --- a/lolito/lolito/scripts/pubhen.py +++ /dev/null @@ -1,42 +0,0 @@ - -#!/home/roncanciovl/ros2class_ws/venv/bin/python3 - -import rclpy -from rclpy.node import Node - -from std_msgs.msg import String - - -class MinimalPublisher(Node): - - def __init__(self): - super().__init__('minimal_publisher') - self.publisher_ = self.create_publisher(String, 'topic', 10) - timer_period = 0.5 # seconds - self.timer = self.create_timer(timer_period, self.timer_callback) - self.i = 0 - - def timer_callback(self): - msg = String() - msg.data = 'Hello World: %d' % self.i - self.publisher_.publish(msg) - self.get_logger().info('Publishing: "%s"' % msg.data) - self.i += 1 - - -def main(args=None): - rclpy.init(args=args) - - minimal_publisher = MinimalPublisher() - - rclpy.spin(minimal_publisher) - - # Destroy the node explicitly - # (optional - otherwise it will be done automatically - # when the garbage collector destroys the node object) - minimal_publisher.destroy_node() - rclpy.shutdown() - - -if __name__ == '__main__': - main() \ No newline at end of file diff --git a/lolito/package.xml b/lolito/package.xml deleted file mode 100644 index 9da3e91..0000000 --- a/lolito/package.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - lolito - 0.0.0 - TODO: Package description - roncanciovl - TODO: License declaration - - ament_cmake - ament_cmake_python - rclpy - std_msgs - - ament_lint_auto - ament_lint_common - - - ament_cmake - - diff --git a/lolito/scripts/__init__.py b/lolito/scripts/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/lolito/scripts/publisher_member_function.py b/lolito/scripts/publisher_member_function.py deleted file mode 100644 index 71d3586..0000000 --- a/lolito/scripts/publisher_member_function.py +++ /dev/null @@ -1,41 +0,0 @@ -#!usr/bin/env python 3 - -import rclpy -from rclpy.node import Node - -from std_msgs.msg import String - - -class MinimalPublisher(Node): - - def __init__(self): - super().__init__('minimal_publisher') - self.publisher_ = self.create_publisher(String, 'topic', 10) - timer_period = 0.5 # seconds - self.timer = self.create_timer(timer_period, self.timer_callback) - self.i = 0 - - def timer_callback(self): - msg = String() - msg.data = 'Hola blesssssssss %d' % self.i - self.publisher_.publish(msg) - self.get_logger().info('Publishing: "%s"' % msg.data) - self.i += 1 - - -def main(args=None): - rclpy.init(args=args) - - minimal_publisher = MinimalPublisher() - - rclpy.spin(minimal_publisher) - - # Destroy the node explicitly - # (optional - otherwise it will be done automatically - # when the garbage collector destroys the node object) - minimal_publisher.destroy_node() - rclpy.shutdown() - - -if __name__ == '__main__': - main() \ No newline at end of file diff --git a/lolito/scripts/subscriber_member_function.py b/lolito/scripts/subscriber_member_function.py deleted file mode 100644 index 1a8b749..0000000 --- a/lolito/scripts/subscriber_member_function.py +++ /dev/null @@ -1,38 +0,0 @@ -#!usr/bin/env python 3 -import rclpy -from rclpy.node import Node - -from std_msgs.msg import String - - -class MinimalSubscriber(Node): - - def __init__(self): - super().__init__('minimal_subscriber') - self.subscription = self.create_subscription( - String, - 'topic', - self.listener_callback, - 10) - self.subscription # prevent unused variable warning - - def listener_callback(self, msg): - self.get_logger().info('I heard: "%s"' % msg.data) - - -def main(args=None): - rclpy.init(args=args) - - minimal_subscriber = MinimalSubscriber() - - rclpy.spin(minimal_subscriber) - - # Destroy the node explicitly - # (optional - otherwise it will be done automatically - # when the garbage collector destroys the node object) - minimal_subscriber.destroy_node() - rclpy.shutdown() - - -if __name__ == '__main__': - main() \ No newline at end of file diff --git a/lolito_interfaces/srv/CaptureImage.srv b/lolito_interfaces/srv/CaptureImage.srv index f0cd11e..dee9850 100644 --- a/lolito_interfaces/srv/CaptureImage.srv +++ b/lolito_interfaces/srv/CaptureImage.srv @@ -1,3 +1,3 @@ bool req --- -sensor_msgs/Image my_image \ No newline at end of file +sensor_msgs/Image image diff --git a/willy_pkg/package.xml b/willy_pkg/package.xml index 642b823..cc6c72f 100644 --- a/willy_pkg/package.xml +++ b/willy_pkg/package.xml @@ -24,6 +24,8 @@ ament_pep257 python3-pytest + lolito_interfaces + sensor_msgs ament_python diff --git a/willy_pkg/willy_pkg/foto_cliente.py b/willy_pkg/willy_pkg/foto_cliente.py index e69de29..cea0911 100644 --- a/willy_pkg/willy_pkg/foto_cliente.py +++ b/willy_pkg/willy_pkg/foto_cliente.py @@ -0,0 +1,55 @@ +import rclpy +from rclpy.node import Node +from sensor_msgs.msg import Image +from lolito_interfaces.srv import CaptureImage + + +class ImageCaptureServer(Node): + def __init__(self): + super().__init__('willy_envia') + self.srv = self.create_service(CaptureImage, 'capture_image', self.capture_image_callback) + + def capture_image_callback(self, request, response): + # Aquí es donde capturamos la imagen y la enviamos como respuesta + image = self.capture_image() + response.image = image + return response + + def capture_image(self): + # En este ejemplo, utilizamos la biblioteca OpenCV para capturar la imagen + import cv2 + + # Capturamos la imagen de la cámara web + cap = cv2.VideoCapture(0) + _, frame = cap.read() + + # Convertimos la imagen capturada a un mensaje ROS + msg = Image() + msg.header.frame_id = 'camera' + msg.encoding = 'bgr8' + msg.height, msg.width, _ = frame.shape + msg.step = 3 * msg.width + msg.data = frame.tobytes() + + # Liberamos la cámara web + cap.release() + + return msg + + +def main(args=None): + rclpy.init(args=args) + + node = ImageCaptureServer() + + try: + rclpy.spin(node) + except KeyboardInterrupt: + pass + + node.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main() diff --git a/willy_pkg/willy_pkg/subscriber_photo.py b/willy_pkg/willy_pkg/subscriber_photo.py index c84e1a5..cfd482f 100644 --- a/willy_pkg/willy_pkg/subscriber_photo.py +++ b/willy_pkg/willy_pkg/subscriber_photo.py @@ -1,41 +1,55 @@ import rclpy from rclpy.node import Node from sensor_msgs.msg import Image -import cv2 +from lolito_interfaces.srv import CaptureImage -class ImagePublisher(Node): +class ImageCaptureServer(Node): def __init__(self): - super().__init__('image_publisher') + super().__init__('image_capture_server') + self.srv = self.create_service(CaptureImage, 'capture_image', self.capture_image_callback) - # Create the publisher to publish images - self.publisher_ = self.create_publisher(Image, 'ALO', 10) + def capture_image_callback(self, request, response): + # Aquí es donde capturamos la imagen y la enviamos como respuesta + image = self.capture_image() + response.image = image + return response - # Read the image file - img = cv2.imread('/home/willy/Documentos/jh.jpg') + def capture_image(self): + # En este ejemplo, utilizamos la biblioteca OpenCV para capturar la imagen + import cv2 - # Convert the image to ROS format - ros_img = Image() - ros_img.header.frame_id = 'camera' - ros_img.height = img.shape[0] - ros_img.width = img.shape[1] - ros_img.encoding = 'bgr8' - ros_img.is_bigendian = False - ros_img.data = img.tostring() - ros_img.step = img.shape[1] * 3 + # Capturamos la imagen de la cámara web + cap = cv2.VideoCapture(0) + _, frame = cap.read() + + # Convertimos la imagen capturada a un mensaje ROS + msg = Image() + msg.header.frame_id = 'camera' + msg.encoding = 'bgr8' + msg.height, msg.width, _ = frame.shape + msg.step = 3 * msg.width + msg.data = frame.tobytes() + + # Liberamos la cámara web + cap.release() + + return msg - # Publish the image - self.publisher_.publish(ros_img) def main(args=None): rclpy.init(args=args) - image_publisher = ImagePublisher() + node = ImageCaptureServer() - rclpy.spin(image_publisher) + try: + rclpy.spin(node) + except KeyboardInterrupt: + pass - image_publisher.destroy_node() + node.destroy_node() rclpy.shutdown() + if __name__ == '__main__': main() From 44a28669bc354ea7aa82e87aa4f3cbd075acdcb9 Mon Sep 17 00:00:00 2001 From: WILLY160116 Date: Wed, 22 Mar 2023 17:27:48 -0500 Subject: [PATCH 38/38] siuu --- willy_pkg/setup.py | 4 +- willy_pkg/willy_pkg/Client_photo.py | 51 +++++++++++++++++++++++++ willy_pkg/willy_pkg/Server_photo.py | 58 +++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 willy_pkg/willy_pkg/Client_photo.py create mode 100644 willy_pkg/willy_pkg/Server_photo.py diff --git a/willy_pkg/setup.py b/willy_pkg/setup.py index e8e2907..e08a3f3 100644 --- a/willy_pkg/setup.py +++ b/willy_pkg/setup.py @@ -26,8 +26,8 @@ 'talker = willy_pkg.publisher_member_function:main', 'listener = willy_pkg.subscriber_member_function:main', 'lineal_speed = willy_pkg.lineal_speed:main', - 'jh = willy_pkg.subscriber_photo:main', - 'photo = willy_pkg.foto_cliente:main', + 'client = willy_pkg.Client_photo:main', + 'server = willy_pkg.Server_photo:main' ], }, ) \ No newline at end of file diff --git a/willy_pkg/willy_pkg/Client_photo.py b/willy_pkg/willy_pkg/Client_photo.py new file mode 100644 index 0000000..7f04ed9 --- /dev/null +++ b/willy_pkg/willy_pkg/Client_photo.py @@ -0,0 +1,51 @@ +#Create a node client to send a message and visualize the image reception +# Path: src/willy_pkg/willy_pkg/probar.py +# Compare this snippet from src/willy_pkg/willy_pkg/foto_cliente.py: + +import rclpy +from rclpy.node import Node +from sensor_msgs.msg import Image +from lolito_interfaces.srv import CaptureImage + +class ImageCaptureClient(Node): + def __init__(self): + super().__init__('willy_cliente') + self.client = self.create_client(CaptureImage, 'capture_image') + while not self.client.wait_for_service(timeout_sec=1.0): + self.get_logger().info('Waiting for the capture_image service...') + self.req = CaptureImage.Request() + + def send_request(self): + self.future = self.client.call_async(self.req) + +def main(args=None): + rclpy.init(args=args) + + node = ImageCaptureClient() + + node.send_request() + + while rclpy.ok(): + rclpy.spin_once(node) + if node.future.done(): + try: + response = node.future.result() + except Exception as e: + node.get_logger().info( + 'Service call failed %r' % (e,)) + else: + node.get_logger().info('Received image') + # Visualizamos la imagen recibida + import cv2 + import numpy as np + frame = np.frombuffer(response.image.data, dtype=np.uint8).reshape(response.image.height, response.image.width, -1) + cv2.imshow('Image', frame) + cv2.waitKey(0) + cv2.destroyAllWindows() + break + + node.destroy_node() + rclpy.shutdown() + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/willy_pkg/willy_pkg/Server_photo.py b/willy_pkg/willy_pkg/Server_photo.py new file mode 100644 index 0000000..c4580da --- /dev/null +++ b/willy_pkg/willy_pkg/Server_photo.py @@ -0,0 +1,58 @@ +#Create a node server to receive a message and capture photo and send to client +# Path: src/willy_pkg/willy_pkg/probar.py +# Compare this snippet from src/willy_pkg/willy_pkg/foto_servidor.py: + +import rclpy +from rclpy.node import Node +from sensor_msgs.msg import Image +from lolito_interfaces.srv import CaptureImage + +class ImageCaptureServer(Node): + def __init__(self): + super().__init__('willy_server') + self.srv = self.create_service(CaptureImage, 'capture_image', self.capture_image_callback) + + def capture_image_callback(self, request, response): + # Aquí es donde capturamos la imagen y la enviamos como respuesta + image = self.capture_image() + response.image = image + return response + + def capture_image(self): + # En este ejemplo, utilizamos la biblioteca OpenCV para capturar la imagen + import cv2 + + # Capturamos la imagen de la cámara web + cap = cv2.VideoCapture(0) + _, frame = cap.read() + + # Convertimos la imagen capturada a un mensaje ROS + msg = Image() + msg.header.frame_id = 'camera' + msg.encoding = 'bgr8' + msg.height, msg.width, _ = frame.shape + msg.step = 3 * msg.width + msg.data = frame.tobytes() + + # Liberamos la cámara web + cap.release() + + return msg + + +def main(args=None): + rclpy.init(args=args) + + node = ImageCaptureServer() + + try: + rclpy.spin(node) + except KeyboardInterrupt: + pass + + node.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main()