ROS:【urdf】使用图形化界面控制joint时,摄像头抖动的问题【解决办法】

解决办法:将joint_state_publisher的那个节点删去或注释掉

我的错因(猜测):xml文件并不是从上到下执行代码,

                                如果先执行了joint_state_publisher_gui节点,摄像头就不会抖动,

                                因为你给摄像头确定的第一个状态 由控制joint的图形化界面中 滚动条的滚动决定,

                                而joint_state_publisher发布的第二个状态 就是 这第一个状态,所以摄像头只有一个状态,就不会抖动;

                                如果先执行了joint_state_publisher节点,摄像头就会抖动,

                                因为你首先给摄像头确定了一个状态,

                                当你用图形化界面控制摄像头旋转时,就相当于给了它另一个状态,然后摄像头就在两个状态之间反复横跳。

原代码

<launch>
  <!--urdf file-->
  <param name="robot_description" textfile="$(find learning_urdf)/urdf/urdf/joint.urdf" />
  <!--start rviz-->
  <node pkg="rviz" type="rviz" name="rviz" args="-d $(find learning_urdf)/config/show_mycar.rviz" />
  <!--start status publishing nodes-->
  <node pkg="joint_state_publisher" type="joint_state_publisher" name="joint_state_publisher" />
  <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" />
  <!--add joint controlling node-->
  <!--This node is used to check whether the joint runs correctly-->
  <node pkg="joint_state_publisher_gui" type="joint_state_publisher_gui" name="joint_state_publisher_gui" />

</launch>

修改之后的代码

<launch>
  <!--urdf file-->
  <param name="robot_description" textfile="$(find learning_urdf)/urdf/urdf/joint.urdf" />
  <!--start rviz-->
  <node pkg="rviz" type="rviz" name="rviz" args="-d $(find learning_urdf)/config/show_mycar.rviz" />
  <!--start status publishing nodes-->
  <!--删掉或者注释掉下面这行代码,我注释掉了-->
  <!--<node pkg="joint_state_publisher" type="joint_state_publisher" name="joint_state_publisher" />-->
  <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" />
  <!--add joint controlling node-->
  <!--This node is used to check whether the joint runs correctly-->
  <node pkg="joint_state_publisher_gui" type="joint_state_publisher_gui" name="joint_state_publisher_gui" />

</launch>

  • 10
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值