File tree Expand file tree Collapse file tree 2 files changed +13
-23
lines changed
Expand file tree Collapse file tree 2 files changed +13
-23
lines changed Original file line number Diff line number Diff line change @@ -36,22 +36,23 @@ Here's a Python example:
3636``` python
3737import example_robot_data as erd
3838import pinocchio as pin
39- import numpy as np
40- from candlewick.multibody import Visualizer, VisualizerConfig
39+ from candlewick import Visualizer, VisualizerConfig, create_recorder_context
4140
4241robot = erd.load(" ur10" )
4342model: pin.Model = robot.model
44- data: pin.Data = robot.data
45- visual_model = robot.visual_model
43+ visual_model: pin.GeometryModel = robot.visual_model
4644
4745config = VisualizerConfig()
4846config.width = 1280
4947config.height = 720
5048viz = Visualizer(config, model, visual_model)
5149
5250q0 = pin.neutral(model)
53- viz.setCameraPose(pin.SE3 .Identity())
54- viz.display(q0)
51+ viz.addFrameViz(model.getFrameId(" tool0" ))
52+
53+ with create_recorder_context(viz, " ur10_video.mp4" ):
54+ while not viz.shouldExit:
55+ viz.display(q0)
5556```
5657
5758
Original file line number Diff line number Diff line change 1010visual_model = robot .visual_model
1111
1212config = VisualizerConfig ()
13- config .width = 1280
14- config .height = 720
13+ config .width = 1920
14+ config .height = 1080
1515viz = Visualizer (config , model , visual_model )
1616
17- print (
18- "Visualizer has renderer:" ,
19- viz .renderer ,
20- "driver name:" ,
21- viz .renderer .device .driverName (),
22- )
23-
2417q0 = pin .neutral (model )
2518q1 = pin .randomConfiguration (model )
2619
2720t = 0.0
2821dt = 0.02
29- M = pin .SE3 .Identity ()
30- ee_name = "ee_link"
31- ee_id = model .getFrameId (ee_name )
32- print (viz .model )
22+ viz .addFrameViz (frame_id = model .getFrameId ("ee_link" ))
3323
34- for i in range (1000 ):
24+ i = 0
25+ while not viz .shouldExit and i < 1000 :
3526 alpha = np .sin (t )
3627 q = pin .interpolate (model , q0 , q1 , alpha )
3728 pin .framesForwardKinematics (model , data , q )
38- M = data .oMf [ee_id ]
39- if viz .shouldExit :
40- break
4129 viz .display (q )
4230 time .sleep (dt )
4331 t += dt
32+ i += 1
You can’t perform that action at this time.
0 commit comments