-
Notifications
You must be signed in to change notification settings - Fork 29
Configuration
As of version >=1.3 you are able to configure existing attachments and even "attach" different attachments to preset locations on the vehicle.
SMCE-gd looks for the files vehicle_config.json
and board_config.json
inside the directory of the selected arduino sketch.
If they are not found the default configuration will be used so you don't have to supply what you dont use.
By default configations get parsed as a "patch" e.g. the changes you supply will overwrite the default config, this is done for convience as often you only want to change a single property.
If you want to start from scratch add "from_scrath": true
in the top level of your config file.
warning: this exposes a lot of internal structure, some things may not be entirely straight forward!
Each vehicle shoulld define a set of slots on which you can attach an attachment like so:
vehicle_config.json
:
{
"from_scratch": true,
"slots": {
"Front": {
"class": "AnalogRaycast",
"name": "Front Infrared",
"props": {
"pin": 0
}
}
}
}
** WARNING **: attachments need pins available to work, and sometimes it will need more than actually advertised on the arduino side, but an analog raycast will be fine with just a single pin:
board_config.json
:
{
"from_scratch": true,
"gpio_drivers": [
{ "pin": 0, "analog": true },
],
}
Maybe in the future we can deduce what pins all the attachments need, but at the time writing such a thing does not exist.
to get an idea on how a full config is structured see the actual internally used one:
https://github.com/ItJustWorksTM/smce-gd/tree/master/project/share/config
A vehicle will provide its own internal attachments as it may depend on particular functionality, if you are going from scratch be sure to accomodate the necesary board config for these built in attachmeents.
An example of such an attachment is the BrushedMotor
, while you don't have as much freedom with builtins you can still configure them like this by name:
{
"builtin": {
"Left BrushedMotor": {
"forward_pin": 12,
"backward_pin": 14,
"enable_pin": 13
}
}
}
If you want to angle the front infrared sensor on the default vehicle you can do so like this:
vehicle_config.json
:
{
"slots": {
"Front": {
"props": {
"rotation_degrees": "Vector3(-5,0,0)"
}
},
},
}
If you want to chang the view distance of the camera attachment you can do so like this:
vehicle_config.json
:
{
"slots": {
"Front2": {
"name": "Front FAR Camera",
"props": {
"far": 1500
}
},
}
}
hint: props can set any godot property of the attachemtn node, check the source code on what is available
If you want to configure what vehicle that is used (if you made a vehicle mod for example) you can do so like this:
vehicle_config.json
:
{
"vehicle": "RayTank"
}