How to use import serial in Ros Foxy
Hello. I wanted to ask. Is it possible to use serial port for ros foxy for publishing data?
Thank you
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
Hello. I wanted to ask. Is it possible to use serial port for ros foxy for publishing data?
Thank you
You could try micro-ROS, but I am not sure if it fits your use case - could you describe it?
import RPi.GPIO as GPIO import time import serial
GPIO.setmode(GPIO.BCM)
redLED = 13 GPIO.setup(redLED, GPIO.OUT) GPIO.output(redLED,False)
ser = serial.Serial('/dev/ttyUSB0',115200,timeout=None)
while True: GPIO.output(redLED, False) line1 = ser.readline() line2 = ser.readline() line3 = ser.readline() line4 = ser.readline() ch1 = line1.strip().decode('utf-8') ch2 = line2.strip().decode('utf-8') ch3 = line3.strip().decode('utf-8') ch4 = line4.strip().decode('utf-8') print(ch1,ch2,ch3,ch4) GPIO.output(redLED, True) time.sleep(1) ser.close()
i wanted to publish the ser.readline data.
Then this demo https://micro.ros.org/blog/2019/06/03... or this tutorial https://ubuntu.com/blog/getting-start... suit you very well :) With Raspberry Pi and some LEDs
Asked: 2021-12-21 04:18:39 -0500
Seen: 305 times
Last updated: Dec 21 '21
Cannot Install Any More Foxy or Ubuntu Packages
How do you kill the "zombie" node in ROS2 on local?
[ROS2] rviz2 and rqt do not shown published image
Rviz2 doesn't show point cloud because of wrong tf
ROS2 python logging conditionals
[ROS2]How to write data to rosbag2 in ros2 foxy
rosdep install error: Unable to locate package python3-catkin-pkg-modules