If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Ruby Help Needed Please
9 posts
• Page 1 of 1
Ruby Help Needed Please
Hi,
I am trying to make an XY scope that has RGB color capability - think a color version of Asteroids (and yes I have seen a Flowstone Asteroids clown and it is quite nice).
My needs are slightly different. I need to make each line from sample to sample be colored instead of the entire array (graphic object in this case) be one color. For example imagine a circle that starts red at 12noon and changes color thru orange, yellow, green, blue. purple, etc. till the circle reached 12midnight.
In my FSM if the circle frequency (formed by two sin oscillators 90 degrees out of phase) is the same as the color signals the color would vary around the circle with a 1 to 1 correspondents, faster color "modulation" would cause the circle to have more color cycles, lower frequency less color cycles.
I can get the entire image / circle to change, but not change color as it draws out the circle. The far right XY Scope (in the FSM) works, it is made from other FSMs, but only colors the entire circle / image once per sample period (say 512 samples). The other XY Scope (written in RUBY) produces an image but no color variations at all, only random black and white frames.
Note that the Scope must have Streaming data for all of the XY and RGB inputs - the way a real o-scope works.
Thanks for any help you can give... I have bitten my nails off trying to solve this - with no luck, and short nails as the only result!
Aron
I am trying to make an XY scope that has RGB color capability - think a color version of Asteroids (and yes I have seen a Flowstone Asteroids clown and it is quite nice).
My needs are slightly different. I need to make each line from sample to sample be colored instead of the entire array (graphic object in this case) be one color. For example imagine a circle that starts red at 12noon and changes color thru orange, yellow, green, blue. purple, etc. till the circle reached 12midnight.
In my FSM if the circle frequency (formed by two sin oscillators 90 degrees out of phase) is the same as the color signals the color would vary around the circle with a 1 to 1 correspondents, faster color "modulation" would cause the circle to have more color cycles, lower frequency less color cycles.
I can get the entire image / circle to change, but not change color as it draws out the circle. The far right XY Scope (in the FSM) works, it is made from other FSMs, but only colors the entire circle / image once per sample period (say 512 samples). The other XY Scope (written in RUBY) produces an image but no color variations at all, only random black and white frames.
Note that the Scope must have Streaming data for all of the XY and RGB inputs - the way a real o-scope works.
Thanks for any help you can give... I have bitten my nails off trying to solve this - with no luck, and short nails as the only result!
Aron
- Attachments
-
- XY_Scope_13.fsm
- XY RGB Scope / Display
- (105.67 KiB) Downloaded 763 times
-
aronb - Posts: 154
- Joined: Sun Apr 17, 2011 3:08 am
- Location: Florida, USA
Re: Ruby Help Needed Please
you did things right, but you used R_data for d,e,f so r,g,b get the same values just from the red channel, thats why its just white, any way you dont need this extra variables you can do
to avoid confusions like this..
- Code: Select all
cr = @R_data[i]
- Code: Select all
cr = d[i]
to avoid confusions like this..
- Attachments
-
- XY_Scope_13 (1).fsm
- (269.31 KiB) Downloaded 764 times
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: Ruby Help Needed Please
Nice call !
That's what I get for programming too late! But then again that is when most programming gets done!!!
So its getting closer, but now I think I am running into sampling issues and it interacts (I believe) with another want and desire in the "XY RGB Scope Module".
In a Real Oscilloscope, the phosphor screen display dies down over time say a 1/4 second or so as the image gets displayed - or the line draws across the screen.
In the included FSM, the color still is not changing during the time the XY data is streaming in, but it looks as though the color only changes every whole sample period... But the color is actually changing at every point along the XY coordinates that are being streamed into the XY RGB Scope. I wonder if is a limitation of the Color or Pen Class(?). For instance, if you move the XY Pad around a bit as the image is being displayed, it is drawn in one whole color instead of the image being made of a mix of colors as the pixels are drawing the VCA circle pattern (image).
NOTE: Make sure to hit the Trigger (upper right) to reset the oscillator phase and system timing.
Do you have any thoughts on this? You are a much better programmer than me so again your help and comments are greatly appreciated - Thanks
My next steps may be to read the data (sample) in as small an increment as I can, then pass the values to another array, then another array, then another array, all with decreasing Alpha values to simulate the phosphor decay...
Getting late again, so I will do a few more tries...
Thanks again for the help - wish I could buy you a beer!!!
That's what I get for programming too late! But then again that is when most programming gets done!!!
So its getting closer, but now I think I am running into sampling issues and it interacts (I believe) with another want and desire in the "XY RGB Scope Module".
In a Real Oscilloscope, the phosphor screen display dies down over time say a 1/4 second or so as the image gets displayed - or the line draws across the screen.
In the included FSM, the color still is not changing during the time the XY data is streaming in, but it looks as though the color only changes every whole sample period... But the color is actually changing at every point along the XY coordinates that are being streamed into the XY RGB Scope. I wonder if is a limitation of the Color or Pen Class(?). For instance, if you move the XY Pad around a bit as the image is being displayed, it is drawn in one whole color instead of the image being made of a mix of colors as the pixels are drawing the VCA circle pattern (image).
NOTE: Make sure to hit the Trigger (upper right) to reset the oscillator phase and system timing.
Do you have any thoughts on this? You are a much better programmer than me so again your help and comments are greatly appreciated - Thanks
My next steps may be to read the data (sample) in as small an increment as I can, then pass the values to another array, then another array, then another array, all with decreasing Alpha values to simulate the phosphor decay...
Getting late again, so I will do a few more tries...
Thanks again for the help - wish I could buy you a beer!!!
- Attachments
-
- XY_Scope_20.fsm
- (145.89 KiB) Downloaded 768 times
-
aronb - Posts: 154
- Joined: Sun Apr 17, 2011 3:08 am
- Location: Florida, USA
Re: Ruby Help Needed Please
hmmm .... the mention of 'phosphor decay' ...
In TROG's toolbox v3.1, he had modules that dealt with [maybe] something similar.
From his 'notes' section on this, he states:
I'm not sure this would be useful to your project or ideas, but it might be worth a look [if anything, for all the other great stuff he included in this toolbox.
Also ... been wondering why we've not seen a TROG post Certainly hope that all is well for him. Has anyone been in contact with him ??
In TROG's toolbox v3.1, he had modules that dealt with [maybe] something similar.
From his 'notes' section on this, he states:
Phosphors
Similar to view cache, but current and previous frames are overlaid so that "ghost images" slowly fade away. "Persistence" sets the rate of fading.
Some examples inside the module to the right.
I'm not sure this would be useful to your project or ideas, but it might be worth a look [if anything, for all the other great stuff he included in this toolbox.
Also ... been wondering why we've not seen a TROG post Certainly hope that all is well for him. Has anyone been in contact with him ??
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
Re: Ruby Help Needed Please
aronb wrote:
In the included FSM, the color still is not changing during the time the XY data is streaming in, but it looks as though the color only changes every whole sample period...
yes because it updates all 512 smples...
so you would need to draw each line from p1 with a different color which means with a new pen
so my idea for this would be to make a color array and iterate through p1 and just draw one line on each index with its own pen (color)
would look something like this:
- Code: Select all
0.step(a.length-1,1) do |i|
p1[i] = [((a[i]-@minX)/(@maxX-@minX))*wx,wy-((b[i]-@minY)/(@maxY-@minY))*wy]
cols[i] = Color.new(255,@R_data[i],@G_data[i],@B_data[i])
end
# Draw the vector coordinates in color!
p1.each_index do |id|
pen = Pen.new cols[id],0.3
v.drawLine pen,p1[id],p1[id+1]
end
- Attachments
-
- XY_Scope_20.fsm
- (462.61 KiB) Downloaded 770 times
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: Ruby Help Needed Please
Wow - Thanks for the help!!! Drinks all around on me !
It is getting very very close now.
Here it the XY RGB Scope with an RGB Color palette I did in Excel and then imported as a text file... Trying to figure out if the color blend discontinuity is an artifact of the color palette or sampling error.
Either way I am getting very close to a finished module - Thanks again for the support, I could not have done this without your help - FLOWSTONE ROCKS !!!!! Need to implement Alpha Blend now...
Now about Trog's Toolkit - Looked around and did not find it - where do I get this from - or where do I look please.
Here is the latest FSM for your enjoyment!
It is getting very very close now.
Here it the XY RGB Scope with an RGB Color palette I did in Excel and then imported as a text file... Trying to figure out if the color blend discontinuity is an artifact of the color palette or sampling error.
Either way I am getting very close to a finished module - Thanks again for the support, I could not have done this without your help - FLOWSTONE ROCKS !!!!! Need to implement Alpha Blend now...
Now about Trog's Toolkit - Looked around and did not find it - where do I get this from - or where do I look please.
Here is the latest FSM for your enjoyment!
- Attachments
-
- XY_Scope_20(1).fsm
- (159.24 KiB) Downloaded 778 times
-
aronb - Posts: 154
- Joined: Sun Apr 17, 2011 3:08 am
- Location: Florida, USA
Re: Ruby Help Needed Please
Now about Trog's Toolkit - Looked around and did not find it - where do I get this from - or where do I look please.
I think it was originally posted on the SM forum. There was also a forum started by a member that had this posted ... just don't remember the link.
I wish TROG would post back to let us know he's OK.
I hesitate to post someone else's work without a clear consent to do so. Maybe one of the senior members here knows the protocol better than I.
Just out of respect .
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
Re: Ruby Help Needed Please
I believe I saw and now have the Phosphor FSM. It deals with a view and bitmap type images.
I need to study it a bit to see if I can implement it in the XY RGB Module in Ruby... Wish I was a better Ruby programmer , but like everything else "I am working on getting better"
Thanks for the help,
AB
I need to study it a bit to see if I can implement it in the XY RGB Module in Ruby... Wish I was a better Ruby programmer , but like everything else "I am working on getting better"
Thanks for the help,
AB
-
aronb - Posts: 154
- Joined: Sun Apr 17, 2011 3:08 am
- Location: Florida, USA
Re: Ruby Help Needed Please
Hi,
It looks like Trog's Phosphor is done using a type of circular buffer - still trying to figure it out completely
And because of its use of the "toolbox pen module" I will not be able to control the Pen setting at each data point/line so the Ruby Code version still seems the best way... I really wish I could simulate or program Trog's method using the toolbox modules in Ruby
Still working at it though !
It looks like Trog's Phosphor is done using a type of circular buffer - still trying to figure it out completely
And because of its use of the "toolbox pen module" I will not be able to control the Pen setting at each data point/line so the Ruby Code version still seems the best way... I really wish I could simulate or program Trog's method using the toolbox modules in Ruby
Still working at it though !
-
aronb - Posts: 154
- Joined: Sun Apr 17, 2011 3:08 am
- Location: Florida, USA
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 77 guests