Skip to content

gaultierlecaillon/edog_eurobot2023_ros2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Edog Eurobot 2023 ROS2 packages

A collection of ROS2 packages to control the robot Edog 2023

Getting Started

ROS2 Cheat Sheet

Create a python package

ros2 pkg create hardware_package --build-type ament_python --dependencies rclpy

Build a specific package

colcon build --packages-select hardware_package

Build a specific package with symlink

colcon build --packages-select hardware_package --symlink-install

Create a Node

Node are created in ~/ros2_ws/src/hardware_package/hardware_package/ folder

touche reset1_node

Python Node exemple with switch logic input:

import rclpy
from rclpy.node import Node
import RPi.GPIO as GPIO
import time
import board


class Reset1Node(Node):

    def __init__(self):
        super().__init__("reset1_node")

        # Pi setup
        self.tiretteGPIO = 14
        GPIO.setmode(GPIO.BCM)
        GPIO.setup(self.tiretteGPIO, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

        # ros2 setup
        self.get_logger().info("Node reset1_node starting")
        self.create_timer(0.25, self.timer_callback)

    def timer_callback(self):
        reset1_state = not GPIO.input(self.tiretteGPIO)
        self.get_logger().info("Reset1:" + str(reset1_state))


def main(args=None):
    rclpy.init(args=args)
    node = Reset1Node()
    rclpy.spin(node)
    rclpy.shutdown()


if __name__ == "__main__":
    main()

About

ROS2 packages for the Edog team robot (Eurobot 2023)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published