Gazebo simulation joint motion control and lightning protection

Attach a tutorial link: Carousel

Mainly want to talk about the pit I stepped on ... and the solution

Because I was unfamiliar with the meaning of the code, I changed the program blindly, and changed a lot of things that did not need to be changed:

E.g

<gazebo>
      <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
         <robotNamespace>/swivel</robotNamespace>
        <controlPeriod>0.01</controlPeriod>
        <robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
      </plugin>
    </gazebo>

In the robotnamespace on the third line, I changed it to the name of my package, but because I always used his swivel name when configuring the yaml file, it led to an error in the later step of running the launch, and the controller was not found ... After careful pondering, I discovered that something might be wrong here.

If you directly join gazebo in the tutorial, you will report an error when running the launch (no screenshots). Although it does not affect the use, in case, it is necessary to add the line of true code as follows:

 <gazebo>
      <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
         <robotNamespace>/swivel</robotNamespace>
        <controlPeriod>0.01</controlPeriod>
        <robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
        <legacyModeNS>true</legacyModeNS>
      </plugin>

Then configure the yaml file, the space must correspond to the robotnamespace! ! ! !

The main note of the launch file is the address problem!

Even the empty world of gazebo should be changed to your own file address, and the correct name must be written when loading the controller! !

Then run the launch file, you will find that there are many warns, one of which is Controller Spawner couldn't find the expected controller_manager ROS interface.
Explain that something is missing:

执行sudo apt-get install ros-kinetic-gazebo-ros-control

然后如果还不行,估计还是缺东西:

分别执行

rospack find effort_controllers

rospack find joint_state_controller

这两个命令,大概率是找不到目标文件,然后下载一下

 sudo apt-get install ros-kinetic-effort-controllers

sudo apt-get install ros-kinetic-joint-state-controller

Then you can control it!

The other poor performance may be the parameter problem in the xacro file.

Published 29 original articles · praised 0 · visits 482

Guess you like

Origin blog.csdn.net/qq_43771959/article/details/104610576