Welcome Guest! To enable all features please Login or Register.
Options
Go to last post Go to first unread
SomeAssembly  
#1 Posted : Friday, April 03, 2015 6:18:10 AM(UTC)
SomeAssembly

Rank: Advanced Member

Groups: BetaUser, Registered
Joined: 3/31/2015(UTC)
Posts: 47

Hi,

I am testing and trying to replicate other arduino program I have written. I ran into a problem when I wanted to get a value of the input as a positive value from a range of -1 to 1. The intent is to get an absolute distance from 0.



if(Input_Activation >= 0)
{
Output_Activation = Input_Activation * 1;
}
else
{
Output_Activation = Input_Activation * -1;
}


When this is put into a custom node, I can only get output value when the input is positive but not when negative.
EmbrioAdmin  
#2 Posted : Friday, April 03, 2015 6:22:02 AM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 36 time(s) in 33 post(s)
On the numeric output on the node, make sure that the little button that looks like a minus sign is highlighted. Numeric ranges are by default only from 0 to 1, as they represent "activations". To open up the range to the full -1 to 1 you need to click the (-) button, otherwise the value is clamped.

Edit: Actually after reading again it looks like the - sign on the numeric input is the one that needs to be clicked.

Edited by user Friday, April 03, 2015 6:23:35 AM(UTC)  | Reason: Not specified

EmbrioAdmin  
#3 Posted : Friday, April 03, 2015 6:27:31 AM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 36 time(s) in 33 post(s)
Could you copy the node and paste the XML into a reply so I can see exactly what you are doing? Seems like there might be a better way.
SomeAssembly  
#4 Posted : Friday, April 03, 2015 7:46:19 AM(UTC)
SomeAssembly

Rank: Advanced Member

Groups: BetaUser, Registered
Joined: 3/31/2015(UTC)
Posts: 47

I was looking to get a positive value representing the distance from 0 in both directions.

here is the node:

<Nodes>
<Node>
<UniqueID>6befc25b-7279-4222-8d92-8bd9cae5c8f6</UniqueID>
<AssemblyType>Embrio.NodeEngine.AgentController.Nodes.AgentControllerCustomArduinoNode</AssemblyType>
<NodeType>Custom Arduino Node</NodeType>
<UserDefinedName></UserDefinedName>
<Description>A node that lets you write any Arduino code to interact with the Arduino hardware. Can be both an input and output.</Description>
<NodeColor>201,204,227,255</NodeColor>
<X>0</X>
<Y>0</Y>
<Width>530</Width>
<IncludeCode></IncludeCode>
<DeclerationCode></DeclerationCode>
<SetupCode></SetupCode>
<ImageName>arduino.png</ImageName>
<InfoURL></InfoURL>
<CodeDefinitions>
<CodeDefinition>
<UpdateCondition>EveryUpdate</UpdateCondition>
<Code>if(Input_Activation &amp;lt; 0){
Output_Activation = Input_Activation *-1;}
else {
Output_Activation = Input_Activation;}
</Code>
<UniqueID>b3589bc0-82c8-4296-af2c-90717f8b01fe</UniqueID>
</CodeDefinition>
</CodeDefinitions>
<Inputs>
<Input>
<UniqueID>094d2229-9473-4a02-a106-9cc9f12d6211</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Activation</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>True</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>True</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
<BlendMode>Add</BlendMode>
<DisconnectedValue>-0.8044</DisconnectedValue>
<UseNegativeRange>True</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Input>
</Inputs>
<Outputs>
<Output>
<UniqueID>a8c91152-3d04-48bb-8d80-81832c179c8f</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Activation</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>True</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>True</IsUserAdded>
<MinValue>0</MinValue>
<MaxValue>1</MaxValue>
<UseNegativeRange>False</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Output>
</Outputs>
</Node>
</Nodes>


Hope you can help, a different option would work as well.

Thanks
EmbrioAdmin  
#5 Posted : Friday, April 03, 2015 9:32:05 AM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 36 time(s) in 33 post(s)
You were doing it right, there was a bug. I fixed it and will upload a new installer hopefully tonight. Keep in mind that Custom Arduino Nodes only execute on an Arduino, so for it to update in the UI you'll need to have an active connection.

An alternative way to do it is with this node group:


It isolates the positive part with the top blend node, and also isolates the flipped value of the negative (notice the output on the bottom doesn't use the full range while the input does), then adds those two parts together.

There should be a built in node for the absolute value. It's actually pretty easy to make your own node, but that feature is currently only available with the licensed version. I'm still trying to decide if that's the best way to do that, maybe compiling a final program is enough of a feature to hold back without a license, people keep complaining about "crippleware". Here's the current documentation for that feature: http://embrio.io/documentation/node-definitions/ There's still some work that needs to be done on it, but it works pretty well for now, most of the nodes in the software are created this way.

I'm building up features for users to share custom nodes and groups of nodes, so things that aren't built in can be added pretty easily. Stay tuned!

Edited by user Friday, April 03, 2015 9:33:06 AM(UTC)  | Reason: Not specified

SomeAssembly  
#6 Posted : Friday, April 03, 2015 10:37:04 AM(UTC)
SomeAssembly

Rank: Advanced Member

Groups: BetaUser, Registered
Joined: 3/31/2015(UTC)
Posts: 47

Thanks for fixing that,

I am still on the fence about paying (that's a lot for me). I code by hand but thought this might be a simpler way to program the Arduino. I am still having trouble with the limited control options, 0,1 & 0 to 1. .Your system is more of a binary style while I am used to analog style, so it is taking me a while to grasp the structure and the steps required. Functions that I used to complete in one or two steps now require many more. But I see this as a great way to quickly prototype some ideas. Keep up the great work.
EmbrioAdmin  
#7 Posted : Friday, April 03, 2015 10:57:03 AM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 36 time(s) in 33 post(s)
The new version is posted.

While I think it is easier for a lot of things than traditional coding, that's not the main focus. The main issue being solved by Embrio is the problem of many things happening at once that is fairly unique to embedded and embodied software. The "agent based" approach is what I believe sets it apart from other visual languages. The architecture is loosely inspired by the brain, where neurons are connected to other neurons and can either activate or suppress others. That's what's happening in Embrio. You have a bunch of agents running together, and a lot of what they do is either turn on or off other agents. The robot car tutorial is the best example so far of how it's intended to be used: http://embrio.io/projects/advanced-tutorials/advanced-projects/autonomous-car

It takes some getting used to, especially the concept of "programming with agents". I agree that while some things are easier this way, some are harder. Hopefully over the coming months the pre-built libraries will be built up quite a bit, and I'll be able to address a lot of the pain points and get something really powerful and useful.
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Notification

Icon
Error