MingshanHe / Compliant-Control-and-Application

Compliant Control: 1) admittance control algorithm 2) impedance control algorithm 3) hybrid force&position algorithm in robotic arm (Universal Robot).
https://mingshanhe.github.io/Compliant-Control-and-Application/
MIT License
301 stars 62 forks source link

WrenchSignalGenerate.cpp 如何修改 Wrench #13

Closed YuHoChau closed 1 year ago

YuHoChau commented 1 year ago

您好: 十分感谢您的资料。我想请教一下如何在此文件中成功修改所模拟的虚拟wrench大小呢?我在原来的基础上进行了修改,例如: while (ros::ok()) { // wrench_msg.force.x = sin(t); // wrench_msg.force.y = sin(t); // wrench_msg.wrench.force.z = 5*sin(t); if(static_cast<int>(t)%10 < 5) { wrench_msg.wrench.force.x = 5; } else { wrench_msg.wrench.force.x = -5; } t += 1/TOPIC_HZ; wrench_pub.publish(wrench_msg); loop_rate.sleep(); } 但是在仿真中未能沿着力的方向(x)移动。另外想请教一下为何在rqt_plot中无法正确显示Wrench。非常感谢。(ROS Melodic + sim-devel branch) image

MingshanHe commented 1 year ago

你好, https://github.com/MingshanHe/Compliant-Control-and-Application/blob/sim-devel/control_algorithm/Admittance/src/WrenchSignalGenerate.cpp 该文件为生成虚拟力的文件 https://github.com/MingshanHe/Compliant-Control-and-Application/blob/sim-devel/control_algorithm/Admittance/launch/Admittance_test.launch 需要启动该文件,得到上面文件输出的数据

YuHoChau commented 1 year ago

你好, https://github.com/MingshanHe/Compliant-Control-and-Application/blob/sim-devel/control_algorithm/Admittance/src/WrenchSignalGenerate.cpp 该文件为生成虚拟力的文件 https://github.com/MingshanHe/Compliant-Control-and-Application/blob/sim-devel/control_algorithm/Admittance/launch/Admittance_test.launch 需要启动该文件,得到上面文件输出的数据

感谢回复,我的确启动了正确的launch文件(Admittance_test.launch),已经包含了启动WrenchSignalGenerate.cpp文件,但是该问题仍然无法解决;当我尝试修改虚拟wrench大小时无法正确仿真。请问可能存在哪些问题呢

MingshanHe commented 1 year ago
  1. 通过 ros topic 查看话题消息是否正确打印
  2. 通过 rqt graph 查看节点和话题是否正确连接
  3. 改用最新的noetic版本来验证main branch的代码 问题我确实不能帮你明确指出,我只能列出上述三个检查方式,来帮助你解决你的问题,Best wishes!
YuHoChau commented 1 year ago

Thanks a lot!

YuHoChau commented 1 year ago

你好,目前我在ROS Noetic上尝试了noetic branch的代码。具体而言我在虚拟机上重新安装了Ubuntu及ROS,并成功用catkin build编译。但是在我尝试roslaunch admittance Wrench_Fake.launch时仿真中的机器人保持在initial position不动。查看rqt_graph后似乎是节点与话题没有正确连接: 微信图片_20221019011528 由于初学ROS对如何debug还不太了解,能否提供配置环境的更多细节呢?(在两台电脑的虚拟机上都重复了以上步骤,并按照readme操作,仍然无法正常运行)。Thank you very much for your time!

MingshanHe commented 1 year ago

可能这个项目需要一些ROS基础来进行debug,主要就是查阅代码,如果能够花时间去了解代码的具体实现,我认为会更好一些。这个问题主要出现在节点之间topic通信上,所以可以着重从这个切入点入手解决,若是顺利,可以看到正常运行的效果,再进行代码剖析。

YuHoChau commented 1 year ago

感谢!

ConnorChungCN commented 1 year ago

感谢!

请问您是如何修改使wrench发挥作用的