RadBot.... Creation, Programming and Challenges
"RadBot" is my new self-designed pet robot which we could learn to program, equip with sensors, and use to perform various challenges.
I already own one, but I'm now giving you the opportunity to build your own. I will provide you with the "kit" parts ansd building instructions.
Here's a preview pic of the disassembled parts. All parts are 3DRad rigidbodies which will be fitted together using joints... just as in the "real" world! The 3DRad Editor will be the assembly tool.
I already own one, but I'm now giving you the opportunity to build your own. I will provide you with the "kit" parts ansd building instructions.
Here's a preview pic of the disassembled parts. All parts are 3DRad rigidbodies which will be fitted together using joints... just as in the "real" world! The 3DRad Editor will be the assembly tool.
Unassembled Parts

Assembled Parts

Some preliminary notes:
1) From research and my own experiences with PhysX I've found that if you are to be using small real size objects (such as tabletop robots) then their size should be scaled up, such that their smallest RigidBody part is 1m in size. Thus, you will find that RadBot is greatly scaled up (just drop in Andro and you will see what I mean) so as to keep collision discrepancies to a minimum. If we kept everything to normal real world scale then we would encounter a number of collision discrepancies involving RadBot's smaller parts.
2) It is important to get the Rigidbody masses correct in relation to the volume of the RigidBody. We will assume that all RadBot's parts have the same density as water (1000 kg/m3) and using the formula:
Mass(kg) = Volume(m3) * Density(kg/m3)
we can calculate the mass of each RigidBody, since from its size measurements we can obtain an approx. volume.
For example, lets take RadBot's base plate which I've called Bottom:
Bottom is an approx cylinder with radius = 4m and height = 0.2m
The Volume of a cylinder is given by:
PI * radius * radius * height = PI * 4 * 4 * 0.2
= 10m3 (approx)
And assuming a Density of 1000kg/m3:
Mass = 10 * 1000
= 10000 kg
Thus, if you open the Property Sheet for the RigidBody object Bottom you'll see the mass as 10000 kg
1) From research and my own experiences with PhysX I've found that if you are to be using small real size objects (such as tabletop robots) then their size should be scaled up, such that their smallest RigidBody part is 1m in size. Thus, you will find that RadBot is greatly scaled up (just drop in Andro and you will see what I mean) so as to keep collision discrepancies to a minimum. If we kept everything to normal real world scale then we would encounter a number of collision discrepancies involving RadBot's smaller parts.
2) It is important to get the Rigidbody masses correct in relation to the volume of the RigidBody. We will assume that all RadBot's parts have the same density as water (1000 kg/m3) and using the formula:
Mass(kg) = Volume(m3) * Density(kg/m3)
we can calculate the mass of each RigidBody, since from its size measurements we can obtain an approx. volume.
For example, lets take RadBot's base plate which I've called Bottom:
Bottom is an approx cylinder with radius = 4m and height = 0.2m
The Volume of a cylinder is given by:
PI * radius * radius * height = PI * 4 * 4 * 0.2
= 10m3 (approx)
And assuming a Density of 1000kg/m3:
Mass = 10 * 1000
= 10000 kg
Thus, if you open the Property Sheet for the RigidBody object Bottom you'll see the mass as 10000 kg
In the same manner the approximate masses of all the other RigidBody parts can be calculated. Remember, we do this because we are simulating a real world robot and we want its physics to be as near to accurate as possible. (If you want to be super-accurate then you would apply Density values according to the actual material comprising the real world part)
I've taken the liberty of saving you some work, and have calculated the RigidBody Masses for you (assuming all parts have the same Density of 1000kg/m3):
I've taken the liberty of saving you some work, and have calculated the RigidBody Masses for you (assuming all parts have the same Density of 1000kg/m3):
Ok, now on with the actual assembling of RadBot:
Step 1
a) Select the bottom base plate (named Bottom) and CAREFULLY position and align it EXACTLY on the wireframe guide model of RadBot. ( I always use the [Shift] and RMB in conjunction with the big Move and Rotate icons, but you might have another method)
b) Add a temporary Fixed joint to Bottom and link it with Floor. This is just to hold RadBot stationary if you run 3DRad whilst still assembling. (When RadBot assembly is completed this joint will be disabled)
Step 2
a) Select each of Motor1 and Motor2 and CAREFULLY position and align them EXACTLY on the wireframe guide model of RadBot.
b) Fix each of Motor1 and Motor2 to Bottom with a Fixed joint.
You should end up with this:
Step 1
a) Select the bottom base plate (named Bottom) and CAREFULLY position and align it EXACTLY on the wireframe guide model of RadBot. ( I always use the [Shift] and RMB in conjunction with the big Move and Rotate icons, but you might have another method)
b) Add a temporary Fixed joint to Bottom and link it with Floor. This is just to hold RadBot stationary if you run 3DRad whilst still assembling. (When RadBot assembly is completed this joint will be disabled)
Step 2
a) Select each of Motor1 and Motor2 and CAREFULLY position and align them EXACTLY on the wireframe guide model of RadBot.
b) Fix each of Motor1 and Motor2 to Bottom with a Fixed joint.
You should end up with this:
Press [SPACE] to run 3DRad and ensure that RadBot holds steady with no spurious movements.
Step 3
a) Carefully place Top in position and align it with the wireframe.
b) Fix Top to Bottom with a Fixed joint.
Step 4
This the most important step of the whole assembly and the following assembly procedure must carried out EXACTLY.
a) Before positioning Wheel1, rotate it EXACTLY +90deg around the Z axis, so it ends up like so:
Step 3
a) Carefully place Top in position and align it with the wireframe.
b) Fix Top to Bottom with a Fixed joint.
Step 4
This the most important step of the whole assembly and the following assembly procedure must carried out EXACTLY.
a) Before positioning Wheel1, rotate it EXACTLY +90deg around the Z axis, so it ends up like so:
b) Position and align EXACTLY Wheel1 on the wireframe, as shown:
c) Repeat the above procedure for Wheel2, except rotate it -90deg around the Z axis prior to positioning.
d) Ensure that Wheel2 Y and Z locations exactly match those of Wheel1, excepting the X locations which will be opposite from each other.
The final Property Sheets for Wheel1 and Wheel2 should look as follows:
d) Ensure that Wheel2 Y and Z locations exactly match those of Wheel1, excepting the X locations which will be opposite from each other.
The final Property Sheets for Wheel1 and Wheel2 should look as follows:
e) Select Wheel1, and add a Hinge joint located at the EXACT centre of Wheel1 (this is very important... to avoid wheel wobble). Link the joint to Motor1. Ensure that the joint is rotated EXACTLY -90deg around the Y axis, so that the blue Z arm of the joint is aligned with Wheel1 axle, like so:
f) Repeat the same procedure for Wheel2
g) Test the wheel rotations are smooth and in the same direction by entering an appropriate Z spin/torque value (see pics below) in the joint's Property Sheet, and then running 3DRad.
g) Test the wheel rotations are smooth and in the same direction by entering an appropriate Z spin/torque value (see pics below) in the joint's Property Sheet, and then running 3DRad.
h) Ensure that a +ve Spin value will spin the wheels so that, when in ground contact, they will transport RadBot forward in the +ve Z world direction.
Step 5
a) Carefully place and align Skid1/Skid2 on the wireframe, using the Group as a whole to move the respective parts comprising the Skid (i.e. Skid Socket, Skid Roller and Skid Ball joint)
b) Fix each Skid Socket to Bottom with a Fixed joint.
Step 6
a) Place and fix the four PLC Supports to the Top with Fixed joints.
b) Place the PLC on its Supports and fix to Top with a Fixed joint
Well, that completes the RadBot assembly.
All you have to do now is unlink that temporary joint that fixes Radbot Bottom to the Floor and run 3DRad.
Also delete or hide the SkinMesh wireframe guide model.
If you still have each Wheel Hinge joint Spin value as 100 and Torque value at 5000, then RadBot should move forward in the Z direction at a decent pace. Lower Spin values will decrease speed. Negative Spin values will put RadBot in reverse.
Zero Spin value will stop RadBot . Differing values will make RadBot turn. There is no need to change the Torque value... keep it at 5000.
Just try it out!
At the moment, RadBot is just a moving toy vehicle. The next phase is to provide RadBot with sensors to enable RadBot to obtain feedback from his environment, so that RadBot can make intelligent decisions. This will require that RadBot's brain (PLC) gets programmed accordingly.
I'd like to see how people cope with following these building instructions, so, as a first off, I'm going to supply you with all the parts in a .zip file, and only the project .3dr file which has all the parts laid out unassembled.
Unzip the .zip file into your root folder containing the 3D Rad folder, NOT into the 3D Rad folder itself.
Step 5
a) Carefully place and align Skid1/Skid2 on the wireframe, using the Group as a whole to move the respective parts comprising the Skid (i.e. Skid Socket, Skid Roller and Skid Ball joint)
b) Fix each Skid Socket to Bottom with a Fixed joint.
Step 6
a) Place and fix the four PLC Supports to the Top with Fixed joints.
b) Place the PLC on its Supports and fix to Top with a Fixed joint
Well, that completes the RadBot assembly.
All you have to do now is unlink that temporary joint that fixes Radbot Bottom to the Floor and run 3DRad.
Also delete or hide the SkinMesh wireframe guide model.
If you still have each Wheel Hinge joint Spin value as 100 and Torque value at 5000, then RadBot should move forward in the Z direction at a decent pace. Lower Spin values will decrease speed. Negative Spin values will put RadBot in reverse.
Zero Spin value will stop RadBot . Differing values will make RadBot turn. There is no need to change the Torque value... keep it at 5000.
Just try it out!
At the moment, RadBot is just a moving toy vehicle. The next phase is to provide RadBot with sensors to enable RadBot to obtain feedback from his environment, so that RadBot can make intelligent decisions. This will require that RadBot's brain (PLC) gets programmed accordingly.
I'd like to see how people cope with following these building instructions, so, as a first off, I'm going to supply you with all the parts in a .zip file, and only the project .3dr file which has all the parts laid out unassembled.
Unzip the .zip file into your root folder containing the 3D Rad folder, NOT into the 3D Rad folder itself.

