1313import rcs_panda
1414import requests
1515from dotenv import load_dotenv
16- from rcs_panda .utils import default_panda_hw_gripper_cfg
16+ from rcs_panda .utils import default_panda_hw_gripper_cfg , default_panda_hw_robot_cfg
1717from requests .packages import urllib3 # type: ignore[attr-defined]
1818from websockets .sync .client import connect
1919
20+ import rcs
21+
2022_logger = logging .getLogger ("desk" )
2123
2224TOKEN_PATH = "~/.rcs/token.conf"
@@ -47,10 +49,16 @@ def load_creds_franka_desk(postfix: str = "") -> tuple[str, str]:
4749
4850def home (ip : str , username : str , password : str , shut : bool , unlock : bool = False ):
4951 with Desk .fci (ip , username , password , unlock = unlock ):
50- f = rcs_panda .hw .Franka (ip )
51- config = rcs_panda .hw .PandaConfig ()
52- config .speed_factor = 0.2
53- f .set_config (config )
52+ robot_cfg = default_panda_hw_robot_cfg ()
53+ robot_cfg .tcp_offset = rcs .common .Pose (rcs .common .FrankaHandTCPOffset ())
54+ robot_cfg .speed_factor = 0.2
55+ ik = rcs .common .Pin (
56+ robot_cfg .kinematic_model_path ,
57+ robot_cfg .attachment_site ,
58+ urdf = robot_cfg .kinematic_model_path .endswith (".urdf" ),
59+ )
60+ f = rcs_panda .hw .Franka (ip , ik )
61+ f .set_config (robot_cfg )
5462 config_hand = rcs_panda .hw .FHConfig ()
5563 g = rcs_panda .hw .FrankaHand (ip , config_hand )
5664 if shut :
@@ -62,9 +70,16 @@ def home(ip: str, username: str, password: str, shut: bool, unlock: bool = False
6270
6371def info (ip : str , username : str , password : str , include_hand : bool = False ):
6472 with Desk .fci (ip , username , password ):
65- f = rcs_panda .hw .Franka (ip )
66- config = rcs_panda .hw .PandaConfig ()
67- f .set_config (config )
73+ robot_cfg = default_panda_hw_robot_cfg ()
74+ robot_cfg .tcp_offset = rcs .common .Pose (rcs .common .FrankaHandTCPOffset ())
75+ robot_cfg .speed_factor = 0.2
76+ ik = rcs .common .Pin (
77+ robot_cfg .kinematic_model_path ,
78+ robot_cfg .attachment_site ,
79+ urdf = robot_cfg .kinematic_model_path .endswith (".urdf" ),
80+ )
81+ f = rcs_panda .hw .Franka (ip , ik )
82+ f .set_config (robot_cfg )
6883 print ("Robot info:" )
6984 print ("Current cartesian position:" )
7085 print (f .get_cartesian_position ())
0 commit comments