Hi everyone! I've begun writing a crude AI for my robot now. My robot scans the room with sonar and an Arduino sends the data back up to a computer on the robot and it slowly builds a map of the room. The sonar window starts as a blank white screen, and when it receives a distance measurement from a sonar, it draws an arc filled green with a red stroke. Below is my AI so far, but I'm running it only in a "simulated" environment until I get it more complete. Left clicking in the sonar window will draw a large green ellipse, and right clicking will draw a small red ellipse. My problem: The scanner isn't finding the green pixels, but if I set the background to solid green (background(0, 255, 0);), the scanner works. My thoughts are somehow the green ellipse is drawing green on another layer, and the scanner is still only scanning the white background, for those of you who might have worked a little with Photoshop. Do I need to be using PImage? The scanner will eventually be looking for green areas for the robot to safely move to, while staying at least 6 to 12 inches away from any red area. It will do this by giving each pixel (1 pixel = 1 square inch in real world) a rank or grade from 0 to 255 based on if the robot can move there or not. After it makes it's full scan, it will tell the robot to move to the pixel with the highest rank. I've been working on this robot for a little over a year now and has been lots of fun. I'm open to any tips too! Appreciate any answer someone can give as to why the scanner isn't finding the green pixels when I draw them.
Hello folks, I have a fairly simple problem here. I have a robot project and I'll simplify a bit but basically the communication syntax between robot and computer looks a bit like this "<0.1234JX>". I realize now that its not the best way but it worked well when the robot was in its infant stages, and rather than rewrite every location where they communicate, i really just need to pull out the 0.1234 from that string. the < and > will always be at the beginning and end. Im looking at numbers in about the range of 1000 down to 0.0001, and including negatives. The Arduino on the robot can parse this out easily with the atof(str) function, but i can't seem to find a processing equivalent. I dont want to use a for() loop for parsing, if I can avoid it. I have tried using Float.parseFloat(trim(clientindata)); and similar, but I get either a NaN or a communication error. Any ideas? Greatly appreciated!
I trying to get Processing to send serial commands to a USB 16 port servo controller. The model number of this controller is the ZX_SERVO16U. I'm following the syntax for the serial commands as close as I can but the unit isn't responding. I have the port configured at 2400 baud in the device properties too. I realize that the highbyte and lowbyte are actually commands in arduino that pull the first or last 8 bits of a 16 bit word, but I couldn't find a Processing equivalent. When I turn it on, the servo's center, so don't think it's a hardware issue. The pdf that came with the servo controller is
here. Its written in PBASIC I think, and I'm having difficulties translating it. I have tried a serial port terminal program to send the code, but I'm pretty sure my formatting is wrong. If anyone has some sample code to a similar servo controller that would really help too. Any help is really appreciated! Thanks!
Hi everyone! I'm working on a robot project, and I'm having trouble with the processing code running on the computer on the robot. It communicates with the micro-controller through com4, a gps on com5, and with a client program running on my laptop through a VPN port. I'm trying to add a window that reads the camera and does some basic red color object detection. The code in the PApplet was originally a separate program, and was working fine, I am trying to migrate it into the main program running on the robot. Run it and see where it error's out. It seems it's confused about which window to read pixels from. You only need a USB (or built in) camera hooked up to run this (and work eventually hopefully). Can someone explain how to choose which window to read the pixel from? Also, I intend on adding a 3rd window displaying a grey scale of ratings of where the robot plans to move, and a 4th window which will be the main control window (pulling the text info out of the sonar window). If it helps I can post the working object detection code separately. Much appreciated!
import processing.serial.*; //serial port read library
import processing.net.*;
UIWindow uiWindow;
Server myServer;
int serverport = 1234;//port used to communicate with clients over Hamachi