diff --git a/README.md b/README.md index b7446b8..3e35919 100644 --- a/README.md +++ b/README.md @@ -128,3 +128,13 @@ BUENOS DIAS :) ADIOS hola willy HOla reyes + +feliz cumpleaños willy +GOLFITO +Paso por ti a las 2 ve arreglandote ;) + +Feliz cumpleaños willito :) +Buena willito kchon + + +nn diff --git a/Reyes_Pa/Reyes_Pa/Fino.py b/Reyes_Pa/Reyes_Pa/Fino.py new file mode 100644 index 0000000..6a25f89 --- /dev/null +++ b/Reyes_Pa/Reyes_Pa/Fino.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__('Nodo_Reyes') + self.publisher_ = self.create_publisher(String, 'RPM', 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 = str(3) + 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/Reyes_Pa/Reyes_Pa/JACHAS.jpg b/Reyes_Pa/Reyes_Pa/JACHAS.jpg new file mode 100644 index 0000000..588f02c Binary files /dev/null and b/Reyes_Pa/Reyes_Pa/JACHAS.jpg differ diff --git a/Reyes_Pa/Reyes_Pa/MELOO.jpg b/Reyes_Pa/Reyes_Pa/MELOO.jpg new file mode 100644 index 0000000..049261f Binary files /dev/null and b/Reyes_Pa/Reyes_Pa/MELOO.jpg differ diff --git a/Reyes_Pa/Reyes_Pa/P1_EnvFoto.py b/Reyes_Pa/Reyes_Pa/P1_EnvFoto.py new file mode 100644 index 0000000..fe67643 --- /dev/null +++ b/Reyes_Pa/Reyes_Pa/P1_EnvFoto.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 + +import cv2 +import numpy as np +import rclpy +from rclpy.node import Node +from sensor_msgs.msg import Image +from cv_bridge import CvBridge + +class ImagePublisher(Node): + + def __init__(self): + super().__init__('image_publisher') + self.publisher_ = self.create_publisher(Image, 'ALO', 10) + self.timer_ = self.create_timer(0.1, self.publish_image) + self.bridge_ = CvBridge() + + def publish_image(self): + # Creamos una imagen de 640x480 píxeles con tres canales (BGR) + image = np.zeros((480, 640, 3), np.uint8) + # Dibujamos un círculo azul en el centro de la imagen + cv2.circle(image, (320, 240), 100, (255, 0, 0), -1) + # Convertimos la imagen a un mensaje de ROS + msg = self.bridge_.cv2_to_imgmsg(image, 'bgr8') + # Publicamos el mensaje + self.publisher_.publish(msg) + self.get_logger().info('Imagen publicada') + +def main(args=None): + rclpy.init(args=args) + node = ImagePublisher() + rclpy.spin(node) + rclpy.shutdown() + +if __name__ == '__main__': + main() diff --git a/Reyes_Pa/Reyes_Pa/P1_RecFoto.py b/Reyes_Pa/Reyes_Pa/P1_RecFoto.py new file mode 100644 index 0000000..ea1ce42 --- /dev/null +++ b/Reyes_Pa/Reyes_Pa/P1_RecFoto.py @@ -0,0 +1,29 @@ +import rclpy +from rclpy.node import Node +from sensor_msgs.msg import Image + + +class ImageSubscriber(Node): + + def __init__(self): + super().__init__('image_subscriber') + self.subscription = self.create_subscription( + Image, + 'ALO', + self.listener_callback, + 10) + self.subscription # prevent unused variable warning + + def listener_callback(self, msg): + self.get_logger().info('Received an image!') # add your own code here to process the image data + + +def main(args=None): + rclpy.init(args=args) + node = ImageSubscriber() + rclpy.spin(node) + rclpy.shutdown() + + +if __name__ == '__main__': + main() diff --git a/Reyes_Pa/Reyes_Pa/P2_EnvFoto.py b/Reyes_Pa/Reyes_Pa/P2_EnvFoto.py new file mode 100644 index 0000000..576d454 --- /dev/null +++ b/Reyes_Pa/Reyes_Pa/P2_EnvFoto.py @@ -0,0 +1,29 @@ +import rclpy +from rclpy.node import Node +from sensor_msgs.msg import Image +from cv_bridge import CvBridge +import cv2 + + +class ImagePublisher(Node): + + def __init__(self): + super().__init__('image_publisher') + self.publisher_ = self.create_publisher(Image, 'ALO', 10) + self.timer = self.create_timer(0.1, self.timer_callback) + self.bridge = CvBridge() + + def timer_callback(self): + img = cv2.imread('/home/z3rn291/poderoso/src/Reyes_Pa/Reyes_Pa/JACHAS.jpg') + msg = self.bridge.cv2_to_imgmsg(img, encoding='bgr8') + self.publisher_.publish(msg) + self.get_logger().info('Image published!') + +def main(args=None): + rclpy.init(args=args) + node = ImagePublisher() + rclpy.spin(node) + rclpy.shutdown() + +if __name__ == '__main__': + main() diff --git a/Reyes_Pa/Reyes_Pa/Prueba.py b/Reyes_Pa/Reyes_Pa/Prueba.py new file mode 100644 index 0000000..830dade --- /dev/null +++ b/Reyes_Pa/Reyes_Pa/Prueba.py @@ -0,0 +1,31 @@ +import rclpy +from rclpy.node import Node +from sensor_msgs.msg import Image +from cv_bridge import CvBridge +import cv2 + + +class MiNodo(Node): + + def __init__(self): + super().__init__('ReyesN') + self.subscription = self.create_subscription(Image, 'ALO', self.imagen_callback, 10) + self.cv_bridge = CvBridge() + + def imagen_callback(self, msg): + # convierte el mensaje de imagen en una matriz numpy utilizando cv_bridge + imagen = self.cv_bridge.imgmsg_to_cv2(msg, desired_encoding='bgr8') + + # muestra la imagen en una ventana de OpenCV + cv2.imshow('Imagen recibida', imagen) + cv2.waitKey(1) + +def main(args=None): + rclpy.init(args=args) + mi_nodo = MiNodo() + rclpy.spin(mi_nodo) + mi_nodo.destroy_node() + rclpy.shutdown() + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/Reyes_Pa/Reyes_Pa/T1_PubRPM.py b/Reyes_Pa/Reyes_Pa/T1_PubRPM.py new file mode 100644 index 0000000..236f178 --- /dev/null +++ b/Reyes_Pa/Reyes_Pa/T1_PubRPM.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__('CR_T1_PUBRPM') + self.publisher_ = self.create_publisher(String, 'RPM', 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 = str(3) + 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/Reyes_Pa/Reyes_Pa/T1_PubSub.py b/Reyes_Pa/Reyes_Pa/T1_PubSub.py new file mode 100644 index 0000000..eb5915c --- /dev/null +++ b/Reyes_Pa/Reyes_Pa/T1_PubSub.py @@ -0,0 +1,39 @@ +import rclpy +from rclpy.node import Node +from std_msgs.msg import String + +class MyNode(Node): + + def __init__(self): + 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, + 'RPM', + self.listener_callback, + 10) + self.subscription # prevent unused variable warning + + def listener_callback(self, msg): + #self.get_logger().info('I heard: "%s"' % msg.data) + 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) + +def main(args=None): + rclpy.init(args=args) + + my_node = MyNode() + + rclpy.spin(my_node) + + my_node.destroy_node() + rclpy.shutdown() + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/Reyes_Pa/Reyes_Pa/T1_SubLinSpeed.py b/Reyes_Pa/Reyes_Pa/T1_SubLinSpeed.py new file mode 100644 index 0000000..9b39479 --- /dev/null +++ b/Reyes_Pa/Reyes_Pa/T1_SubLinSpeed.py @@ -0,0 +1,36 @@ +import rclpy +from rclpy.node import Node +from std_msgs.msg import String + + +class MinimalSubscriber(Node): + + def __init__(self): + super().__init__('CR_T1_SubLinSpeed') + self.subscription = self.create_subscription( + String, + 'lineal_speed', + 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/Reyes_Pa/Reyes_Pa/T2_Cliente.py b/Reyes_Pa/Reyes_Pa/T2_Cliente.py new file mode 100644 index 0000000..f416beb --- /dev/null +++ b/Reyes_Pa/Reyes_Pa/T2_Cliente.py @@ -0,0 +1,29 @@ +import rclpy +from rclpy.node import Node +from example_interfaces.srv import AddTwoInts + +def main(args=None): + rclpy.init(args=args) + + node = rclpy.create_node('minimal_client') + + client = node.create_client(AddTwoInts, 'add_two_ints') + while not client.wait_for_service(timeout_sec=1.0): + node.get_logger().info('service not available, waiting again...') + request = AddTwoInts.Request() + request.a = 3 + request.b = 1 + future = client.call_async(request) + rclpy.spin_until_future_complete(node, future) + if future.result() is not None: + response = future.result() + node.get_logger().info('Result of add_two_ints: %d' % (response.sum,)) + else: + node.get_logger().info('Service call failed %r' % (future.exception(),)) + + node.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main() diff --git a/Reyes_Pa/Reyes_Pa/T2_Cliente1.py b/Reyes_Pa/Reyes_Pa/T2_Cliente1.py new file mode 100644 index 0000000..18269a0 --- /dev/null +++ b/Reyes_Pa/Reyes_Pa/T2_Cliente1.py @@ -0,0 +1,43 @@ +import rclpy +from rclpy.node import Node +from sensor_msgs.msg import Image +from lolito_interfaces.srv import CaptureImage + + +class Client(Node): + + def __init__(self): + super().__init__('client_node') + self.client = self.create_client(CaptureImage, 'capture_image') + while not self.client.wait_for_service(timeout_sec=1.0): + self.get_logger().info('Servidor no disponible') + self.request = CaptureImage.Request() + + def send_request(self): + self.request.req = True + self.future = self.client.call_async(self.request) + + def get_response(self): + while rclpy.ok(): + rclpy.spin_once(self) + if self.future.done(): + try: + response = self.future.result() + img_data = response.my_image + # Aquí puedes hacer lo que necesites con la imagen recibida + break + except Exception as e: + self.get_logger().info('Servicio fallido %r' % (e,)) + break + + +def main(args=None): + rclpy.init(args=args) + client = Client() + client.send_request() + client.get_response() + rclpy.shutdown() + + +if __name__ == '__main__': + main() diff --git a/Reyes_Pa/Reyes_Pa/T2_Servidor.py b/Reyes_Pa/Reyes_Pa/T2_Servidor.py new file mode 100644 index 0000000..99c782d --- /dev/null +++ b/Reyes_Pa/Reyes_Pa/T2_Servidor.py @@ -0,0 +1,28 @@ +import rclpy +from rclpy.node import Node +from example_interfaces.srv import AddTwoInts + +class MinimalService(Node): + + def __init__(self): + super().__init__('minimal_service') + self.srv = self.create_service(AddTwoInts, 'add_two_ints', self.add_two_ints_callback) + + def add_two_ints_callback(self, request, response): + response.sum = request.a + request.b + self.get_logger().info('Incoming request\na: %d b: %d' % (request.a, request.b)) + return response + +def main(args=None): + rclpy.init(args=args) + + minimal_service = MinimalService() + + rclpy.spin(minimal_service) + + minimal_service.destroy() + rclpy.shutdown() + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/Reyes_Pa/Reyes_Pa/T2_Servidor1.py b/Reyes_Pa/Reyes_Pa/T2_Servidor1.py new file mode 100644 index 0000000..06042b0 --- /dev/null +++ b/Reyes_Pa/Reyes_Pa/T2_Servidor1.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.my_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/Reyes_Pa/Reyes_Pa/__init__.py b/Reyes_Pa/Reyes_Pa/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Reyes_Pa/launch/Prueba.launch.py b/Reyes_Pa/launch/Prueba.launch.py new file mode 100644 index 0000000..e918651 --- /dev/null +++ b/Reyes_Pa/launch/Prueba.launch.py @@ -0,0 +1,20 @@ +import launch +import launch_ros.actions +import launch_ros.substitutions + +def generate_launch_description(): + node1 = launch_ros.actions.Node( + package='Reyes_Pa', + executable='P1E', + name='nodo1' + ) + node2 = launch_ros.actions.Node( + package='Reyes_Pa', + executable='P1R', + name='nodo2' + ) + + return launch.LaunchDescription([ + node1, + node2 + ]) \ No newline at end of file diff --git a/Reyes_Pa/launch/Union.launch.py b/Reyes_Pa/launch/Union.launch.py new file mode 100644 index 0000000..b45a6d6 --- /dev/null +++ b/Reyes_Pa/launch/Union.launch.py @@ -0,0 +1,26 @@ +import launch +import launch_ros.actions +import launch_ros.substitutions + +def generate_launch_description(): + node1 = launch_ros.actions.Node( + package='Reyes_Pa', + executable='RPM', + name='nodo1' + ) + node2 = launch_ros.actions.Node( + package='Reyes_Pa', + executable='SupPub', + name='nodo2' + ) + node3 = launch_ros.actions.Node( + package='Reyes_Pa', + executable='LinSpeed', + name='nodo3' + ) + + return launch.LaunchDescription([ + node1, + node2, + node3 + ]) \ No newline at end of file diff --git a/Reyes_Pa/launch/lolo.launch.py b/Reyes_Pa/launch/lolo.launch.py new file mode 100644 index 0000000..cd0ebcd --- /dev/null +++ b/Reyes_Pa/launch/lolo.launch.py @@ -0,0 +1,54 @@ +import launch +from launch.substitutions import Command, LaunchConfiguration +import launch_ros +import os +from ament_index_python.packages import get_package_share_directory + + +def generate_launch_description(): + + urdf_file_name = 'Seguidor_linea_robot.urdf' + urdf = os.path.join( + get_package_share_directory('Reyes_Pa'), + 'urdf', + urdf_file_name) + with open(urdf, 'r') as infp: + robot_desc = infp.read() + + + robot_state_publisher_node = launch_ros.actions.Node( + package='robot_state_publisher', + executable='robot_state_publisher', + name='robot_state_publisher', + output='screen', + parameters=[{'robot_description': robot_desc}], + arguments=[urdf] + ) + joint_state_publisher_node = launch_ros.actions.Node( + package='joint_state_publisher', + executable='joint_state_publisher', + name='joint_state_publisher', + condition=launch.conditions.UnlessCondition(LaunchConfiguration('gui')) + ) + joint_state_publisher_gui_node = launch_ros.actions.Node( + package='joint_state_publisher_gui', + executable='joint_state_publisher_gui', + name='joint_state_publisher_gui', + condition=launch.conditions.IfCondition(LaunchConfiguration('gui')) + ) + rviz_node = launch_ros.actions.Node( + package='rviz2', + executable='rviz2', + name='rviz2', + output='screen', + ) + + return launch.LaunchDescription([ + launch.actions.DeclareLaunchArgument(name='gui', default_value='True', + description='Flag to enable joint_state_publisher_gui'), + + joint_state_publisher_node, + joint_state_publisher_gui_node, + robot_state_publisher_node, + rviz_node + ]) \ No newline at end of file diff --git a/Reyes_Pa/launch/n.launch.py b/Reyes_Pa/launch/n.launch.py new file mode 100644 index 0000000..d383858 --- /dev/null +++ b/Reyes_Pa/launch/n.launch.py @@ -0,0 +1,26 @@ +import launch +import launch_ros.actions +import launch_ros.substitutions + +def generate_launch_description(): + node1 = launch_ros.actions.Node( + package='Reyes_Pa', + executable='F', + name='nodo1' + ) + node2 = launch_ros.actions.Node( + package='Reyes_Pa', + executable='P1E', + name='nodo2' + ) + node3 = launch_ros.actions.Node( + package='Reyes_Pa', + executable='hola', + name='nodo3' + ) + + return launch.LaunchDescription([ + node1, + node2, + node3 + ]) \ No newline at end of file diff --git a/Reyes_Pa/package.xml b/Reyes_Pa/package.xml new file mode 100644 index 0000000..6013c49 --- /dev/null +++ b/Reyes_Pa/package.xml @@ -0,0 +1,34 @@ + + + + Reyes_Pa + 0.0.0 + TODO: Package description + z3rn291 + Apache License 2.0 + + rclpy + std_msgs + + cv_bridge + cv_bridge + image_transport + image_transport + sensor_msgs + sensor_msgs + OpenCV + OpenCV + + lolito_interfaces + lolito_interfaces + + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/Reyes_Pa/resource/Reyes_Pa b/Reyes_Pa/resource/Reyes_Pa new file mode 100644 index 0000000..e69de29 diff --git a/Reyes_Pa/setup.cfg b/Reyes_Pa/setup.cfg new file mode 100644 index 0000000..7b4a3d5 --- /dev/null +++ b/Reyes_Pa/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script_dir=$base/lib/Reyes_Pa +[install] +install_scripts=$base/lib/Reyes_Pa diff --git a/Reyes_Pa/setup.py b/Reyes_Pa/setup.py new file mode 100644 index 0000000..0d11bec --- /dev/null +++ b/Reyes_Pa/setup.py @@ -0,0 +1,61 @@ +from setuptools import setup +####### +import os +from glob import glob +from setuptools import setup +from setuptools import find_packages +########## + + +package_name = 'Reyes_Pa' +############# +package_files = [ + 'launch/Prueba.launch.py', + 'launch/Union.launch.py', +] +#### +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']), + #COLOQUE NUEVO + #('share/' + package_name, package_files), + #('share/' + package_name + '/launch', package_files), + (os.path.join('share', package_name, 'launch'), glob('launch/*.py')), + #######nuevo_robot + (os.path.join('share', package_name, 'urdf'), glob('urdf/*')), + (os.path.join('share', package_name, 'meshes'), glob('meshes/*')), + (os.path.join('share', package_name, 'worlds'), glob('worlds/*')), + + + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='z3rn291', + maintainer_email='u7003510@unimilitar.edu.co', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + 'talker = Reyes_Pa.Fino:main', + 'RPM = Reyes_Pa.T1_PubRPM:main', + 'SupPub = Reyes_Pa.T1_PubSub:main', + 'LinSpeed = Reyes_Pa.T1_SubLinSpeed:main', + 'hola = Reyes_Pa.Prueba:main', + 'P1E = Reyes_Pa.P1_EnvFoto:main', + 'P1R = Reyes_Pa.P1_RecFoto:main', + 'F = Reyes_Pa.P2_EnvFoto:main', + 'S = Reyes_Pa.T2_Servidor1:main', + 'C = Reyes_Pa.T2_Cliente1:main', + ], + + }, +) + + + diff --git a/Reyes_Pa/test/test_copyright.py b/Reyes_Pa/test/test_copyright.py new file mode 100644 index 0000000..97a3919 --- /dev/null +++ b/Reyes_Pa/test/test_copyright.py @@ -0,0 +1,25 @@ +# 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 + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/Reyes_Pa/test/test_flake8.py b/Reyes_Pa/test/test_flake8.py new file mode 100644 index 0000000..27ee107 --- /dev/null +++ b/Reyes_Pa/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/Reyes_Pa/test/test_pep257.py b/Reyes_Pa/test/test_pep257.py new file mode 100644 index 0000000..b234a38 --- /dev/null +++ b/Reyes_Pa/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/henry_pkg/henry_pkg/cuadrado_robot_node.py b/henry_pkg/henry_pkg/cuadrado_robot_node.py new file mode 100644 index 0000000..fc1ff53 --- /dev/null +++ b/henry_pkg/henry_pkg/cuadrado_robot_node.py @@ -0,0 +1,34 @@ +import rclpy +from rclpy.node import Node +from geometry_msgs.msg import Twist +from math import pi + + +class CuadradoRobotNode(Node): + def __init__(self): + super().__init__('cuadrado_robot_node') + self.publisher_ = self.create_publisher(Twist, '/cmd_vel', 10) + self.timer_ = self.create_timer(1.0, self.publish_twist) + self.counter_ = 0 + + def publish_twist(self): + twist = Twist() + twist.linear.x = 0.2 + twist.angular.z = 0.0 + if self.counter_ % 4 == 0: + twist.linear.x = 0.0 + twist.angular.z = pi/2 + self.publisher_.publish(twist) + self.counter_ += 1 + + +def main(args=None): + rclpy.init(args=args) + node = CuadradoRobotNode() + rclpy.spin(node) + node.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main() 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/CMakeLists.txt b/lolito/CMakeLists.txt index 0d8df9a..7c406e1 100644 --- a/lolito/CMakeLists.txt +++ b/lolito/CMakeLists.txt @@ -21,14 +21,16 @@ find_package(ament_cmake_python REQUIRED) find_package(rclpy REQUIRED) find_package(std_msgs REQUIRED) -ament_python_install_package(${PROJECT_NAME}) +ament_python_install_package(scripts) install(PROGRAMS - lolito/scripts/pubhen.py + scripts/Z_Melo.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 59c8ed8..a9421c9 100644 --- a/lolito/package.xml +++ b/lolito/package.xml @@ -7,11 +7,13 @@ roncanciovl TODO: License declaration + ament_cmake ament_cmake_python - rclpy - std_msgs - + rclpy + std_msgs + + ament_lint_auto ament_lint_common diff --git a/lolito/scripts/Z_Melo.py b/lolito/scripts/Z_Melo.py new file mode 100644 index 0000000..fff0ae1 --- /dev/null +++ b/lolito/scripts/Z_Melo.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/__init__.py b/lolito/scripts/__init__.py new file mode 100644 index 0000000..e69de29 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 diff --git a/lolito_interfaces/srv/Foto.srv b/lolito_interfaces/srv/Foto.srv new file mode 100644 index 0000000..d0621d0 --- /dev/null +++ b/lolito_interfaces/srv/Foto.srv @@ -0,0 +1,8 @@ +# request +--- +string path # Path de la imagen a enviar + +# response +--- +sensor_msgs/Image image # Imagen en formato sensor_msgs/Image +sensor_msgs/Image image1 # Imagen en formato sensor_msgs/Image \ No newline at end of file diff --git a/lolito_interfaces/srv/Word.srv b/lolito_interfaces/srv/Word.srv new file mode 100644 index 0000000..abdf996 --- /dev/null +++ b/lolito_interfaces/srv/Word.srv @@ -0,0 +1,7 @@ +# request +--- +string word_to_send # Palabra a enviar + +# response +--- +string word_received # Palabra recibida \ No newline at end of file diff --git a/modelo_robot/launch/display.launch.py b/modelo_robot/launch/display.launch.py new file mode 100644 index 0000000..6b0608e --- /dev/null +++ b/modelo_robot/launch/display.launch.py @@ -0,0 +1,54 @@ +import launch +from launch.substitutions import Command, LaunchConfiguration +import launch_ros +import os +from ament_index_python.packages import get_package_share_directory + + +def generate_launch_description(): + + urdf_file_name = 'Seguidor_linea_robot.urdf' + urdf = os.path.join( + get_package_share_directory('modelo_robot'), + 'urdf', + urdf_file_name) + with open(urdf, 'r') as infp: + robot_desc = infp.read() + + + robot_state_publisher_node = launch_ros.actions.Node( + package='robot_state_publisher', + executable='robot_state_publisher', + name='robot_state_publisher', + output='screen', + parameters=[{'robot_description': robot_desc}], + arguments=[urdf] + ) + joint_state_publisher_node = launch_ros.actions.Node( + package='joint_state_publisher', + executable='joint_state_publisher', + name='joint_state_publisher', + condition=launch.conditions.UnlessCondition(LaunchConfiguration('gui')) + ) + joint_state_publisher_gui_node = launch_ros.actions.Node( + package='joint_state_publisher_gui', + executable='joint_state_publisher_gui', + name='joint_state_publisher_gui', + condition=launch.conditions.IfCondition(LaunchConfiguration('gui')) + ) + rviz_node = launch_ros.actions.Node( + package='rviz2', + executable='rviz2', + name='rviz2', + output='screen', + ) + + return launch.LaunchDescription([ + launch.actions.DeclareLaunchArgument(name='gui', default_value='True', + description='Flag to enable joint_state_publisher_gui'), + + joint_state_publisher_node, + joint_state_publisher_gui_node, + robot_state_publisher_node, + rviz_node + ]) \ No newline at end of file diff --git a/modelo_robot/launch/gazebo.launch.py b/modelo_robot/launch/gazebo.launch.py new file mode 100644 index 0000000..cabbd08 --- /dev/null +++ b/modelo_robot/launch/gazebo.launch.py @@ -0,0 +1,107 @@ +import os + +from ament_index_python.packages import get_package_share_directory + +from launch_ros.parameter_descriptions import ParameterValue +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, ExecuteProcess +from launch.conditions import IfCondition +from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare +from launch.actions import RegisterEventHandler +from launch.event_handlers import OnProcessExit + + + +def generate_launch_description(): + + + model_arg = DeclareLaunchArgument(name='model', description='Absolute path to robot urdf file') + pkg_gazebo_ros = get_package_share_directory('gazebo_ros') + use_sim_time = LaunchConfiguration('use_sim_time') + package_name = 'modelo_robot' + pkg_share = FindPackageShare(package=package_name).find(package_name) + pkg_gazebo_ros = FindPackageShare(package='gazebo_ros').find('gazebo_ros') + + #world_file_path = 'world.world' + #world = LaunchConfiguration('world') + #world_path = os.path.join(pkg_share, 'worlds', world_file_path) + + declare_use_sim_time_cmd = DeclareLaunchArgument( + name='use_sim_time', + default_value='true', + description='Use simulation (Gazebo) clock if true' + ) + + robot_name_in_model = 'Seguidor_linea_robot' + + # Get URDF via xacro + + urdf_file_name = 'Seguidor_linea_robot.urdf' + urdf = os.path.join( + get_package_share_directory('modelo_robot'), + 'urdf', + urdf_file_name + ) + with open(urdf, 'r') as infp: + robot_desc = infp.read() + + robot_description = {"robot_description": robot_desc} + + + #rivz2 + rviz2 = Node( + package='rviz2', + executable='rviz2', + name='rviz2', + output='log', + parameters=[{'use_sim_time': use_sim_time}], + ) + + robot_state_publisher_node = Node( + package='robot_state_publisher', + executable='robot_state_publisher', + parameters= [{'use_sim_time': use_sim_time, 'robot_description': robot_desc}] #[{'use_sim_time': use_sim_time, "robot_description": robot_description_content}], + ) + + start_joint_state_publisher_cmd = Node( + package='joint_state_publisher', + executable='joint_state_publisher', + parameters=[{'use_sim_time': use_sim_time}], + name='joint_state_publisher', + ) + + + '''declare_world_cmd = DeclareLaunchArgument( + name='world', + default_value=world_path, + description='Full path to the world model file to load' + ) ''' + + #spawn the robot + spawn = Node( + package='gazebo_ros', + executable='spawn_entity.py', + arguments=["-topic", "/robot_description", + "-entity", robot_name_in_model, + "-x", '0.0', + "-y", '0.0', + "-z", '0.05', + "-Y", '0.0'] + ) + + gazebo = ExecuteProcess( + cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_factory.so', + '-s', 'libgazebo_ros_init.so'], output='screen', + ) + + + return LaunchDescription([ + declare_use_sim_time_cmd, + rviz2, + spawn, + robot_state_publisher_node, + gazebo +]) diff --git a/modelo_robot/meshes/Base_castor_link.STL b/modelo_robot/meshes/Base_castor_link.STL new file mode 100644 index 0000000..2c5bab3 Binary files /dev/null and b/modelo_robot/meshes/Base_castor_link.STL differ diff --git a/modelo_robot/meshes/Rueda_castor_link.STL b/modelo_robot/meshes/Rueda_castor_link.STL new file mode 100644 index 0000000..39d8e9b Binary files /dev/null and b/modelo_robot/meshes/Rueda_castor_link.STL differ diff --git a/modelo_robot/meshes/Rueda_derecha_link.STL b/modelo_robot/meshes/Rueda_derecha_link.STL new file mode 100644 index 0000000..8e1c3ec Binary files /dev/null and b/modelo_robot/meshes/Rueda_derecha_link.STL differ diff --git a/modelo_robot/meshes/Rueda_izquierda_link.STL b/modelo_robot/meshes/Rueda_izquierda_link.STL new file mode 100644 index 0000000..2737480 Binary files /dev/null and b/modelo_robot/meshes/Rueda_izquierda_link.STL differ diff --git a/modelo_robot/meshes/base_link.STL b/modelo_robot/meshes/base_link.STL new file mode 100644 index 0000000..afe81e4 Binary files /dev/null and b/modelo_robot/meshes/base_link.STL differ diff --git a/modelo_robot/modelo_robot/P_reci.py b/modelo_robot/modelo_robot/P_reci.py new file mode 100644 index 0000000..3ea4fb7 --- /dev/null +++ b/modelo_robot/modelo_robot/P_reci.py @@ -0,0 +1,27 @@ +import rclpy +from rclpy.node import Node +from nav_msgs.msg import Odometry + + +class CuadradoRobotPosicionNode(Node): + def _init_(self): + super()._init_('cuadrado_robot_posicion_node') + self.subscription_ = self.create_subscription(Odometry, '/odom', self.odometry_callback, 10) + + def odometry_callback(self, msg): + x = msg.pose.pose.position.x + y = msg.pose.pose.position.y + z = msg.pose.pose.position.z + self.get_logger().info(f"Posición actual: x={x:.2f} m, y={y:.2f} m, z={z:.2f} m") + + +def main(args=None): + rclpy.init(args=args) + node = CuadradoRobotPosicionNode() + rclpy.spin(node) + node.destroy_node() + rclpy.shutdown() + + +if __name__== '_main_': + main() \ No newline at end of file diff --git a/modelo_robot/modelo_robot/Perras.py b/modelo_robot/modelo_robot/Perras.py new file mode 100644 index 0000000..3548a61 --- /dev/null +++ b/modelo_robot/modelo_robot/Perras.py @@ -0,0 +1,37 @@ +import rclpy +from rclpy.node import Node + +from geometry_msgs.msg import Twist + +class PublicadorCMD(Node): + + def __init__(self): + super().__init__('publicador_cmd') + self.publisher_ = self.create_publisher(Twist, '/cmd_vel', 10) #(tipo_mensaje, nombre_topic, QoS) + timer_period = 0.01 # seconds + self.timer = self.create_timer(timer_period, self.timer_callback) + + def timer_callback(self): + msg = Twist() + msg.linear.x = 0.1 + #msg.angular.z + self.publisher_.publish(msg) + self.get_logger().info('Publishing: "%s"' % msg) + + +def main(args=None): + rclpy.init(args=args) + + publicador_cmd = PublicadorCMD() + + rclpy.spin(publicador_cmd) + + # Destroy the node explicitly + # (optional - otherwise it will be done automatically + # when the garbage collector destroys the node object) + publicador_cmd.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/modelo_robot/modelo_robot/__init__.py b/modelo_robot/modelo_robot/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/modelo_robot/package.xml b/modelo_robot/package.xml new file mode 100644 index 0000000..4f93336 --- /dev/null +++ b/modelo_robot/package.xml @@ -0,0 +1,34 @@ + + + + modelo_robot + 0.0.0 + TODO: Package description + z3rn291 + TODO: License declaration + Apache License 2.0 + + rclpy + std_msgs + geometry_msgs + math + nav_msgs + + cv_bridge + cv_bridge + image_transport + image_transport + sensor_msgs + sensor_msgs + OpenCV + OpenCV + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/modelo_robot/resource/modelo_robot b/modelo_robot/resource/modelo_robot new file mode 100644 index 0000000..e69de29 diff --git a/modelo_robot/setup.cfg b/modelo_robot/setup.cfg new file mode 100644 index 0000000..18c4fdb --- /dev/null +++ b/modelo_robot/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script_dir=$base/lib/modelo_robot +[install] +install_scripts=$base/lib/modelo_robot diff --git a/modelo_robot/setup.py b/modelo_robot/setup.py new file mode 100644 index 0000000..ea2bf80 --- /dev/null +++ b/modelo_robot/setup.py @@ -0,0 +1,44 @@ +from setuptools import setup + +import os +from glob import glob +from setuptools import setup +from setuptools import find_packages + +package_name = 'modelo_robot' + +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']), + #COLOQUE NUEVO + #('share/' + package_name, package_files), + #('share/' + package_name + '/launch', package_files), + (os.path.join('share', package_name, 'launch'), glob('launch/*.py')), + #######nuevo_robot + (os.path.join('share', package_name, 'urdf'), glob('urdf/*')), + (os.path.join('share', package_name, 'meshes'), glob('meshes/*')), + (os.path.join('share', package_name, 'worlds'), glob('worlds/*')), + + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='z3rn291', + maintainer_email='u7003510@unimilitar.edu.co', + description='TODO: Package description', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + 'F = modelo_robot.Perras:main', + 'L = modelo_robot.P_reci:main', + + + + ], + }, +) diff --git a/modelo_robot/test/test_copyright.py b/modelo_robot/test/test_copyright.py new file mode 100644 index 0000000..97a3919 --- /dev/null +++ b/modelo_robot/test/test_copyright.py @@ -0,0 +1,25 @@ +# 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 + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/modelo_robot/test/test_flake8.py b/modelo_robot/test/test_flake8.py new file mode 100644 index 0000000..27ee107 --- /dev/null +++ b/modelo_robot/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/modelo_robot/test/test_pep257.py b/modelo_robot/test/test_pep257.py new file mode 100644 index 0000000..b234a38 --- /dev/null +++ b/modelo_robot/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/modelo_robot/urdf/Seguidor_linea_robot.urdf b/modelo_robot/urdf/Seguidor_linea_robot.urdf new file mode 100644 index 0000000..fa5660c --- /dev/null +++ b/modelo_robot/urdf/Seguidor_linea_robot.urdf @@ -0,0 +1,380 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 200 + 200 + 1000000 + 1 + Gazebo/Yellow + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 200 + 200 + 1000000 + 1 + Gazebo/Gray + + + + + + + + + + + + + + + + + + + + + + + + + + + + 200 + 200 + 1000000 + 1 + Gazebo/Gray + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.1 + 0.1 + 1000000 + 1 + Gazebo/Gray + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.1 + 0.1 + 1000000 + 1 + Gazebo/Gray + + + + + + + + + + + + + 100 + + + Rueda_izquierda_joint + Rueda_derecha_joint + + + 0.15 + 0.06 + + + 20 + 20.0 + + + cmd_vel + + + + true + + + + true + + + + true + + odom + odom_link + base_link + + 1 + + odom:=wheel/odometry + + + + + + + 100 + Base_castor_joint + Rueda_castor_joint + + + + diff --git a/modelo_robot/worlds/world.world b/modelo_robot/worlds/world.world new file mode 100644 index 0000000..d3d1d64 --- /dev/null +++ b/modelo_robot/worlds/world.world @@ -0,0 +1,1451 @@ + + + + 1 + 0 0 10 0 -0 0 + 0.8 0.8 0.8 1 + 0.2 0.2 0.2 1 + + 1000 + 0.9 + 0.01 + 0.001 + + -0.5 0.1 -0.9 + + 0 + 0 + 0 + + + + 1 + + + + + 0 0 1 + 100 100 + + + + + + 100 + 50 + + + + + + + + + + + 10 + + + 0 + + + 0 0 1 + 100 100 + + + + + + + 0 + 0 + 0 + + + 0 0 -9.8 + 6e-06 2.3e-05 -4.2e-05 + + + 0.001 + 1 + 1000 + + + 0.4 0.4 0.4 1 + 0.7 0.7 0.7 1 + 1 + + + + EARTH_WGS84 + 0 + 0 + 0 + 0 + + + + -2.02568 2.92333 0 0 -0 3.14159 + 0 + 0 + + 0 0 0.5 0 -0 0 + + + 1.8711 0.15 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + + + 0 + 10 + 0 0 0.5 0 -0 0 + + + 1.8711 0.15 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + + + -2.887 0.69235 0 0 0 -1.5708 + 0 + 0 + + 0 0 0.5 0 -0 0 + + + 4.62378 0.15 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + + + 0 + 10 + 0 0 0.5 0 -0 0 + + + 4.62378 0.15 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + + + -4.44208 0.738947 0 0 0 -1.5708 + 0 + 0 + + 0 0 0.5 0 -0 0 + + + 7.42809 0.15 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + + + 0 + 10 + 0 0 0.5 0 -0 0 + + + 7.42809 0.15 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + + + -0.409926 -1.55115 0 0 -0 3.14159 + 0 + 0 + + 0 0 0.5 0 -0 0 + + + 2.36648 0.15 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + + + 0 + 10 + 0 0 0.5 0 -0 0 + + + 2.36648 0.15 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + + + -1.53187 -0.513425 0 0 -0 1.5708 + 0 + 0 + + 0 0 0.5 0 -0 0 + + + 2.06622 0.15 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + + + 0 + 10 + 0 0 0.5 0 -0 0 + + + 2.06622 0.15 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + + + 0.837565 0.010614 0 0 -0 3.14159 + 0 + 0 + + 0 0 0.5 0 -0 0 + + + 1.32777 0.15 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + + + 0 + 10 + 0 0 0.5 0 -0 0 + + + 1.32777 0.15 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + + + -0.484506 1.39698 0 0 -0 2.02352 + 0 + 0 + + 0 0 0.5 0 -0 0 + + + 3.22686 0.15 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + + + 0 + 10 + 0 0 0.5 0 -0 0 + + + 3.22686 0.15 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + + + 1.8412 2.79579 0 0 0 -0.948986 + 0 + 0 + + 0 0 0.5 0 -0 0 + + + 3.76645 0.15 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + + + 0 + 10 + 0 0 0.5 0 -0 0 + + + 3.76645 0.15 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + + + -1.0172 -1.00075 0 0 0 -0.803995 + 0 + 0 + + 0 0 0.5 0 -0 0 + + + 1.5 0.15 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + + + 0 + 10 + 0 0 0.5 0 -0 0 + + + 1.5 0.15 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + + + -0.787021 -2.89307 0 0 -0 0 + 0 + 0 + + 0 0 0.5 0 -0 0 + + + 7.34986 0.15 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + + + 0 + 10 + 0 0 0.5 0 -0 0 + + + 7.34986 0.15 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + + + -0.718431 4.37517 0 0 -0 0 + 0 + 0 + + 0 0 0.5 0 -0 0 + + + 7.41907 0.15 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + + + 0 + 10 + 0 0 0.5 0 -0 0 + + + 7.41907 0.15 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + + + 2.90228 0.736783 0 0 -0 1.5708 + 0 + 0 + + 0 0 0.5 0 -0 0 + + + 7.42238 0.15 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + + + 0 + 10 + 0 0 0.5 0 -0 0 + + + 7.42238 0.15 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + + + 1 -1.44562 0.5 0 -0 0 + + 0 0 0 0 -0 0 + + + 0.5 + 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + + + 0 + 10 + 0 0 0 0 -0 0 + + + 0.5 + 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + 0 + 0 + + + 0.498835 4 0.5 0 -0 0 + + 0 0 0 0 -0 0 + + + 0.5 + 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + 1 + 0 + + + 0 + 10 + 0 0 0 0 -0 0 + + + 0.5 + 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + 0 + 0 + + + 0 1.56543 0.5 0 -0 0 + + 0 0 0 0 -0 0 + + + 0.5 + 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + 1 + 0 + + + 0 + 10 + 0 0 0 0 -0 0 + + + 0.5 + 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + 0 + 0 + + + 2.54621 1.57728 0.5 0 -0 0 + + 0 0 0 0 -0 0 + + + 0.5 + 1 + + + + + 1 0.764706 0.305882 1 + 0.7 0.7 0.7 1 + 0.01 0.01 0.01 1 + 0 0 0 1 + + + 1 + 0 + 1 + 0 + + + 0 + 10 + 0 0 0 0 -0 0 + + + 0.5 + 1 + + + + + + 1 + 1 + 0 0 0 + 0 + 0 + + + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + 0 + 0 + 0 + + 1 + 1 + 1.5128 -0.996395 0 0 -0 0 + + + 47 583000000 + 47 834219659 + 1655239593 684977528 + 47583 + + 0 0 0 0 -0 0 + 1 1 1 + + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + + 1.5128 -0.996395 0 0 -0 0 + 1 1 1 + + -0.51288 1.92694 0 0 -0 3.14159 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + -1.3742 -0.304045 0 0 0 -1.5708 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + -2.92928 -0.257448 0 0 0 -1.5708 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + 1.10287 -2.54754 0 0 -0 3.14159 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + -0.01907 -1.50982 0 0 -0 1.5708 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + 2.35037 -0.985781 0 0 -0 3.14159 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + 1.02829 0.400585 0 0 -0 2.02352 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + 3.354 1.7994 0 0 0 -0.948986 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + 0.4956 -1.99714 0 0 0 -0.803995 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + 0.725779 -3.88946 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + 0.794369 3.37878 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + 4.41508 -0.259612 0 0 -0 1.5708 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + 2.5128 -2.44202 0.5 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + 2.01164 3.0036 0.5 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + 1.5128 0.569035 0.5 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + 4.05901 0.580885 0.5 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + 0 0 0 0 -0 0 + + + + 0 0 10 0 -0 0 + + + + + 1.40816 -5.3716 3.64601 -0 0.547643 1.97219 + orbit + perspective + + + +