Drake deploy

This is recording the drake deployment on the office ubuntu 20.04.

The default python version is 3.8 in ubuntu 20.04, with a default pip version 20.02. The pip drake installation natualy requires pip version>= 20.3. Upgrade pip by python -m pip install --upgrade pip

It seems that the drake installation in python3.7 doesn't support Parser.AddModelsXX, but only support Parser.AddModelFromFile. The latter function encounter troubles when importing urdf files.
The visualization method RenderDiagram is from another package manipulation. And the function requires the package installed in at least python>3.8, here I choose python3.10.

Setting env for ipynb in vscode

Set venv for the current fold for vscode: go to a python file and choose the env in the right bottom corner by click.
Set venv for ipynb: go to the ipynb and the env in the last step is recognized in the slector.

drake simulation and animation

X axis -- red
Y axis -- green
Z aixs -- blue

add models from Parser(plant) to the diagram. But the simulator uses dynamic simulation so the continuum robot swings under gravity.
Try to use steps in simulator and SetPositions() or plant.get_actuation_input_port().FixValue() to control the robot.

IRIS for vascular and PCC.

When refering to the original code in the gcs-science-robotics. The environment obstacles are descripted by obj+mtl+png+sdf files. In the sdf file, collision geometries are created for every simple shape (box/ sphere) of the environment. This method would be hard to process the vascular.
In the HasCollisions function, the drake also uses the convex hull for collision check between meshes like in the matlab.
So it would be either to create a sdf file for the vascular or use a different collision check method.
Checking how the Iris and IrisInConfigurationSpace, it requires a vector of convex sets representing the occupied space. So the decomposed vascular is required.

IRIS algorithms
IrisInConfigurationSpace() (see gcs-SR) in drake works in the C-space and is actually a variation of the Iris. This function uses nonlinear optimization instead of convex optimization to find collisions in C-space.
CspaceFreePolytope() (see C-Iris IJRR) in drake uses polynomial optimization in Hongkai Dai* and Alexandre Amice* and Peter Werner and Annan Zhang and Russ Tedrake, "Certified Polyhedral Decompositions of Collision-Free Configuration Space".
ref:
Using nonlinear programming (NP). In the IRIS-NP algorithm [20] (implemented in Drake), we replace the convex optimization for finding the closest collision with a nonlinear optimization solver like SNOPT. We randomly sample potential collisions in order to make the algorithm probabilistically sound; in practice this algorithm is relatively fast but does not guarantee that the region is completely collision free.
Using algebraic kinematics + sums-of-squares optimization. Leveraging the idea that the kinematics of most of our robots can be expressed using (rational) polynomials, we can use tools from polynomial optimization to search for rigorous certificates of non-collision [21] (implemented in Drake). This method tends to be slower, but the results are sound. The one sacrifice that we have to make here is that we find convex regions in the stereographic projection coordinates of the original space. In practice, this represents a slight warping of the coordinate system (and consequently a trajectory length) over the region.
How to visualize vascular model in drake?

? how to add model in stl/obj/pts format
use DrakeVisualizer
MeshcatPointCloudVisualizer

process with vascular model

using V-HACD to turn the original file to decomp_vas.obj

Geometry Queries and roles help define how a real-world object is modeled in Drake (look for Drake-Modules-Geometric Representations).
--Proximity role for collision/ distance detection used in used in motion planning and the generation of contact forces.
--Perception role for sensor simulation.
--Illustration role for external visualization.

The RationalForwardKinematics() will likely handle the forward kinematics.