crocoddyl
crocoddyl copied to clipboard
Improve display in gepetto-viewer and create function for recording videos
In GitLab by @cmastalli on Apr 18, 2019, 10:18
There is a list of things that we should improve:
- Changed background from blue to white.
- Create a function that saves properly the frame and make a video. Using the record button in GV gui renders videos that aren't consistent with time.
-
displayTrajectory
might be use a stack of robots. This will render multiple robots and trajectories.
In GitLab by @nmansard on Apr 18, 2019, 10:53
- should be discussed in GV, not here. We should not impose a particular image style atop GV in crocoddyl.
- good point. Do you now that Steve did some work to automatically produce Blender videos?
- I don't understand.
In GitLab by @cmastalli on Apr 18, 2019, 11:03
displayTrajectory
can only display one robot. It displays the entire motion for a single robot. If you want to display more than one robot you need to do something like this:
def displayTrajectory(robots, Xs, dt=0.1):
""" Display a robot trajectory xs using Gepetto-viewer gui.
:param robots: set of Robot wrappers
:param xs: set of state trajectory
:param dt: step duration
:param rate: visualization rate
:param cameraTF: camera transform
"""
if not hasattr(robot, 'viewer'):
for r in robots:
r.initDisplay(loadModel=True)
import numpy as np
def a2m(a):
return np.matrix(a).T
import time
length_traj = len(Xs[0]) # assert this for each case
for i in range(length_traj):
for r, robot in enumerate(robots):
x = Xs[r][i]
robot.display(a2m(x[:robot.nq]))
time.sleep(dt)
This kind of code is needed if you want to do something like this: https://youtu.be/C0h-NLdMVuc
In GitLab by @cmastalli on Apr 18, 2019, 11:08
I forgot to include an option to add a floor.
Do you think we need to request this stuff in GV? I was thinking that Crocoddyl should have its own GUI wrapper that displays the robot (and sets up background and floor) and remove RobotWrapper dependency.