Previous Thread
Next Thread
Print Thread
Page 2 of 3 1 2 3
Joined: Feb 2014
Posts: 1,020
Likes: 110
G
Very Senior Member
OP Online Content
Very Senior Member
G
Joined: Feb 2014
Posts: 1,020
Likes: 110
There was also a Russian clone of the Big Trak, the Elektronika IM-11.

It's kind of cool because it has additional lights on the front and back to show the motor activations, and the OUT command will make a flying disc pop up.


Joined: May 2004
Posts: 1,765
Likes: 32
H
Very Senior Member
Offline
Very Senior Member
H
Joined: May 2004
Posts: 1,765
Likes: 32
there's hope for that Bomb Disposal Robot yet wink

Joined: Oct 2020
Posts: 28
Likes: 4
Member
Offline
Member
Joined: Oct 2020
Posts: 28
Likes: 4
I welcome our robot overlords

Joined: Feb 2014
Posts: 1,020
Likes: 110
G
Very Senior Member
OP Online Content
Very Senior Member
G
Joined: Feb 2014
Posts: 1,020
Likes: 110
I noticed that there was a driver for the Incredible Brain Buggy aka bcheetah, so why not make a keypad for that as well:





[Linked Image from i.imgur.com]

What's kind of interesting is that the drive motor starts up for a moment then shuts off before it does a command. In programming mode, you press buttons simultaneously, like fwd + 2 to go forward for 1 second, left + 4 for left turn for 2 seconds.

Switching to run mode makes the forward, left and right buttons immediate.

Joined: Feb 2014
Posts: 1,020
Likes: 110
G
Very Senior Member
OP Online Content
Very Senior Member
G
Joined: Feb 2014
Posts: 1,020
Likes: 110
Found a nice picture of the cheetah control pad at http://www.computercars.de/car/bandai_cheetah

[Linked Image from i.imgur.com]

[Linked Image from i.imgur.com]

Joined: Feb 2014
Posts: 1,020
Likes: 110
G
Very Senior Member
OP Online Content
Very Senior Member
G
Joined: Feb 2014
Posts: 1,020
Likes: 110
hap simplified the keypad taking the file size from 9911 to 5915 bytes:

[Linked Image from i.imgur.com]

Joined: Feb 2014
Posts: 1,020
Likes: 110
G
Very Senior Member
OP Online Content
Very Senior Member
G
Joined: Feb 2014
Posts: 1,020
Likes: 110
One way to generate rotation is to use the <g> tag in an <svg> and use the transform="rotate(deg centerx centery)".

It doesn't take a lot of lua code to generate the different images for each rotation:

Code
function tagbegin(b,t,t1) return "<"..b.." "..t.."=\""..t1.."\">" end
function tagend(b) return "</"..b..">" end

template = [===[
<image state="~state~"><data><![CDATA[
<svg viewBox="-54 -41.5 158 158" xmlns="http://www.w3.org/2000/svg">
<g transform="rotate(~rot~)" fill="white" >
<polygon points="0,0 70,0 100,20 100,55 70,75 0,75" />
</g>
</svg>
]]></data></image>
]===]

dirs=32
out = tagbegin("element","name","bigtrak") 
for state=0,dirs-1 do 
    out = out..template:gsub("~state~",string.format(state,"%d")):gsub("~rot~",string.format(360/dirs*state,"%d").." 25 37.5") 
