# Third Party
import torch
# cuRobo
from curobo.cuda_robot_model.cuda_robot_model import CudaRobotModel, CudaRobotModelConfig
from curobo.types.base import TensorDeviceType
from curobo.types.robot import RobotConfig
from curobo.util_file import get_robot_path, join_path, load_yaml
# convenience function to store tensor type and device
tensor_args = TensorDeviceType()
# this example loads urdf from a configuration file, you can also load from path directly
# load a urdf, the base frame and the end-effector frame:
config_file = load_yaml(join_path(get_robot_path(), "franka.yml"))
urdf_file = config_file["robot_cfg"]["kinematics"][
"urdf_path"
] # Send global path starting with "/"
base_link = config_file["robot_cfg"]["kinematics"]["base_link"]
ee_link = config_file["robot_cfg"]["kinematics"]["ee_link"]
# Generate robot configuration from urdf path, base frame, end effector frame
robot_cfg = RobotConfig.from_basic(urdf_file, base_link, ee_link, tensor_args)
kin_model = CudaRobotModel(robot_cfg.kinematics)
# compute forward kinematics:
# torch random sampling might give values out of joint limits
q = torch.rand((10, kin_model.get_dof()), **vars(tensor_args))
out = kin_model.get_state(q)
Error:
File "test_fk.py", line 20, in <module>
q = torch.rand((10, kin_model.get_dof()), **vars(tensor_args))
TypeError: rand() received an invalid combination of arguments - got (tuple, collision_distance_dtype=torch.dtype, collision_gradient_dtype=torch.dtype, collision_geometry_dtype=torch.dtype, dtype=torch.dtype, device=torch.device), but expected one of:
* (tuple of ints size, *, torch.Generator generator, tuple of names names, torch.dtype dtype, torch.layout layout, torch.device device, bool pin_memory, bool requires_grad)
* (tuple of ints size, *, torch.Generator generator, Tensor out, torch.dtype dtype, torch.layout layout, torch.device device, bool pin_memory, bool requires_grad)
* (tuple of ints size, *, Tensor out, torch.dtype dtype, torch.layout layout, torch.device device, bool pin_memory, bool requires_grad)
* (tuple of ints size, *, tuple of names names, torch.dtype dtype, torch.layout layout, torch.device device, bool pin_memory, bool requires_grad)
Small documentation issues for the getting started that could be improved here, since it doesn't "just work" as it is currently written: https://curobo.org/get_started/2a_python_examples.html
Forward Kinematics
Given example code:
Error:
Required change:
Replace this:
With this:
Should make this change to all examples with var(tensor_args) used in this way (there's another one in forward kinematics)
Collision Checking
Example:
Error:
Simply need to change
world_file
toworld_cfg
Motion Generation
Example:
Error:
Need to add
import torch
at the topAlso
I believe this is a bit misleading. The dt in traj is now not
result.optimized_dt
, butresult.interpolation_dt
.Issue Details