Skip to content

Instantly share code, notes, and snippets.

@RyodoTanaka
Last active December 19, 2016 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RyodoTanaka/d633825b81f213c91489f8e8196607ca to your computer and use it in GitHub Desktop.
Save RyodoTanaka/d633825b81f213c91489f8e8196607ca to your computer and use it in GitHub Desktop.
Gazebo + ROS で自分だけのロボットをつくる 5. GazeboとROSの連携 ref: http://qiita.com/RyodoTanaka/items/6fa7e45f98b55376a95b
<launch>
<!-- Load joint controller configurations from YAML file to parameter server -->
<rosparam file="$(find fourth_robot_control)/config/controller.yaml" command="load"/>
<!-- load the controllers -->
<node name="controller_spawner" pkg="controller_manager"
type="spawner" ns="fourth_robot" output="screen"
args="joint_state_controller
diff_drive_controller"/>
<!-- convert joint states to TF transforms for rviz, etc -->
<node name="robot_state_publisher" pkg="robot_state_publisher"
type="robot_state_publisher"
respawn="false" output="screen" ns="/fourth_robot">
</node>
</launch>
fourth_robot:
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50
diff_drive_controller:
type : "diff_drive_controller/DiffDriveController"
left_wheel : 'left_wheel_joint'
right_wheel : 'right_wheel_joint'
publish_rate: 25.0 # default: 50
pose_covariance_diagonal : [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
twist_covariance_diagonal: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
# Wheel separation and diameter. These are both optional.
# diff_drive_controller will attempt to read either one or both from the
# URDF if not specified as a parameter
wheel_separation : 0.43515
wheel_radius : 0.032
# Wheel separation and radius multipliers
wheel_separation_multiplier: 1.0 # default: 1.0
<your_robot_name>_control
├── CMakeLists.txt
├── config
│   └── controller.yaml
├── launch
│   └── <your_robot_name>_control.launch
└── package.xml
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>fourth_robot</robotNamespace>
</plugin>
</gazebo>
<?xml version="1.0"?>
<package>
<name><your_robot_name>_control</name>
<version>1.0.0</version>
<description>The <your_robot_name>_control package</description>
<maintainer email="your@mail.com">YourName/maintainer>
<license>BSD</license>
<buildtool_depend>catkin</buildtool_depend>
<run_depend>controller_manager</run_depend>
<run_depend>actionlib</run_depend>
<run_depend>actionlib_msgs</run_depend>
<run_depend>control_msgs</run_depend>
<run_depend>sensor_msgs</run_depend>
<run_depend>robot_state_publisher</run_depend>
</package>
<?xml version="1.0"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:macro name="wheel_gazebo_v0" params="prefix">
<gazebo reference="${prefix}_wheel_link">
<selfCollide>true</selfCollide>
<mu1 value="0.8" />
<mu2 value="0.8" />
</gazebo>
</xacro:macro>
</robot>
<?xml version="1.0"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:macro name="wheel_trans_v0" params="prefix">
<transmission name="${prefix}_wheel_trans">
<type>transmission_interface/SimpleTransmission</type>
<joint name="${prefix}_wheel_joint">
<hardwareInterface>VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="${prefix}_wheel_motor">
<hardwareInterface>VelocityJointInterface</hardwareInterface>
<mechanicalReduction>30</mechanicalReduction>
</actuator>
</transmission>
</xacro:macro>
</robot>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment