JIC-CSB / kilombo

Kilobot simulator in C
Other
44 stars 16 forks source link

About the use of kilombo #44

Open Hi-Ryan opened 6 years ago

Hi-Ryan commented 6 years ago

How to set the initial position of the robot in a fixed position?

fjansson commented 6 years ago

You can supply a json file containing the initial state of the simulation, by adding -b <initial.json> on the command line.

When the simulation ends, it writes the final state to the file endstate.json. You can use this file to see how the state file is formatted. You can also use the simulator as a GUI for editing the initial state: 1) press / to set the speed to 0 2) move the bots around to your liking 3) exit the simulator, copy endstate.json to some other name, e.g. initial.json 4) start from this state using -b initial.json

Hi-Ryan commented 6 years ago

Thanks for your help. But I don't know how to make the simulation platform run initial.json. I noticed that "formation" can be added to kilombo.json file to make the robot distributed according to a certain rule. But I only know the straight line. What else is the distribution of it?

fjansson commented 6 years ago

The options are documented in doc/manual.md

formation: Current options are random, line, pile, circle, ellipse

The idea with the formation option was just to give a quick way to try some simple standard formations. If you want something specific, provide the initial state with a json file instead. For example, with the gradient demo which is included with the code:

cd examples/gradient
make                          # compile the example
./gradient                    # run the example once, move bots as you want
cp endstate.json initial.json # copy the end state
./gradient -b initial.json    # run again starting from the final state of the first run