Getting Started
The Hedgehog IDE allows you to create and run your own programs easily, without installing extra software or creating accounts first. We respect your privacy and your data, so we don't require any of your data unless absolutely needed - that is, basically, the code you write and nothing else.
Creating a project
A software project contains files that work together to create a program. Creating one is the first thing you will have to do to get started. In your project list, click on the "+" icon and choose a name. After you created the project, click on it to open it.
After opening the project, right click the project root to create a file in it. In this example, let's choose "New Blockly File" – Blockly allows the visual creation of programs. After creating the file, it is opened automatically and you should see an empty Blockly workspace where you can create your program.
Controlling a simulated robot with Blockly
Before you start adding blocks to your program, let's look at the simulator. Click on the X,Y,Z axis icon above the project tree to open it in a new tab, then drag that tab to the bottom to see Blockly and the simulator at the same time.
The Simulator (and the console, which is opened with the second button above the project tree) opens automatically when a program gives commands to the robot (or outputs text, respectively) if it is not already open. Nonetheless it is advisable to arrange these tabs in advance.
Blockly Commands
Drive
Commands in this category let you drive the robot by starting or stopping two motors at the same time. Motors can use speeds between -1000 and +1000. The simulated robot's left wheel is motor 0, the right wheel motor 1.
These commands start the motors. The second variant also brakes the motors after the specified time.
These commands stop the motors. Currently both commands do the same thing in the simulation. The idea is that turning off lets the wheels roll out, while braking stops the robot quickly.
Motors
Commands in this category let you control the robot's motors individually. Apart from that, the commands work like those in the Drive category.
These commands start a motor. The second variant also brakes the motor after the specified time.
These commands stop the motor. Currently both commands do the same thing in the simulation. The idea is that turning off lets the wheel roll out, while braking stops the motor quickly.
Servos
Servos hold a position that is set for them. Servo positions are between 0 and 1000, corresponding to 0° and 180°. The simulated robot does not yet have any servos, though. Stay tuned!
This command sets the servo to a certain position. Even if there's resistance (e.g. an obstacle) the servo will try to hold its position.
This command turns the servo off. The servo will not hold its position if there's resistance.
Sensoren
Sensors let the robot observe the simulated environment. Sensor values are between 0 and 4095, the exact value ranges depend on the type of sensor though.
- Four line sensors that can detect black lines on the ground; these are sensors 0 to 3, from left to right. These sensors change color to orange when a line is detected.
Values: The sensor value is high when a (dark) line is detected, otherwise (on light surfaces) it is low. - Three distance sensors looking forward and slightly to the sides can detect obstacles without touching them; these are sensors 4 to 6, from left to right. The rays coming out of the robot's front indicate the direction and range of these sensors.
Values: The sensor value increases when getting closer to an obstacle, then decreases again when the obstacle almost touches the robot. This behavior models a distance sensor very popular in hobby robotics. - One bump sensor that is almost as wide as the robot front; this is sensor 8. This sensor changes color to orange when a line is detected.
Values: The sensor value is low when a collision is detected. This behavior models a "pull-up" circuit that is often used for touch sensors.
- Analog sensors can take on many different values; a good example is the distance sensor. To use an analog sensor, you have to work with the numeric values between 0 and 4095.
- Digital sensors only have two possible states, e.g. "collision" and "no collision" or "line" or "no line". For these sensors, you can simplify your work by using digital values:
- Analog values 0 bis 2047: Digital value
false
- Analog values 2048 bis 4095: Digital value
true
- Analog values 0 bis 2047: Digital value
Reads the digital value of a sensor.
Reads the analog value of a sensor. The second example compares the value to a threshold to convert it to a (digital) truth value (true/false). The threshold of 2048 leads to the same behavior as the block for reading a digital value, but using the comparison block lets you adjust the threshold.
Miscellaneous
This block lets the program pause for the specified duration. If any motors are turned on, they will continue to move during that time.
This command displays a value on the console. The value may be a text, a number or a digital truth value. It's often useful to display sensor values when a program isn't doing what it should.
Now let's try out a simple program:
Create this program in your project, then click the green "Play" button; you will see the robot driving to the other side of the simulation and stopping at the wall. In detail, what happened is the following:
- The first block let the robot move forward.
- The next block is a loop, running while the sensor on port 8 has a high digital value. Sensor 8 is the bump sensor, and high values mean no collison. In other words, the loop repeats until a collision is detected.
- Inside the loop, the program simply sleeps. Even though the program pauses, the motors are still moving. That means that the robot will continue moving as long as there was no collision.
- After the loop, i.e. as soon as there was a collision, the robot is stopped. This is the last command, so the program is finished.
Exporting & importing files
To download one of your files so that you can, for example, share it with others, right click on that file and choose "Download". Likewise, to import a file into the Hedgehog IDE, right click on a folder and choose "Upload". Beware, currently the Hedgehog IDE replaces existing files without warning!
Despite the name of these operations, your files are stored locally in your browser, not on our servers. Future features may allow that, but you will always be asked if you want to share data with us.