Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

控制实物机械臂中代码理解 #5

Open
duidui6666 opened this issue May 29, 2024 · 6 comments
Open

控制实物机械臂中代码理解 #5

duidui6666 opened this issue May 29, 2024 · 6 comments

Comments

@duidui6666
Copy link

------------- Button Features -------------

            current_button = [sm.is_button_pressed(0), sm.is_button_pressed(1)]
            if not is_recording and current_button[0]:
                # Start recording
                env.start_episode(
                    t_start + (iter_idx + 2) * dt - time.monotonic() + time.time()
                )
                key_counter.clear()
                is_recording = True
                cprint("Recording!", on_color="on_green")

                timer.start()
                cprint("Timer start!", on_color="on_blue")

            if current_button[1] and not last_button[1]:
                G_target_pose = 1 ^ G_target_pose
            last_button = current_button

你好,请问这段代码中的开始记录与前面按下按键开始记录有什么不同嘛,为什么要开始记录两次?以及后面代码所提到的delta_actions是有什么用嘛?不太理解delta_actions与actions之间的差异,看UR5中只有action,我也正在尝试将扩散模型中的ss RTDEInterpolationControl迁移至自己所使用的机械臂上,但发现我没有UR5的rtde中所提到的getTargetTCPPose等目标状态的接口,想请问rtde中关键词可以只获得当前的末端的xyz和rpy以及关节角度嘛?如果这样更改的话还可以使用UR5的训练配置嘛?想请问您是如何做的呢

@chadwick-yao
Copy link
Owner

没有不同,我这里使用spacemouse来开始是考虑到如果你用键盘开始然后用spacemouse控制中间是由一段静止的间隙的,如果操作都在spacemouse上就不会有这个问题。这两种方式都可以开始推断,没有冲突。
delta_action是spacemouse的输出,因为你使用spacemouse来控制无法表示末端的绝对控制位置。
最后一个问题要看你机械臂配用的什么API,用提供的API替换就好。

@duidui6666
Copy link
Author

好的好的,非常感谢您

@duidui6666
Copy link
Author

还有一个小小的疑惑,可以请问一下KUKA中对应于执行运动的函数是在哪里调用的呢?类似与ur中的rtde_c.servoL(pose_command,
vel, acc, # dummy, not used by ur5
dt,
self.lookahead_time,
self.gain)

@duidui6666
Copy link
Author

请问您有遇到过这个问题吗
Traceback (most recent call last):
File "/home/Downloads/diffusion_policy-main2/diffusion_policy-main/demo_real_robot.py", line 85, in main
obs = env.get_obs()
File "/home/Downloads/diffusion_policy-main2/diffusion_policy-main/diffusion_policy/real_world/real_env.py", line 272, in get_obs
assert self.is_ready
AssertionError

@chadwick-yao
Copy link
Owner

请问您有遇到过这个问题吗 Traceback (most recent call last): File "/home/Downloads/diffusion_policy-main2/diffusion_policy-main/demo_real_robot.py", line 85, in main obs = env.get_obs() File "/home/Downloads/diffusion_policy-main2/diffusion_policy-main/diffusion_policy/real_world/real_env.py", line 272, in get_obs assert self.is_ready AssertionError

这应该是你的一些线程没有start,你可以确认相机或者其他的线程能够正常运行。

@duidui6666
Copy link
Author

我检查发现是我的机器人线程没有启动,请问是如何确认机器人线程启动的呢?查看代码看到
def is_ready(self):
return self.ready_event.is_set()
在机器人定义中这个返回一直是False,但运行代码时,我的机器人是完成了上电、使能的初始化工作,请问如何确认机器人线程启动呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants