Simon Danisch / Aug 06 2019

Walking Robot

Manifest.toml
Project.toml
isdir("robot") || mkdir("robot")
cp(
Project.toml
, "robot/Manifest.toml", force = true) cp(
Project.toml
, "robot/Project.toml", force = true)
"robot/Project.toml"
apt-get update
apt-get install libxml2 build-essential
]activate robot; instantiate; build
using LinearAlgebra, QPControl, RigidBodyDynamics, StaticArrays, AtlasRobot
using OSQP, DataStructures, QPWalkingControl, PlanarConvexHulls, Rotations
using RigidBodySim, MathOptInterface, MechanismGeometries
using GeometryTypes, AbstractPlotting, WGLMakie, FileIO, CoordinateTransformations
using RigidBodySim.Visualization: DiscreteCallback, u_modified!
using RigidBodyDynamics: PDControl, Contact
using OSQP.MathOptInterfaceOSQP: OSQPSettings
const MOI = MathOptInterface
MathOptInterface
isdir("robot") || mkdir("robot")
cp(
Project.toml
, "robot/Manifest.toml", force = true) cp(
Project.toml
, "robot/Project.toml", force = true)
"robot/Project.toml"
]activate robot
using LinearAlgebra, QPControl, RigidBodyDynamics, StaticArrays, AtlasRobot
using OSQP, DataStructures, QPWalkingControl, PlanarConvexHulls, Rotations
using RigidBodySim, MathOptInterface, MechanismGeometries
using GeometryTypes, AbstractPlotting, WGLMakie, FileIO, CoordinateTransformations
using RigidBodySim.Visualization: DiscreteCallback, u_modified!
using RigidBodyDynamics: PDControl, Contact
using OSQP.MathOptInterfaceOSQP: OSQPSettings
const MOI = MathOptInterface
meshload(x::MechanismGeometries.MeshFile) = load(x.filename, GLNormalUVMesh)
meshload(x::AbstractGeometry) = x
function to_transform(state, elem)
    trans = transform_to_root(state, elem.frame)
    affine = CoordinateTransformations.AffineMap(MechanismGeometries.rotation(trans), MechanismGeometries.translation(trans))
    t =  affine  elem.transform
    H = [
        transform_deriv(t, Vec(0., 0, 0)) t(Vec(0., 0, 0));
        Vec(0, 0, 0, 1)'
    ]
    return Mat4f0(H)
end
to_transform (generic function with 1 method)
mechanism = AtlasRobot.mechanism(add_flat_ground=true)
state = MechanismState(mechanism)
robot = visual_elements(
  mechanism,
  URDFVisuals(AtlasRobot.urdfpath(),
    package_path=[AtlasRobot.packagepath()])
)
scene = Scene(show_axis = false)
parts = map(robot) do elem
  m = meshload(elem.geometry)
  mesh!(scene, m, color = elem.color, model = to_transform(state, elem))[end]
end
scene
snoop.jl
]activate robot
using PackageCompiler
PackageCompiler.snoop(
snoop.jl
, "/results/precompiles.jl", verbose = true)
precompiles.jl
syso, sysold = PackageCompiler.compile_incremental(
precompiles.jl
)
("/root/.julia/packages/PackageCompiler/sTrwT/sysimg/sys.so", "/usr/local/julia/lib/julia/sys.so")
cp(syso, sysold, force = true)
"/usr/local/julia/lib/julia/sys.so"