OSU-AIMS / light_painting

Demonstration project which traces a LED EEF through space for a long-exposure photo.
Apache License 2.0
0 stars 0 forks source link

Feature: RGB Led controlled via ROS #2

Closed acbuynak closed 2 years ago

acbuynak commented 2 years ago

RGB Led onboard an Arduino Uno is controllable via ROS. PR updates Arduino Sketchbook.

Major Updates

Tests

Launched control to Arduino using roslaunch light_painting t2_led_paintbrush.launch. Used RQT's Message Publisher to publish test messages and confirmed LED updated to match RGB setting.

image

Design Notes:

Verified Arduino had sufficient buffer size on Arduino Uno. Message is 3xUINT8 values (ie. 3 bytes). Current program size leaves ~600 bytes of memory available for variables. This is sufficient.

Program Control Flow:

flowchart_RGB_ROS_control

Remaining Work

acbuynak commented 2 years ago

Next Steps

Setup

1 - Init ROS Node
2 - Setup Publisher to topic /paintbrush_color using custom message type: light_painting/RGBState.msg

Main

3 - Read pixel value < r, g, b >
4 - Instantiate and build a new RGBState message
5 - Set values of message. Must be UINT8 values (0-255)

Pseudo Code

This might look something like this pseudo-ish code. This is just some relevant chunks, does not include everything needed for a ROS node w/ publisher. This will not run.

import rospy
from light_painting.msg import RGBState

pub = rospy.Publisher('paintbrush_color ', RGBState, queue_size=5)

msg = RGBState()
msg.red = 187
msg.green = 0
msg.blue = 0

pub.publish(msg)
acbuynak commented 2 years ago

@MohammadKhan-3 Left a review of code. See comments in the review. Once changes made, I think this is ready to merge. Let's do a regular Merge Pull Request on this one to maintain the commit history.

MohammadKhan-3 commented 2 years ago

Built the rosserial_arduino library

I ran rosrun rosserial_arduino serial_node.py -port=/tty/ACM0 -baud=500000 but still getting this error:

[ERROR] [1649688048.164270]: Error opening serial: [Errno 2] could not open port -port=/tty/ACM0: [Errno 2] No such file or directory: '-port=/tty/ACM0'

To create the Binary publisher:

acbuynak commented 2 years ago

Rolled back three commits to have this PR only include RGB. Moving Greyscale feature onto a new branch following this PR.