radbot_parts.3dr | |
File Size: | 347 kb |
File Type: | 3dr |

radbot_mainbodyparts.zip | |
File Size: | 602 kb |
File Type: | zip |
10/09/2013
For those who have been unable to complete the assembly, here are the project files for each of the assembly steps:
For those who have been unable to complete the assembly, here are the project files for each of the assembly steps:

radbot_assembly_steps1and2.3dr | |
File Size: | 547 kb |
File Type: | 3dr |

radbot_assembly_steps3and4.3dr | |
File Size: | 747 kb |
File Type: | 3dr |

radbot_assembly_steps5and6.3dr | |
File Size: | 669 kb |
File Type: | 3dr |

radbot_assembly_completed.3dr | |
File Size: | 620 kb |
File Type: | 3dr |
Ok, so now let's make this guy perform... on with his first program!
I'd just like to digress a little before proceeding.
Programming methods in the process control and automation world is a little different to what we are used to in normal 3DRad scripting. A machine, such as a robot, performs a sequence of discrete actions, where a current action must be completed before the next action is started. Thus, the sequence proceeds in a stepwise fashion. Many such sequences can run concurrently, and sequences can inter-communicate with each other.
This is the method we will be adopting when programming RadBot... so forget about iObjectLocationSet() and iObjectOrientationSet()... they are not part of RadBot's vocabulary!
RadBot has a right motor with one wheel joined to it (Motor1/Wheel1) and a similar left motor (Motor2/Wheel2). At this initial stage RadBot's motors can only be controlled by setting a spin speed for them (or, strictly speaking, the hinge joint) and, by setting a -ve or +ve spin, their direction of spin (reverse/forward, resp) can be controlled. One other parameter is available, and that is a 'wait()' time in millisecs.
A real world PLC (Programmable Logic Controller) have sequencers as part of their command set. We can simulate this in RadBot's virtual PLC by means of a very simple Finite State Machine (FSM) which in 3DRad scripting terms is just a "switch" control structure, as follows:
/*************************************************************************************************
//This simple demostration uses the AngelScript "switch" control structure to simulate
//an FSM (Finite State Machine).
//i.e.
// switch (StepNo)
// {
// case 0:
// {
// Do some Action1
// if this Action1 has completed (by measuring if a condition has been met)
// then
// StepNo++;
// break;
// }
// case 1:
// {
// Do some Action2
// if this Action2 has completed (by measuring if a condition has been met)
// then
// StepNo++;
// break;
// }
// case 2:
// {
// Do some Action3
// if this Action3 has completed (by measuring if a condition has been met)
// then
// StepNo++;
// break;
// }
// ......
// .......
// ...... and so on, for the desired number of steps (Actions) making up your sequence.
// }
//*************************************************************************************************
I've attached a simple demonstration of such a machine (SimpleFiniteStateMachine.3dr)
I'd just like to digress a little before proceeding.
Programming methods in the process control and automation world is a little different to what we are used to in normal 3DRad scripting. A machine, such as a robot, performs a sequence of discrete actions, where a current action must be completed before the next action is started. Thus, the sequence proceeds in a stepwise fashion. Many such sequences can run concurrently, and sequences can inter-communicate with each other.
This is the method we will be adopting when programming RadBot... so forget about iObjectLocationSet() and iObjectOrientationSet()... they are not part of RadBot's vocabulary!
RadBot has a right motor with one wheel joined to it (Motor1/Wheel1) and a similar left motor (Motor2/Wheel2). At this initial stage RadBot's motors can only be controlled by setting a spin speed for them (or, strictly speaking, the hinge joint) and, by setting a -ve or +ve spin, their direction of spin (reverse/forward, resp) can be controlled. One other parameter is available, and that is a 'wait()' time in millisecs.
A real world PLC (Programmable Logic Controller) have sequencers as part of their command set. We can simulate this in RadBot's virtual PLC by means of a very simple Finite State Machine (FSM) which in 3DRad scripting terms is just a "switch" control structure, as follows:
/*************************************************************************************************
//This simple demostration uses the AngelScript "switch" control structure to simulate
//an FSM (Finite State Machine).
//i.e.
// switch (StepNo)
// {
// case 0:
// {
// Do some Action1
// if this Action1 has completed (by measuring if a condition has been met)
// then
// StepNo++;
// break;
// }
// case 1:
// {
// Do some Action2
// if this Action2 has completed (by measuring if a condition has been met)
// then
// StepNo++;
// break;
// }
// case 2:
// {
// Do some Action3
// if this Action3 has completed (by measuring if a condition has been met)
// then
// StepNo++;
// break;
// }
// ......
// .......
// ...... and so on, for the desired number of steps (Actions) making up your sequence.
// }
//*************************************************************************************************
I've attached a simple demonstration of such a machine (SimpleFiniteStateMachine.3dr)

simplefinitestatemachine.3dr | |
File Size: | 107 kb |
File Type: | 3dr |

radbot_firstscript.3dr | |
File Size: | 753 kb |
File Type: | 3dr |
Ok, the next step in RadBot's development is to give him some means of determining his arse from his elbow! He now has to start sensing the outside world, so the first thing we are going to do is equip him with a pair of whiskers !
This is just to give you a glimpse of what's ahead.
In the next few weeks,I'll be supplying you with all the parts and building instructions for Whisker Assembly, and then we'll be adding a program script to enable their use.
In the next few weeks,I'll be supplying you with all the parts and building instructions for Whisker Assembly, and then we'll be adding a program script to enable their use.
23/09/2013
Whisker Assembly
In the present situation, if RadBot runs into an obstacle he will just carry on trying to move forward regardless. We will have to equip him with some kind of sensor which will signal him that he has hit an obstacle. On receiving this signal (if he is intelligent enough) he will try to take immediate avoiding action by reversing away from the obstacle. The sensor we use is called a whisker ( as in rat or mouse). The whisker is in the form of a bent "wire", hinged at one end to RadBot's bottom plate. The whisker pushes against a pushbutton such that when the whisker makes contact with an object, the pushbutton is depressed which sends an "ON" signal to RadBot's brain (i.e. the PLC).
Here are all the unassembled 3DRad objects comprising the Whisker Assembly:
In the present situation, if RadBot runs into an obstacle he will just carry on trying to move forward regardless. We will have to equip him with some kind of sensor which will signal him that he has hit an obstacle. On receiving this signal (if he is intelligent enough) he will try to take immediate avoiding action by reversing away from the obstacle. The sensor we use is called a whisker ( as in rat or mouse). The whisker is in the form of a bent "wire", hinged at one end to RadBot's bottom plate. The whisker pushes against a pushbutton such that when the whisker makes contact with an object, the pushbutton is depressed which sends an "ON" signal to RadBot's brain (i.e. the PLC).
Here are all the unassembled 3DRad objects comprising the Whisker Assembly:
Step 1
Firstly, align both the SkinMesh Whisker and the RigidBody Whisker with the Whisker Assembly Template. Link the SkinMesh Whisker to its RigidBody equivalent.
Position the SkinMesh PushButton(off) over its equivalent RigidBody :
Firstly, align both the SkinMesh Whisker and the RigidBody Whisker with the Whisker Assembly Template. Link the SkinMesh Whisker to its RigidBody equivalent.
Position the SkinMesh PushButton(off) over its equivalent RigidBody :
Now add a Hinge Joint to the base of the Whisker Rigidbody and link it to the Floor (just for now... later it will be linked to RadBot). The BLUE axis of a Hinge Joint is always the axis of rotation, so carefully ensure that it is oriented 90deg upward, as shown below:
Ensure that the Hinge Joint Property Sheet looks as follows:
Note that the Joint Z-axis stop limits have been set to -10deg and +10deg (for now) to ensure the whisker does not swing around wildly while testing. For testing purposes, I've added a RigidBody TestBall with a linked Force object which nudges the ball towards the Whisker when you press [SpaceBar] to test that the Whisker Hinge operation is correct. Remember to link the TestBall to the Whisker, the G-Force gravity object, and the Floor !
Step 2
We now concentrate on fitting together the PushButton, and ensuring that it works correctly. Three more 3DRad objects will have to be added:
Step 2
We now concentrate on fitting together the PushButton, and ensuring that it works correctly. Three more 3DRad objects will have to be added:
As shown above, these are: 1) a Slider Joint linking the RigidBody PushButton with the RigidBody PushButton Holder. 2) a temporary Fixed Joint linking the PushButton Holder firmly to the Floor, so that it does not move around while testing. 3) a Spring to ensure that the PushButton returns to its "OFF" position after having been depressed.
Again, ensure for the Slider Joint that its BLUE axis is the active one.
Again, ensure for the Slider Joint that its BLUE axis is the active one.
I had to experiment a little to get the Spring and Slider Joint properties correct. Here are the Property Sheets for each, that I found worked nicely
Step 3
The nextl step in this puzzle is to Group all the PushButton objects and move/orientate as a Group so that they align exactly with the Whisker Assembly Template.:
The nextl step in this puzzle is to Group all the PushButton objects and move/orientate as a Group so that they align exactly with the Whisker Assembly Template.:
You are now ready to test that it all operates correctly. Press [SpaceBar] to run 3DRad.
The TestBall should roll forward and on hitting the Whisker should cause it to rotate backward (on its Hinge Joint) and push the PushButton RigidBody so it slides back (on its Slider Joint) and makes contact with the PushButton Holder RigidBody. Then the Spring should cause the PushButton RigidBody to return to its starting position.
To make this clearer, here is a little video of the action (with SkinMeshes hidden for easier viewing)
The TestBall should roll forward and on hitting the Whisker should cause it to rotate backward (on its Hinge Joint) and push the PushButton RigidBody so it slides back (on its Slider Joint) and makes contact with the PushButton Holder RigidBody. Then the Spring should cause the PushButton RigidBody to return to its starting position.
To make this clearer, here is a little video of the action (with SkinMeshes hidden for easier viewing)
You will notice in the video a ValuePrint object which changes from "0" to "1" when contact is made between the RigidBody PushButton and the RigidBody PushButton Holder. This is brought about by an EventOnProximity object linked to the RigidBody PushButton, the RigidBody PushButton Holder and a small Script, which ties everything in to the ValuePrint object.
Step 4
This is the final step in the Whisker Assembly.
We now have to fix this Whisker Assembly to the correct position on RadBot's front right. We also have to mirror a copy to RadBot's front left. The method that I use is as follows:
1. Load into 3DRad your original RadBot project file ("RadBot_SecondScript.3dr" if you have been following this tutorial from the start)
2. Merge (see Project menu) the final just-completed Whisker Assembly project file ("RadBot_WhiskerAssembly_Step3.3dr")
3. Delete any duplicated objects from the now merged Object List.
4. Group all the relevant objects comprising the Whisker Assembly, and move them as a Group to the correct position on RadBot?s front right.
5. Now, how to copy a mirror of this left-handside Whisker Assembly to the right-handside?
6. Clone all the objects in the current left-handside Whisker Assembly group.
7. Un-Group the current left-handside Whisker Assembly.
8. Add a new Group object at the centre position (i.e. Whisker Hinge Joint) and link all the cloned objects to this new Group.
9. Then Z-Rotate the whole Group 180deg to the right-handside.
Finally, since some of the RigidBodies and Joints are still linked to the Floor, you will now have to re-link them to RadBot's Bottom plate.
This is the final step in the Whisker Assembly.
We now have to fix this Whisker Assembly to the correct position on RadBot's front right. We also have to mirror a copy to RadBot's front left. The method that I use is as follows:
1. Load into 3DRad your original RadBot project file ("RadBot_SecondScript.3dr" if you have been following this tutorial from the start)
2. Merge (see Project menu) the final just-completed Whisker Assembly project file ("RadBot_WhiskerAssembly_Step3.3dr")
3. Delete any duplicated objects from the now merged Object List.
4. Group all the relevant objects comprising the Whisker Assembly, and move them as a Group to the correct position on RadBot?s front right.
5. Now, how to copy a mirror of this left-handside Whisker Assembly to the right-handside?
6. Clone all the objects in the current left-handside Whisker Assembly group.
7. Un-Group the current left-handside Whisker Assembly.
8. Add a new Group object at the centre position (i.e. Whisker Hinge Joint) and link all the cloned objects to this new Group.
9. Then Z-Rotate the whole Group 180deg to the right-handside.
Finally, since some of the RigidBodies and Joints are still linked to the Floor, you will now have to re-link them to RadBot's Bottom plate.
The next installment of this Tutorial will concentrate on programming RadBot, using his Whiskers for sensing.
Stay tuned!
Here are all the required files (assuming that you have all the files for the previous RadBot Assembly)
Stay tuned!
Here are all the required files (assuming that you have all the files for the previous RadBot Assembly)

radbot_whiskerassemblyparts.zip | |
File Size: | 386 kb |
File Type: | zip |

radbot_whiskerassembly_step1.3dr | |
File Size: | 210 kb |
File Type: | 3dr |

radbot_whiskerassembly_step2.3dr | |
File Size: | 247 kb |
File Type: | 3dr |

radbot_whiskerassembly_step3.3dr | |
File Size: | 364 kb |
File Type: | 3dr |

radbot_whiskerassembly_completed.3dr | |
File Size: | 1399 kb |
File Type: | 3dr |
11/11/2013
Programming RadBot
The only real problem I had when testing RadBot with his attached Whiskers, was that when RadBot started speeding up, slowing down or turning, then the acceleration forces that were produced caused the Whiskers to swing, which led to false contacts being made. This was easily solved by increasing the Spring strength and damping, as follows:
The only real problem I had when testing RadBot with his attached Whiskers, was that when RadBot started speeding up, slowing down or turning, then the acceleration forces that were produced caused the Whiskers to swing, which led to false contacts being made. This was easily solved by increasing the Spring strength and damping, as follows:
Ok, now on with the programming.
At the start of this Tutorial I showed the Initial Script which made RadBot perform a sequence of movements. To save you paging back, here it is again:
At the start of this Tutorial I showed the Initial Script which made RadBot perform a sequence of movements. To save you paging back, here it is again:
You can see that, without the line comments, you would not really be able to tell what each step is doing. AngelScript (3DRad's inbuilt scripting language) allows us to write functions, and doing so will allow us to present the above Main script in a more readable form, as well as saving us on typing !. You can add all your functions after Main. I've named the functions as follows:
And they are made up as follows:
And the Main script, now re-written with the functions, looks as follows:
Now let's look at a very simple example, using the feedback from the Whiskers.
Here is the initial setup of RadBot and a Rock obstruction:
Here is the initial setup of RadBot and a Rock obstruction:
And the script which accomplishes it:
Basically, Step0 keeps RadBot moving forward and, at the same time, monitoring the feedback from both the Whisker Scripts which are running continually and concurrently.
As soon as either Whisker hits an obstacle, then a "1" signal is conveyed back to Main, which then jumps out of Step0, to whatever Step you desire. ( in this simple case the Step0 is incremented to the next Step1)
As an aside, in my opinion, I have seen very little use of the very useful and important fact that 3DRad can run sequences concurrently and communicate with each other, via the inbuilt IN_, OUT_, and VAR_ variables. This simulates very nicely the operation of a real world PLC, which operates essentially in the same manner.
You will notice that I display the current StepNo. This is extremely useful for debugging purposes, as it gives you an instant pointer of where to look when your code is not doing what you expect it to do.
Ok, let's shift over to an example which has a little more meat on its bones!
Here is the initial setup, an enclosed arena (which can also be juggled around to suit)
As soon as either Whisker hits an obstacle, then a "1" signal is conveyed back to Main, which then jumps out of Step0, to whatever Step you desire. ( in this simple case the Step0 is incremented to the next Step1)
As an aside, in my opinion, I have seen very little use of the very useful and important fact that 3DRad can run sequences concurrently and communicate with each other, via the inbuilt IN_, OUT_, and VAR_ variables. This simulates very nicely the operation of a real world PLC, which operates essentially in the same manner.
You will notice that I display the current StepNo. This is extremely useful for debugging purposes, as it gives you an instant pointer of where to look when your code is not doing what you expect it to do.
Ok, let's shift over to an example which has a little more meat on its bones!
Here is the initial setup, an enclosed arena (which can also be juggled around to suit)
The program script shows how RadBot can move around forever, bouncing off walls as he goes. ( You can even add a few boulders to confuse him! )
Sometimes RadBot may hit a wall headon, which means that both Whisker contacts will be made simultaneously. In that case, take action on ANDed contacts, otherwise consider an action on each contact taken separately.
I'd like to finish off this section with the first Challenge:
Here is the setup:
I'd like to finish off this section with the first Challenge:
Here is the setup:
And the Challenge is:
Continue on the same forward path, but get through the gap between the two rocks, hitting each rock only ONCE and NOT pushing them out of the way!
Continue on the same forward path, but get through the gap between the two rocks, hitting each rock only ONCE and NOT pushing them out of the way!

radbot_programming_01.3dr | |
File Size: | 1406 kb |
File Type: | 3dr |

radbot_programming_02.3dr | |
File Size: | 1409 kb |
File Type: | 3dr |

radbot_programming_03.3dr | |
File Size: | 1684 kb |
File Type: | 3dr |

radbot_challenge_01.3dr | |
File Size: | 1424 kb |
File Type: | 3dr |