I was wondering if a robot’s behaviour could be programmed in its materials.
What if the flex piece was generated by a computer program. The robot’s behaviour stays the same, but the flexible piece changes, which makes the way it “eats” the light different.
Continuing from update 5, with the data from the two robots with different flex pieces I started to write a program that outputs what the parameters should be for a given input. The input is the location of a ldr sensor.
Ported the flex piece from Inventor to Antimony. It turned out to be better, because the pattern for the holes was easier to adjust given if the length changes.
The code of the robot tells the motor to reel in when the ldr does not see the light. When it does see the light, then reel out. The light is on for 3 secs, then off for 3 secs.
What changes with these robots is the actual observed behaviour, because of the flex piece.
The program modifies the length of the flexible piece, and the depth of the three ribs. The ribs are used to provide the return, and the longer the piece is chances are it will flop over.
Here was the first piece printed out that was created by a computer program!
The recipe of that one was:
5-1-2:40-4-4-2:213-50-15:epicurl
The program outputs a recipe of the robot! :)
Here’s what a different robot looks like (6-1-2:40-4-8-4:213-100-10:zzmm):
Uncurled:
Curled:
Here’s a short video of one of the robots in action:
(Sorry forgot to take a video of all of the robots moving)
Here’s a group shot of the robots. Their names are: Yllo, Epicurl, Eool, and Fun:
To create a python script that modifies an Antimony file, first created a template .sb file.
The bulk of the curl mech gen python script is just the “calculations” and prompting for user input. So here is how it modifies the Antimony template. It’s looking for the node named dim, because in Antimony this is a script node with all of my parameters in it. After it finds it, it’s just very simple to set the data and save it.
def generateSbModel(): with open(antimony_file, "r+") as json_file: json_data = json.load(json_file) #print(json_data['connections']) #print(len(json_data['nodes'])) nodes = json_data['nodes'] name = "-" dim_index = 99 for j in range(0, len(nodes)): datums = nodes[j]['datums'] for i in range(0, len(datums)): meep = datums[i] if meep['name'] == "__name": name = meep['expr'] #print(name) if name == "dim": dim_index = j break dim_datum = nodes[dim_index]['datums'] for i in range(0, len(dim_datum)): meep = dim_datum[i] # it seems like all the variables in the .sb file # for expr are strings, so just going to set # them all as strings too if meep['name'] == "length": json_data['nodes'][dim_index]['datums'][i]['expr'] = str(length) if meep['name'] == "rib_l": json_data['nodes'][dim_index]['datums'][i]['expr'] = str(rib_l) if meep['name'] == "rib_m": json_data['nodes'][dim_index]['datums'][i]['expr'] = str(rib_m) if meep['name'] == "rib_r": json_data['nodes'][dim_index]['datums'][i]['expr'] = str(rib_r) json_file.seek(0) json.dump(json_data, json_file, indent=4)
Definitely want to keep exploring more about this idea. It’s just a start! Originally wanted more links so the generated robot could maybe move when it curls up. It would be interesting to see if these could be generated with a specific end effector, to do some task, then immediately curl up to protect it and use the locomotion to spin away.
The source files can be found here