Skip to content

Commit

Permalink
Issue #1631: revise structure and toolboxes
Browse files Browse the repository at this point in the history
- refactor workers and validators
- revise toolboxes
-- add new blocks to calliopeV3
--- logo touch sensor
--- play file action
--- play expression action
--- set volume action
--- sound toggle action
--- rgb led
- implement external sensors
- implement external actuators
  • Loading branch information
AyaMoussa authored and bjost2s committed Jun 17, 2024
1 parent 49a4539 commit 4772193
Show file tree
Hide file tree
Showing 169 changed files with 6,592 additions and 1,267 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ public boolean hasMarkerSim() {
return p != null && p.equals("true");
}

public final String getPluginSim() {
return this.pluginProperties.getStringProperty("robot.pluginSim");
}

public final String nnProperty() {
String p = this.pluginProperties.getStringProperty("robot.nn");
return p == null ? "never" : p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class SetRobotResponse extends BaseResponse {
protected String sourceCodeFileExtension;
protected String binaryFileExtension;
protected String firmwareDefault;
protected String pluginSim;
protected boolean pluginSimDefined;

/**
* the response for the /setRobot REST request
Expand Down Expand Up @@ -85,6 +87,7 @@ public static SetRobotResponse makeFromProperties(
boolean sim,
boolean multipleSim,
boolean markerSim,
String pluginSim,
boolean nn,
JSONArray nnActivations,
boolean webotsSim,
Expand Down Expand Up @@ -120,6 +123,7 @@ public static SetRobotResponse makeFromProperties(
entity.setSim(sim);
entity.setMultipleSim(multipleSim);
entity.setMarkerSim(markerSim);
entity.setPluginSim(pluginSim);
entity.setNn(nn);
entity.setNnActivations(nnActivations);
entity.setWebotsSim(webotsSim);
Expand Down Expand Up @@ -426,6 +430,29 @@ public boolean getMarkerSim() {
return this.markerSim;
}

/**
* GET pluginSim. Object must be immutable. Never return null or an undefined/default value.
*/
public String getPluginSim() {
if ( !this.immutable ) {
throw new RuntimeException("no pluginSim from an object under construction: " + toString());
}
return this.pluginSim;
}

/**
* SET pluginSim. Object must be mutable.
*/
public SetRobotResponse setPluginSim(String pluginSim) {
if ( this.immutable ) {
throw new RuntimeException("pluginSim assigned to an immutable object: " + toString());
}
this.pluginSim = pluginSim;
this.pluginSimDefined = true;
return this;
}


/**
* SET markerSim. Object must be mutable.
*/
Expand Down Expand Up @@ -768,6 +795,7 @@ public JSONObject toJson() {
jsonO.put("sim", this.sim);
jsonO.put("multipleSim", this.multipleSim);
jsonO.put("markerSim", this.markerSim);
jsonO.put("pluginSim", this.pluginSim);
jsonO.put("nn", this.nn);
jsonO.put("nnActivations", this.nnActivations);
jsonO.put("webotsSim", this.webotsSim);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ public Response setRobot(FullRestRequest fullRequest) throws Exception //
response.setSim(robotFactory.hasSim());
response.setMultipleSim(robotFactory.hasMultipleSim());
response.setMarkerSim(robotFactory.hasMarkerSim());
response.setPluginSim(robotFactory.getPluginSim());
response.setNn(true); // TODO: temporary fix
response.setNnActivations(robotFactory.getNNActivations());
response.setWebotsSim(robotFactory.hasWebotsSim());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Sensors:
Actors:
[UsedActor [, DIFFERENTIALDRIVE], UsedActor [m1, MOTOR], UsedActor [m2, MOTOR], UsedActor [S, SERVOMOTOR]]
Methods:
[]
[SET_BOTH_MOTORS, SET_MOTOR]
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Sensors:
Actors:
[UsedActor [m1, MOTOR], UsedActor [S, SERVOMOTOR], UsedActor [C17, MOTIONKIT], UsedActor [C16, MOTIONKIT], UsedActor [, MOTIONKIT]]
Methods:
[]
[SET_MOTOR]
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Sensors:
Actors:
[UsedActor [, DIFFERENTIALDRIVE], UsedActor [MR, MOTOR], UsedActor [ML, MOTOR]]
Methods:
[]
[SET_BOTH_MOTORS]
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Sensors:
Actors:
[UsedActor [M, MOTOR]]
Methods:
[]
[SET_MOTOR]
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Sensors:
Actors:
[UsedActor [, DIFFERENTIALDRIVE], UsedActor [m1, MOTOR], UsedActor [m2, MOTOR], UsedActor [S, SERVOMOTOR]]
Methods:
[]
[SET_BOTH_MOTORS, SET_MOTOR]
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Sensors:
Actors:
[UsedActor [m1, MOTOR], UsedActor [S, SERVOMOTOR], UsedActor [C17, MOTIONKIT], UsedActor [C16, MOTIONKIT], UsedActor [, MOTIONKIT]]
Methods:
[]
[SET_MOTOR]
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Sensors:
Actors:
[UsedActor [, DIFFERENTIALDRIVE], UsedActor [MR, MOTOR], UsedActor [ML, MOTOR]]
Methods:
[]
[SET_BOTH_MOTORS]
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Sensors:
Actors:
[UsedActor [M, MOTOR]]
Methods:
[]
[SET_MOTOR]
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Sensors:
Actors:
[UsedActor [, DIFFERENTIALDRIVE], UsedActor [m1, MOTOR], UsedActor [m2, MOTOR], UsedActor [S, SERVOMOTOR]]
Methods:
[]
[SET_BOTH_MOTORS, SET_MOTOR]
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Sensors:
Actors:
[UsedActor [m1, MOTOR], UsedActor [S, SERVOMOTOR], UsedActor [C17, MOTIONKIT], UsedActor [C16, MOTIONKIT], UsedActor [, MOTIONKIT]]
Methods:
[]
[SET_MOTOR]
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Sensors:
Actors:
[UsedActor [, DIFFERENTIALDRIVE], UsedActor [MR, MOTOR], UsedActor [ML, MOTOR]]
Methods:
[]
[SET_BOTH_MOTORS]
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Sensors:
Actors:
[UsedActor [M, MOTOR]]
Methods:
[]
[SET_MOTOR]
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ void ____move();
void ____action();



double ___n;

int main()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ MicroBit _uBit;
void ____move();



double ___n;

int main()
Expand Down Expand Up @@ -55,3 +56,4 @@ void ____move() {
_uBit.io.P2.setServoValue(0);
_uBit.io.P8.setAnalogValue(0);
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ MicroBit _uBit;




int main()
{
_uBit.init();
Expand Down Expand Up @@ -45,3 +46,4 @@ int main()
_uBit.soundmotor.motorBOff();
release_fiber();
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
MicroBit _uBit;



double ___item;

int main()
Expand All @@ -33,3 +34,4 @@ int main()
_uBit.sleep(500);
release_fiber();
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ void ____move();
void ____action();



double ___n;

int main()
Expand Down Expand Up @@ -64,3 +65,4 @@ void ____move() {
void ____action() {
____move();
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ MicroBit _uBit;
void ____move();



double ___n;

int main()
Expand Down Expand Up @@ -55,3 +56,4 @@ void ____move() {
_uBit.io.P2.setServoValue(0);
_uBit.io.P8.setAnalogValue(0);
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ MicroBit _uBit;




int main()
{
_uBit.init();
Expand Down Expand Up @@ -45,3 +46,4 @@ int main()
_uBit.soundmotor.motorBOff();
release_fiber();
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
MicroBit _uBit;



double ___item;

int main()
Expand All @@ -33,3 +34,4 @@ int main()
_uBit.sleep(500);
release_fiber();
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ void ____move();
void ____action();



double ___n;

int main()
Expand Down Expand Up @@ -64,3 +65,4 @@ void ____move() {
void ____action() {
____move();
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ MicroBit _uBit;
void ____move();



double ___n;

int main()
Expand Down Expand Up @@ -55,3 +56,4 @@ void ____move() {
_uBit.io.P2.setServoValue(0);
_uBit.io.P8.setAnalogValue(0);
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ MicroBit _uBit;




int main()
{
_uBit.init();
Expand Down Expand Up @@ -45,3 +46,4 @@ int main()
_uBit.soundmotor.motorBOff();
release_fiber();
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
MicroBit _uBit;



double ___item;

int main()
Expand All @@ -33,3 +34,4 @@ int main()
_uBit.sleep(500);
release_fiber();
}

Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def hsv2rgb(color):
x = c * (1 - abs(((h/60.0) % 2) - 1))
m = v - c

rgb = (0, 0, 0)
if 0.0 <= h < 60:
rgb = (c, x, 0)
elif 0.0 <= h < 120:
Expand Down
Loading

0 comments on commit 4772193

Please sign in to comment.