Skip to content

Commit

Permalink
New smoky visualize
Browse files Browse the repository at this point in the history
  • Loading branch information
Huowl committed Dec 11, 2023
1 parent dafb032 commit 0990f9a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions examples/biped.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from rostok.library.rule_sets.leg_rules import get_biped
from rostok.graph_grammar.graph_utils import plot_graph

scenario = WalkingScenario(0.00001, 20)
scenario = WalkingScenario(0.0001, 1)

graph = get_biped()
plot_graph(graph)
control = controll_parameters = {"initial_value": [0]*8}

scenario.run_simulation(graph, control, starting_positions=[[0,-30,60,-30], [0,30,-60,30]], vis = True, delay=True)
scenario.run_simulation(graph, control, starting_positions=[[0,30,-60,30], [0,30,-60,30]], vis = True, delay=True)
10 changes: 5 additions & 5 deletions rostok/library/rule_sets/leg_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@ def create_rules(tendon=False, smc=False):
def_mat = DefaultChronoMaterialNSC()
# blueprint for the palm
body = PrimitiveBodyBlueprint(
Box(0.05, 0.02, 0.2), material=def_mat, color=[100, 100, 0])
Box(0.055*2, 0.055*2, 0.055*2), material=def_mat, color=[178, 82, 164])

body_q = PrimitiveBodyBlueprint(
Box(0.3, 0.02, 0.2), material=def_mat, color=[100, 100, 0])
Box(0.3, 0.02, 0.2), material=def_mat, color=[178, 82, 164])
# blueprint for the base
base = PrimitiveBodyBlueprint(Box(0.02, 0.01, 0.02),
material=def_mat,
color=[0, 255, 0],
density=10000)


foot = PrimitiveBodyBlueprint(Box(0.05, 0.02, 0.03),
foot = PrimitiveBodyBlueprint(Box(0.07, 0.02, 0.05),
material=def_mat,
color=[255, 0, 0],
color=[140, 150, 140],
density=100)
# sets effective density for the links, the real links are considered to be extendable.
link_mass = (28 + 1.62 + 2.77) * 1e-3
length_link = [0.05, 0.06, 0.075]
length_link = [0.07, 0.085, 0.1]
# create link blueprints using mass and length parameters
link = list(
map(
Expand Down
18 changes: 9 additions & 9 deletions rostok/simulation_chrono/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ def initialize_vis(self, chrono_system):
self.vis.Initialize()
self.vis.AddSkyBox()
self.vis.AddCamera(chrono.ChVectorD(-0.15, 0.35, 0.40), chrono.ChVectorD(0.0, 0.1, 0))
self.vis.AddLight(chrono.ChVectorD(0.4, 0.0, -0.4), 0.28, chrono.ChColor(1, 1, 1))
self.vis.AddLight(chrono.ChVectorD(0.4, 0.0, 0.4), 0.28, chrono.ChColor(1, 1, 1))
self.vis.AddLight(chrono.ChVectorD(-0.4, 0.0, -0.4), 0.28, chrono.ChColor(1, 1, 1))
self.vis.AddLight(chrono.ChVectorD(-0.4, 0.0, 0.4), 0.28, chrono.ChColor(1, 1, 1))
self.vis.AddLight(chrono.ChVectorD(0.4, 0.8, -0.4), 0.28, chrono.ChColor(1, 1, 1))
self.vis.AddLight(chrono.ChVectorD(0.4, 0.8, 0.4), 0.28, chrono.ChColor(1, 1, 1))
self.vis.AddLight(chrono.ChVectorD(-0.4, 0.8, -0.4), 0.28, chrono.ChColor(1, 1, 1))
self.vis.AddLight(chrono.ChVectorD(-0.4, 0.8, 0.4), 0.28, chrono.ChColor(1, 1, 1))

# self.vis.AddLight(chrono.ChVectorD(0.4, 0.0, -0.4), 0.28, chrono.ChColor(1, 1, 1))
# self.vis.AddLight(chrono.ChVectorD(0.4, 0.0, 0.4), 0.28, chrono.ChColor(1, 1, 1))
# self.vis.AddLight(chrono.ChVectorD(-0.4, 0.0, -0.4), 0.28, chrono.ChColor(1, 1, 1))
# self.vis.AddLight(chrono.ChVectorD(-0.4, 0.0, 0.4), 0.28, chrono.ChColor(1, 1, 1))
# self.vis.AddLight(chrono.ChVectorD(0.4, 0.8, -0.4), 0.28, chrono.ChColor(1, 1, 1))
# self.vis.AddLight(chrono.ChVectorD(0.4, 0.8, 0.4), 0.28, chrono.ChColor(1, 1, 1))
# self.vis.AddLight(chrono.ChVectorD(-0.4, 0.8, -0.4), 0.28, chrono.ChColor(1, 1, 1))
# self.vis.AddLight(chrono.ChVectorD(-0.4, 0.8, 0.4), 0.28, chrono.ChColor(1, 1, 1))
self.vis.AddTypicalLights()
def enable_collision_shape(self):
self.vis.EnableCollisionShapeDrawing(True)

Expand Down
3 changes: 2 additions & 1 deletion rostok/simulation_chrono/simulation_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ def run_simulation(self,
def_mat = DefaultChronoMaterialNSC()
floor = creator.create_environment_body(EnvironmentBodyBlueprint(Box(1, 0.1, 1), material=def_mat, color=[215, 255, 0]))
floor.body.SetNameString("Floor")
floor.body.SetPos(chrono.ChVectorD(0,0,0))
floor.body.SetPos(chrono.ChVectorD(0,-0.05,0))
floor.body.GetVisualShape(0).SetTexture("D:\\Program\\miniconda\\envs\\rostok\\Library\\data\\textures\\bluewhite.png", 10, 10)
#floor.body.SetBodyFixed(True)


Expand Down

0 comments on commit 0990f9a

Please sign in to comment.