end 
out = out..tagend("element")
print(#out)
print(out)


so this will make 32 different directional images for 360 degrees, and the output will look like:

<element name="bigtrak"><image state="0"><data><![CDATA[
<svg viewBox="-54 -41.5 158 158" xmlns="http://www.w3.org/2000/svg">
<g transform="rotate(0.0 25 37.5)" fill="white" >
<polygon points="0,0 70,0 100,20 100,55 70,75 0,75" />
</g>
</svg>
]]></data></image>
<image state="1"><data><![CDATA[
<svg viewBox="-54 -41.5 158 158" xmlns="http://www.w3.org/2000/svg">
<g transform="rotate(11.25 25 37.5)" fill="white" >
<polygon points="0,0 70,0 100,20 100,55 70,75 0,75" />
</g>
</svg>
]]></data></image>
...


[Linked Image from i.imgur.com]

Joined: Feb 2014
Posts: 1,020
Likes: 110
G
Very Senior Member
OP Online Content
Very Senior Member
G
Joined: Feb 2014
Posts: 1,020
Likes: 110
32 directions just isn't enough for smooth rotational motion. I went back to 360 directions, and experimenting with some values for speed and turnrate makes it turn.


Joined: Feb 2014
Posts: 1,020
Likes: 110
G
Very Senior Member
OP Online Content
Very Senior Member
G
Joined: Feb 2014
Posts: 1,020
Likes: 110
So I thought it'd be interesting to be able to do a repeat inside of an element tag so you could do something like the following, and it took me quite a while to figure out how that all worked:

The way it's structured is that you can do a repeat outside of an element tag, but not a repeat inside of an element. Inside of an element, it only expects to see layout components like image, rect, text, etc.

Since the processing for the element happens inside the constructor layout_element::layout_element, I made another routine to handle the repeat so when it sees this repeat tag it calls this repeat routine and handles the components inside (mainly just a copy of the regular constructor code, but processing the param tags).

Then I just use the environment expand routine on the get_data of the svg, and it will do the parameter expansion.

The hardest part was getting it to work was in the little details, since set_repeat_parameter takes a boolean and effectively doesn't do anything if that boolean is false. So on the first pass of the repeat this boolean should be true and then false for the succeeding passes since the increment routine does all the updating.


Code
<element name="bigtrak">
<repeat count="360">
<param name="angle" start="0" increment="1"/>
<param name="rotang" start="0.0" increment="1"/>
<image state="~angle~"><data><![CDATA[
<svg viewBox="-54 -41.5 158 158" xmlns="http://www.w3.org/2000/svg">
<g transform="rotate(~rotang~ 25 37.5)" fill="white" >
<polygon points="0,0 70,0 100,20 100,55 70,75 0,75" />
</g>
</svg>
]]></data></image>
</repeat>
</element>




Now to experiment and see if I can make my idea of a parameter list work.

Joined: Feb 2014
Posts: 1,020
Likes: 110
G
Very Senior Member
OP Online Content
Very Senior Member
G
Joined: Feb 2014
Posts: 1,020
Likes: 110
So if I use commas as a delimiter and break them into pieces, then I can increment a counter to get the next piece every time it gets accessed.

So my original concept was to just be able to do a replacement of a single variable, but that didn't work as expected.

Due to the pattern of constructor order, the linear order of ~a~ in the file gets jumbled. So inputmask will get processed before inputtag and they get out of order.

So this won't work.

Code
<param name="a" value="keyproref,IN.0,0x2,6,0,12,8,keygoref,IN.1,0x8,30,0,8,8,keyleftref,IN.1,0x1,0,10,8,8,keyfwdref,IN.1,0x2,10,10,8,8,
keyrightref,IN.1,0x4,20,10,8,8,keystopref,IN.2,0x8,30,10,8,8,key1ref,IN.3,0x2,0,20,8,8,key2ref,IN.3,0x8,10,20,8,8,
key3ref,IN.4,0x2,20,20,8,8,key4ref,IN.4,0x8,30,20,8,8" />
<repeat count="10">
	<element ref="~a~" inputtag="~a~" inputmask="~a~">
		<bounds x="~a~" y="~a~" width="~a~" height="~a~" />
	</element>
  </repeat>

So the solution is to use different parameter variables which will only get accessed once per pass of the repeat:

It's probably better in that the value string gets quite long otherwise.

Code

<param name="aref" value="keyproref,keygoref,keyleftref,keyfwdref,keyrightref,keystopref,key1ref,key2ref,key3ref,key4ref"/>
<param name="atag" value="IN.0,IN.1,IN.1,IN.1,IN.1,IN.2,IN.3,IN.3,IN.4,IN.4"/>
<param name="amask" value="0x2,0x8,0x1,0x2,0x4,0x8,0x2,0x8,0x2,0x8"/>
<param name="ax" value="6,30,0,10,20,30,0,10,20,30"/>
<param name="ay" value="0,0,10,10,10,10,20,20,20,20"/>
<param name="awidth" value="12,8,8,8,8,8,8,8,8,8"/>
<param name="aheight" value="8"/>

<repeat count="10">
<element ref="~aname~" inputtag="~atag~" inputmask="~amask~">
	<bounds x="~ax~" y="~ay~" width="~awidth~" height="~aheight~" />
</element>
 </repeat>


Page 2 of 3 1 2 3

Link Copied to Clipboard
Who's Online Now
2 members (AJR, Olivier Galibert), 86 guests, and 1 robot.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,261
Posts121,259
Members5,064
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com