Compare commits
5 Commits
eab17cb00d
...
214e49425f
| Author | SHA1 | Date |
|---|---|---|
|
|
214e49425f | |
|
|
acf67fbc0d | |
|
|
145bf17cb7 | |
|
|
7160ce6809 | |
|
|
b19f23ac71 |
|
|
@ -0,0 +1 @@
|
|||
# This file currently only serves to mark the location of a catkin workspace for tool integration
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"browse": {
|
||||
"databaseFilename": "${default}",
|
||||
"limitSymbolsToIncludedHeaders": false
|
||||
},
|
||||
"includePath": [
|
||||
"/opt/ros/noetic/include/**",
|
||||
"/home/sasu/kubot_ws/src/kubot_description/include/**",
|
||||
"/usr/include/**"
|
||||
],
|
||||
"name": "ROS",
|
||||
"intelliSenseMode": "gcc-x64",
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "gnu11",
|
||||
"cppStandard": "c++14"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"python.autoComplete.extraPaths": [
|
||||
"/opt/ros/noetic/lib/python3/dist-packages"
|
||||
],
|
||||
"python.analysis.extraPaths": [
|
||||
"/opt/ros/noetic/lib/python3/dist-packages"
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"browse": {
|
||||
"databaseFilename": "${default}",
|
||||
"limitSymbolsToIncludedHeaders": false
|
||||
},
|
||||
"includePath": [
|
||||
"/opt/ros/noetic/include/**",
|
||||
"/home/hour/turtlebot_wc/src/turtlebot3_simulations/turtlebot3_fake/include/**",
|
||||
"/home/hour/turtlebot_wc/src/turtlebot3_simulations/turtlebot3_gazebo/include/**",
|
||||
"/home/hour/turtlebot_wc/src/turtlebot_controller/include/**",
|
||||
"/usr/include/**"
|
||||
],
|
||||
"name": "ROS",
|
||||
"intelliSenseMode": "gcc-x64",
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "gnu11",
|
||||
"cppStandard": "c++14"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"python.autoComplete.extraPaths": [
|
||||
"/opt/ros/noetic/lib/python3/dist-packages"
|
||||
],
|
||||
"python.analysis.extraPaths": [
|
||||
"/opt/ros/noetic/lib/python3/dist-packages"
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
/opt/ros/noetic/share/catkin/cmake/toplevel.cmake
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
cmake_minimum_required(VERSION 3.0.2)
|
||||
project(imu)
|
||||
|
||||
## Compile as C++11, supported in ROS Kinetic and newer
|
||||
# add_compile_options(-std=c++11)
|
||||
|
||||
## Find catkin macros and libraries
|
||||
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
|
||||
## is used, also find other catkin packages
|
||||
find_package(catkin REQUIRED COMPONENTS
|
||||
rospy
|
||||
sensor_msgs
|
||||
std_msgs
|
||||
)
|
||||
|
||||
## System dependencies are found with CMake's conventions
|
||||
# find_package(Boost REQUIRED COMPONENTS system)
|
||||
|
||||
|
||||
## Uncomment this if the package has a setup.py. This macro ensures
|
||||
## modules and global scripts declared therein get installed
|
||||
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
|
||||
# catkin_python_setup()
|
||||
|
||||
################################################
|
||||
## Declare ROS messages, services and actions ##
|
||||
################################################
|
||||
|
||||
## To declare and build messages, services or actions from within this
|
||||
## package, follow these steps:
|
||||
## * Let MSG_DEP_SET be the set of packages whose message types you use in
|
||||
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
|
||||
## * In the file package.xml:
|
||||
## * add a build_depend tag for "message_generation"
|
||||
## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
|
||||
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
|
||||
## but can be declared for certainty nonetheless:
|
||||
## * add a exec_depend tag for "message_runtime"
|
||||
## * In this file (CMakeLists.txt):
|
||||
## * add "message_generation" and every package in MSG_DEP_SET to
|
||||
## find_package(catkin REQUIRED COMPONENTS ...)
|
||||
## * add "message_runtime" and every package in MSG_DEP_SET to
|
||||
## catkin_package(CATKIN_DEPENDS ...)
|
||||
## * uncomment the add_*_files sections below as needed
|
||||
## and list every .msg/.srv/.action file to be processed
|
||||
## * uncomment the generate_messages entry below
|
||||
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
|
||||
|
||||
## Generate messages in the 'msg' folder
|
||||
# add_message_files(
|
||||
# FILES
|
||||
# Message1.msg
|
||||
# Message2.msg
|
||||
# )
|
||||
|
||||
## Generate services in the 'srv' folder
|
||||
# add_service_files(
|
||||
# FILES
|
||||
# Service1.srv
|
||||
# Service2.srv
|
||||
# )
|
||||
|
||||
## Generate actions in the 'action' folder
|
||||
# add_action_files(
|
||||
# FILES
|
||||
# Action1.action
|
||||
# Action2.action
|
||||
# )
|
||||
|
||||
## Generate added messages and services with any dependencies listed here
|
||||
# generate_messages(
|
||||
# DEPENDENCIES
|
||||
# sensor_msgs# std_msgs
|
||||
# )
|
||||
|
||||
################################################
|
||||
## Declare ROS dynamic reconfigure parameters ##
|
||||
################################################
|
||||
|
||||
## To declare and build dynamic reconfigure parameters within this
|
||||
## package, follow these steps:
|
||||
## * In the file package.xml:
|
||||
## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
|
||||
## * In this file (CMakeLists.txt):
|
||||
## * add "dynamic_reconfigure" to
|
||||
## find_package(catkin REQUIRED COMPONENTS ...)
|
||||
## * uncomment the "generate_dynamic_reconfigure_options" section below
|
||||
## and list every .cfg file to be processed
|
||||
|
||||
## Generate dynamic reconfigure parameters in the 'cfg' folder
|
||||
# generate_dynamic_reconfigure_options(
|
||||
# cfg/DynReconf1.cfg
|
||||
# cfg/DynReconf2.cfg
|
||||
# )
|
||||
|
||||
###################################
|
||||
## catkin specific configuration ##
|
||||
###################################
|
||||
## The catkin_package macro generates cmake config files for your package
|
||||
## Declare things to be passed to dependent projects
|
||||
## INCLUDE_DIRS: uncomment this if your package contains header files
|
||||
## LIBRARIES: libraries you create in this project that dependent projects also need
|
||||
## CATKIN_DEPENDS: catkin_packages dependent projects also need
|
||||
## DEPENDS: system dependencies of this project that dependent projects also need
|
||||
catkin_package(
|
||||
# INCLUDE_DIRS include
|
||||
# LIBRARIES imu
|
||||
# CATKIN_DEPENDS rospy sensor_msgs std_msgs
|
||||
# DEPENDS system_lib
|
||||
)
|
||||
|
||||
###########
|
||||
## Build ##
|
||||
###########
|
||||
|
||||
## Specify additional locations of header files
|
||||
## Your package locations should be listed before other locations
|
||||
include_directories(
|
||||
# include
|
||||
${catkin_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
## Declare a C++ library
|
||||
# add_library(${PROJECT_NAME}
|
||||
# src/${PROJECT_NAME}/imu.cpp
|
||||
# )
|
||||
|
||||
## Add cmake target dependencies of the library
|
||||
## as an example, code may need to be generated before libraries
|
||||
## either from message generation or dynamic reconfigure
|
||||
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
|
||||
|
||||
## Declare a C++ executable
|
||||
## With catkin_make all packages are built within a single CMake context
|
||||
## The recommended prefix ensures that target names across packages don't collide
|
||||
# add_executable(${PROJECT_NAME}_node src/imu_node.cpp)
|
||||
|
||||
## Rename C++ executable without prefix
|
||||
## The above recommended prefix causes long target names, the following renames the
|
||||
## target back to the shorter version for ease of user use
|
||||
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
|
||||
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
|
||||
|
||||
## Add cmake target dependencies of the executable
|
||||
## same as for the library above
|
||||
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
|
||||
|
||||
## Specify libraries to link a library or executable target against
|
||||
# target_link_libraries(${PROJECT_NAME}_node
|
||||
# ${catkin_LIBRARIES}
|
||||
# )
|
||||
|
||||
#############
|
||||
## Install ##
|
||||
#############
|
||||
|
||||
# all install targets should use catkin DESTINATION variables
|
||||
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
|
||||
|
||||
## Mark executable scripts (Python etc.) for installation
|
||||
## in contrast to setup.py, you can choose the destination
|
||||
# catkin_install_python(PROGRAMS
|
||||
# scripts/my_python_script
|
||||
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
# )
|
||||
|
||||
## Mark executables for installation
|
||||
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
|
||||
# install(TARGETS ${PROJECT_NAME}_node
|
||||
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
# )
|
||||
|
||||
## Mark libraries for installation
|
||||
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
|
||||
# install(TARGETS ${PROJECT_NAME}
|
||||
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
# RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
|
||||
# )
|
||||
|
||||
## Mark cpp header files for installation
|
||||
# install(DIRECTORY include/${PROJECT_NAME}/
|
||||
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
|
||||
# FILES_MATCHING PATTERN "*.h"
|
||||
# PATTERN ".svn" EXCLUDE
|
||||
# )
|
||||
|
||||
## Mark other files for installation (e.g. launch and bag files, etc.)
|
||||
# install(FILES
|
||||
# # myfile1
|
||||
# # myfile2
|
||||
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
|
||||
# )
|
||||
|
||||
#############
|
||||
## Testing ##
|
||||
#############
|
||||
|
||||
## Add gtest based cpp test target and link libraries
|
||||
# catkin_add_gtest(${PROJECT_NAME}-test test/test_imu.cpp)
|
||||
# if(TARGET ${PROJECT_NAME}-test)
|
||||
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
|
||||
# endif()
|
||||
|
||||
## Add folders to be run by python nosetests
|
||||
# catkin_add_nosetests(test)
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
<?xml version="1.0"?>
|
||||
<package format="2">
|
||||
<name>imu</name>
|
||||
<version>0.0.0</version>
|
||||
<description>The imu package</description>
|
||||
|
||||
<!-- One maintainer tag required, multiple allowed, one person per tag -->
|
||||
<!-- Example: -->
|
||||
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
|
||||
<maintainer email="hour@todo.todo">hour</maintainer>
|
||||
|
||||
|
||||
<!-- One license tag required, multiple allowed, one license per tag -->
|
||||
<!-- Commonly used license strings: -->
|
||||
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
|
||||
<license>TODO</license>
|
||||
|
||||
|
||||
<!-- Url tags are optional, but multiple are allowed, one per tag -->
|
||||
<!-- Optional attribute type can be: website, bugtracker, or repository -->
|
||||
<!-- Example: -->
|
||||
<!-- <url type="website">http://wiki.ros.org/imu</url> -->
|
||||
|
||||
|
||||
<!-- Author tags are optional, multiple are allowed, one per tag -->
|
||||
<!-- Authors do not have to be maintainers, but could be -->
|
||||
<!-- Example: -->
|
||||
<!-- <author email="jane.doe@example.com">Jane Doe</author> -->
|
||||
|
||||
|
||||
<!-- The *depend tags are used to specify dependencies -->
|
||||
<!-- Dependencies can be catkin packages or system dependencies -->
|
||||
<!-- Examples: -->
|
||||
<!-- Use depend as a shortcut for packages that are both build and exec dependencies -->
|
||||
<!-- <depend>roscpp</depend> -->
|
||||
<!-- Note that this is equivalent to the following: -->
|
||||
<!-- <build_depend>roscpp</build_depend> -->
|
||||
<!-- <exec_depend>roscpp</exec_depend> -->
|
||||
<!-- Use build_depend for packages you need at compile time: -->
|
||||
<!-- <build_depend>message_generation</build_depend> -->
|
||||
<!-- Use build_export_depend for packages you need in order to build against this package: -->
|
||||
<!-- <build_export_depend>message_generation</build_export_depend> -->
|
||||
<!-- Use buildtool_depend for build tool packages: -->
|
||||
<!-- <buildtool_depend>catkin</buildtool_depend> -->
|
||||
<!-- Use exec_depend for packages you need at runtime: -->
|
||||
<!-- <exec_depend>message_runtime</exec_depend> -->
|
||||
<!-- Use test_depend for packages you need only for testing: -->
|
||||
<!-- <test_depend>gtest</test_depend> -->
|
||||
<!-- Use doc_depend for packages you need only for building documentation: -->
|
||||
<!-- <doc_depend>doxygen</doc_depend> -->
|
||||
<buildtool_depend>catkin</buildtool_depend>
|
||||
<build_depend>rospy</build_depend>
|
||||
<build_depend>sensor_msgs</build_depend>
|
||||
<build_depend>std_msgs</build_depend>
|
||||
<build_export_depend>rospy</build_export_depend>
|
||||
<build_export_depend>sensor_msgs</build_export_depend>
|
||||
<build_export_depend>std_msgs</build_export_depend>
|
||||
<exec_depend>rospy</exec_depend>
|
||||
<exec_depend>sensor_msgs</exec_depend>
|
||||
<exec_depend>std_msgs</exec_depend>
|
||||
|
||||
|
||||
<!-- The export tag contains other, unspecified, tags -->
|
||||
<export>
|
||||
<!-- Other tools can request additional information be placed here -->
|
||||
|
||||
</export>
|
||||
</package>
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import rospy
|
||||
from geometry_msgs.msg import Quaternion
|
||||
from sensor_msgs.msg import Imu, MagneticField
|
||||
from std_msgs.msg import Header
|
||||
import serial
|
||||
import math
|
||||
import json
|
||||
|
||||
class IMUPublisher:
|
||||
def __init__(self):
|
||||
rospy.init_node('arduino_serial_reader')
|
||||
self.serial_port = '/dev/ttyACM0'
|
||||
self.baud_rate = 115200
|
||||
|
||||
self.publisher_mag = rospy.Publisher('/imu/mag', MagneticField, queue_size=10)
|
||||
self.publisher_imu = rospy.Publisher('/imu/imu', Imu, queue_size=10)
|
||||
|
||||
self.timer = rospy.Timer(rospy.Duration(1/100), self.publish_magnet)
|
||||
self.timer = rospy.Timer(rospy.Duration(1/100), self.publish_imu)
|
||||
self.timer = rospy.Timer(rospy.Duration(1/100), self.read_serial_data)
|
||||
|
||||
self.mag = MagneticField()
|
||||
self.imu = Imu()
|
||||
|
||||
self.qx = 0.0
|
||||
self.qy = 0.0
|
||||
self.qz = 0.0
|
||||
self.qw = 0.0
|
||||
self.euler_roll = 0.0
|
||||
self.euler_pitch = 0.0
|
||||
self.euler_yaw = 0.0
|
||||
self.angular_vel_x = 0.0
|
||||
self.angular_vel_y = 0.0
|
||||
self.angular_vel_z = 0.0
|
||||
self.linear_accel_x = 0.0
|
||||
self.linear_accel_y = 0.0
|
||||
self.linear_accel_z = 0.0
|
||||
self.magnetometer_x = 0.0
|
||||
self.magnetometer_y = 0.0
|
||||
self.magnetometer_z = 0.0
|
||||
|
||||
try:
|
||||
self.ser = serial.Serial(self.serial_port, self.baud_rate)
|
||||
rospy.loginfo("Serial port opened: %s", self.serial_port)
|
||||
except serial.SerialException:
|
||||
rospy.logerr("Failed to open serial port. Make sure it's correct and not already in use.")
|
||||
return
|
||||
|
||||
def read_serial_data(self, event):
|
||||
if self.ser.is_open:
|
||||
try:
|
||||
received_data = self.ser.read_until(b'\n').decode('utf-8')
|
||||
try:
|
||||
data_dict = json.loads(received_data)
|
||||
self.process_data(data_dict)
|
||||
except json.JSONDecodeError:
|
||||
rospy.logerr("Error decoding JSON data.")
|
||||
except UnicodeDecodeError:
|
||||
rospy.logerr("Error decoding received data.")
|
||||
else:
|
||||
rospy.logwarn("Serial port is not open.")
|
||||
|
||||
def process_data(self, data_dict):
|
||||
if "A" in data_dict:
|
||||
euler_data = data_dict["A"]
|
||||
self.euler_roll = euler_data[0]
|
||||
self.euler_pitch = euler_data[1]
|
||||
self.euler_yaw = euler_data[2]
|
||||
rospy.loginfo("Euler Angle: euler_roll=%.2f, euler_pitch=%.2f, euler_yaw=%.2f", self.euler_roll, self.euler_pitch, self.euler_yaw)
|
||||
|
||||
if "G" in data_dict:
|
||||
angular_vel_data = data_dict["G"]
|
||||
self.angular_vel_x = angular_vel_data[0]
|
||||
self.angular_vel_y = angular_vel_data[1]
|
||||
self.angular_vel_z = angular_vel_data[2]
|
||||
rospy.loginfo("Angular Velocity: X=%.2f, Y=%.2f, Z=%.2f", self.angular_vel_x, self.angular_vel_y, self.angular_vel_z)
|
||||
|
||||
if "L" in data_dict:
|
||||
linear_accel_data = data_dict["L"]
|
||||
self.linear_accel_x = linear_accel_data[0]
|
||||
self.linear_accel_y = linear_accel_data[1]
|
||||
self.linear_accel_z = linear_accel_data[2]
|
||||
rospy.loginfo("Linear Acceleration: X=%.2f, Y=%.2f, Z=%.2f", self.linear_accel_x, self.linear_accel_y, self.linear_accel_z)
|
||||
|
||||
if "M" in data_dict:
|
||||
magnetometer_data = data_dict["M"]
|
||||
self.magnetometer_x = magnetometer_data[0]
|
||||
self.magnetometer_y = magnetometer_data[1]
|
||||
self.magnetometer_z = magnetometer_data[2]
|
||||
rospy.loginfo("Magnetometer: X=%.2f, Y=%.2f, Z=%.2f", self.magnetometer_x, self.magnetometer_y, self.magnetometer_z)
|
||||
|
||||
def euler_to_quaternion(self):
|
||||
sr = math.sin(math.radians(self.euler_roll) /2)
|
||||
cr = math.cos(math.radians(self.euler_roll) /2)
|
||||
sp = math.sin(math.radians(self.euler_pitch)/2)
|
||||
cp = math.cos(math.radians(self.euler_pitch)/2)
|
||||
sy = math.sin(math.radians(self.euler_yaw) /2)
|
||||
cy = math.cos(math.radians(self.euler_yaw) /2)
|
||||
|
||||
self.qw = cy * cp * cr + sy * sp * sr
|
||||
self.qx = cy * cp * sr - sy * sp * cr
|
||||
self.qy = sy * cp * sr + cy * sp * cr
|
||||
self.qz = sy * cp * cr - cy * sp * sr
|
||||
|
||||
def publish_imu(self, event):
|
||||
self.imu.header = Header()
|
||||
self.imu.header.frame_id = "base_link"
|
||||
self.imu.header.stamp = rospy.Time.now()
|
||||
|
||||
self.euler_to_quaternion()
|
||||
self.imu.orientation.x = self.qx
|
||||
self.imu.orientation.y = self.qy
|
||||
self.imu.orientation.z = self.qz
|
||||
self.imu.orientation.w = self.qw
|
||||
self.imu.orientation_covariance = [
|
||||
0.0159, 0.0, 0.0,
|
||||
0.0, 0.0159, 0.0,
|
||||
0.0, 0.0, 0.0159]
|
||||
rospy.loginfo("Orientation: qx=%.2f, qy=%.2f, qz=%.2f, qw=%.2f", self.imu.orientation.x, self.imu.orientation.y, self.imu.orientation.z, self.imu.orientation.w)
|
||||
|
||||
self.imu.angular_velocity.x = float(self.angular_vel_x)
|
||||
self.imu.angular_velocity.y = float(self.angular_vel_y)
|
||||
self.imu.angular_velocity.z = float(self.angular_vel_z)
|
||||
self.imu.angular_velocity_covariance = [
|
||||
0.04, 0.0, 0.0,
|
||||
0.0, 0.04, 0.0,
|
||||
0.0, 0.0, 0.04]
|
||||
rospy.loginfo("Angular Velocity: X=%.2f, Y=%.2f, Z=%.2f", self.imu.angular_velocity.x, self.imu.angular_velocity.y, self.imu.angular_velocity.z)
|
||||
|
||||
self.imu.linear_acceleration.x = float(self.linear_accel_x)
|
||||
self.imu.linear_acceleration.y = float(self.linear_accel_y)
|
||||
self.imu.linear_acceleration.z = float(self.linear_accel_z)
|
||||
self.imu.linear_acceleration_covariance = [
|
||||
0.017, 0.0, 0.0,
|
||||
0.0, 0.017, 0.0,
|
||||
0.0, 0.0, 0.017]
|
||||
rospy.loginfo("Linear Acceleration: X=%.2f, Y=%.2f, Z=%.2f", self.imu.linear_acceleration.x, self.imu.linear_acceleration.y, self.imu.linear_acceleration.z)
|
||||
|
||||
self.publisher_imu.publish(self.imu)
|
||||
|
||||
def publish_magnet(self, event):
|
||||
self.mag.header = Header()
|
||||
self.mag.header.frame_id = "base_link"
|
||||
self.mag.header.stamp = rospy.Time.now()
|
||||
|
||||
self.mag.magnetic_field.x = float(self.magnetometer_x)
|
||||
self.mag.magnetic_field.y = float(self.magnetometer_y)
|
||||
self.mag.magnetic_field.z = float(self.magnetometer_z)
|
||||
|
||||
self.publisher_mag.publish(self.mag)
|
||||
|
||||
def main():
|
||||
node = IMUPublisher()
|
||||
rospy.spin()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit e9d809ca8e3bf889c0275e4103b15a341ffab888
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"browse": {
|
||||
"databaseFilename": "${default}",
|
||||
"limitSymbolsToIncludedHeaders": false
|
||||
},
|
||||
"includePath": [
|
||||
"/opt/ros/noetic/include/**",
|
||||
"/home/hour/turtlebot_wc/src/turtlebot3_simulations/turtlebot3_fake/include/**",
|
||||
"/home/hour/turtlebot_wc/src/turtlebot3_simulations/turtlebot3_gazebo/include/**",
|
||||
"/home/hour/turtlebot_wc/src/turtlebot_controller/include/**",
|
||||
"/usr/include/**"
|
||||
],
|
||||
"name": "ROS",
|
||||
"intelliSenseMode": "gcc-x64",
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "gnu11",
|
||||
"cppStandard": "c++14"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"python.autoComplete.extraPaths": [
|
||||
"/opt/ros/noetic/lib/python3/dist-packages"
|
||||
],
|
||||
"python.analysis.extraPaths": [
|
||||
"/opt/ros/noetic/lib/python3/dist-packages"
|
||||
],
|
||||
"files.associations": {
|
||||
"geometry": "cpp"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
cmake_minimum_required(VERSION 3.0.2)
|
||||
project(turtlebot_controller)
|
||||
|
||||
find_package(catkin REQUIRED COMPONENTS
|
||||
roscpp
|
||||
rospy
|
||||
std_msgs
|
||||
geometry_msgs
|
||||
sensor_msgs
|
||||
nav_msgs
|
||||
tf2
|
||||
tf2_ros
|
||||
)
|
||||
find_package(Eigen3 REQUIRED)
|
||||
|
||||
catkin_package(
|
||||
INCLUDE_DIRS include
|
||||
CATKIN_DEPENDS
|
||||
std_msgs
|
||||
geometry_msgs
|
||||
sensor_msgs
|
||||
nav_msgs
|
||||
tf2
|
||||
tf2_ros
|
||||
DEPENDS Eigen3
|
||||
# DEPENDS system_lib
|
||||
)
|
||||
|
||||
include_directories(
|
||||
include
|
||||
|
||||
${catkin_INCLUDE_DIRS}
|
||||
${EIGEN3_INCLUDE_DIRS}
|
||||
)
|
||||
add_library(simple_controller src/simple_controller.cpp)
|
||||
add_dependencies(simple_controller ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
|
||||
target_link_libraries(simple_controller ${catkin_LIBRARIES} ${Eigen_LIBRARIES})
|
||||
|
||||
add_executable(simple_controller_node nodes/simple_controller_node.cpp)
|
||||
add_dependencies(simple_controller_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
|
||||
target_link_libraries(simple_controller_node ${catkin_LIBRARIES} simple_controller)
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
# joint_state_controller:
|
||||
# type: joint_state_controller/JointStateController
|
||||
# publish_rate: 50
|
||||
# wheel_left_controller:
|
||||
# type : velocity_controllers/JointVelocityController
|
||||
# joint : wheel_left_joint
|
||||
# wheel_right_controller:
|
||||
# type : velocity_controllers/JointVelocityController
|
||||
# joint : wheel_right_joint
|
||||
joint_state_controller:
|
||||
type: joint_state_controller/JointStateController
|
||||
publish_rate: 50
|
||||
|
||||
wheel_left_controller:
|
||||
type: velocity_controllers/JointVelocityController
|
||||
joint: wheel_left_joint
|
||||
|
||||
wheel_right_controller:
|
||||
type: velocity_controllers/JointVelocityController
|
||||
joint: wheel_right_joint
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
#ifndef SIMPLE_CONTROLLER_H
|
||||
#define SIMPLE_CONTROLLER_H
|
||||
|
||||
#include <ros/ros.h>
|
||||
#include <geometry_msgs/Twist.h>
|
||||
#include <Eigen/Core>
|
||||
#include <sensor_msgs/JointState.h>
|
||||
#include <nav_msgs/Odometry.h>
|
||||
#include <geometry_msgs/TransformStamped.h>
|
||||
|
||||
|
||||
class SimpleController
|
||||
{
|
||||
public:
|
||||
SimpleController(const ros::NodeHandle &, double radius, double separation);
|
||||
|
||||
private:
|
||||
void velCallback(const geometry_msgs::Twist &);
|
||||
|
||||
void jointCallback(const sensor_msgs::JointState &);
|
||||
|
||||
ros::NodeHandle nh_;
|
||||
ros::Subscriber vel_sub_;
|
||||
ros::Publisher right_cmd_pub_;
|
||||
ros::Publisher left_cmd_pub_;
|
||||
ros::Subscriber joint_sub_;
|
||||
ros::Publisher odom_pub_;
|
||||
|
||||
// Differential Kinematics
|
||||
Eigen::Matrix2d speed_conversion_;
|
||||
|
||||
// Odometry
|
||||
double wheel_radius_;
|
||||
double wheel_separation_;
|
||||
double right_wheel_prev_pos_;
|
||||
double left_wheel_prev_pos_;
|
||||
ros::Time prev_time_;
|
||||
nav_msgs::Odometry odom_msg_;
|
||||
double x_;
|
||||
double y_;
|
||||
double theta_;
|
||||
geometry_msgs::TransformStamped transform_stamped_;
|
||||
};
|
||||
#endif
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
<!-- <launch>
|
||||
|
||||
<rosparam file="$(find turtlebot_controller)/config/simple_controller.yaml" command="load"/>
|
||||
|
||||
|
||||
<node pkg="robot_state_publisher" type="robot_state_publsiher" name="robot_state_publsiher" respawn="false" output="screen"/>
|
||||
|
||||
|
||||
|
||||
<node pkg="controller_manager" type="spawner" name="controller_manager" respawn="false" output="screen"
|
||||
args="wheel_left_controller wheel_right_controller joint_state_controller"/>
|
||||
|
||||
|
||||
</launch> -->
|
||||
<!-- <launch>
|
||||
<rosparam file="$(find turtlebot_controller)/config/simple_controller.yaml" command="load"/>
|
||||
|
||||
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" respawn="false" output="screen"/>
|
||||
|
||||
<node pkg="controller_manager" type="spawner" name="controller_manager" respawn="false" output="screen"
|
||||
args="wheel_left_controller wheel_right_controller joint_state_controller"/>
|
||||
|
||||
</launch> -->
|
||||
<!-- <launch>
|
||||
<arg name="wheel_radius" default="0.033"/>
|
||||
<arg name="wheel_seperation" default="0.17"/>
|
||||
|
||||
|
||||
<rosparam file="$(find turtlebot_controller)/config/simple_controller.yaml" command="load"/>
|
||||
|
||||
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" respawn="false" output="screen"/>
|
||||
|
||||
<node pkg="controller_manager" type="spawner" name="controller_manager" respawn="false" output="screen"
|
||||
args="wheel_left_controller wheel_right_controller joint_state_controller"/>
|
||||
<node pkg="turtlebot_controller" type="simple_controller_node" name="simple_controller_node"
|
||||
respawn="true" output="screen"/>
|
||||
<param name="wheel radius" value="$(arg_wheel_radius"/>
|
||||
<param name="wheel seperation" value="$(arg_wheel_seperation"/>
|
||||
|
||||
|
||||
</launch> -->
|
||||
<launch>
|
||||
<arg name="wheel_radius" default="0.033"/>
|
||||
<arg name="wheel_seperation" default="0.17"/>
|
||||
|
||||
<rosparam file="$(find turtlebot_controller)/config/simple_controller.yaml" command="load"/>
|
||||
|
||||
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" respawn="false" output="screen"/>
|
||||
|
||||
<node name="controller_manager" pkg="controller_manager" type="spawner" respawn="false"
|
||||
output="screen" args="wheel_left_controller wheel_right_controller joint_state_controller"/>
|
||||
|
||||
<node pkg="turtlebot_controller" type="simple_controller_node" name="simple_controller_node"
|
||||
respawn="true" output="screen">
|
||||
<param name="wheel_radius" value="$(arg wheel_radius)"/>
|
||||
<param name="wheel_seperation" value="$(arg wheel_seperation)"/>
|
||||
</node>
|
||||
|
||||
</launch>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<launch>
|
||||
<node pkg="teleop_twist_keyboard" type="teleop_twist_keyboard.py" name="keyboard_teleop" output="screen">
|
||||
<param name="scale_linear" type="double" value="0.5"/>
|
||||
<param name="scale_angular" type="double" value="0.5"/>
|
||||
<remap from="cmd_vel" to="/turtlebot_controller/cmd_vel"/>
|
||||
|
||||
</node>
|
||||
</launch>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#include <ros/ros.h>
|
||||
#include "turtlebot_controller/simple_controller.h"
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
ros::init(argc, argv, "simple_controller");
|
||||
ros::NodeHandle nh;
|
||||
ros::NodeHandle pnh("~");
|
||||
double wheel_radius, wheel_separation;
|
||||
pnh.getParam("wheel_radius", wheel_radius);
|
||||
pnh.getParam("wheel_separation", wheel_separation);
|
||||
SimpleController controller(nh, wheel_radius, wheel_separation);
|
||||
ros::spin();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0"?>
|
||||
<package format="2">
|
||||
<name>turtlebot_controller</name>
|
||||
<version>0.0.0</version>
|
||||
<description>The turtlebot_controller package</description>
|
||||
|
||||
<!-- One maintainer tag required, multiple allowed, one person per tag -->
|
||||
<!-- Example: -->
|
||||
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
|
||||
<maintainer email="hour@todo.todo">hour</maintainer>
|
||||
|
||||
|
||||
<!-- One license tag required, multiple allowed, one license per tag -->
|
||||
<!-- Commonly used license strings: -->
|
||||
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
|
||||
<license>TODO</license>
|
||||
|
||||
|
||||
<!-- Url tags are optional, but multiple are allowed, one per tag -->
|
||||
<!-- Optional attribute type can be: website, bugtracker, or repository -->
|
||||
<!-- Example: -->
|
||||
<!-- <url type="website">http://wiki.ros.org/turtlebot_controller</url> -->
|
||||
|
||||
|
||||
<!-- Author tags are optional, multiple are allowed, one per tag -->
|
||||
<!-- Authors do not have to be maintainers, but could be -->
|
||||
<!-- Example: -->
|
||||
<!-- <author email="jane.doe@example.com">Jane Doe</author> -->
|
||||
|
||||
|
||||
<!-- The *depend tags are used to specify dependencies -->
|
||||
<!-- Dependencies can be catkin packages or system dependencies -->
|
||||
<!-- Examples: -->
|
||||
<!-- Use depend as a shortcut for packages that are both build and exec dependencies -->
|
||||
<!-- <depend>roscpp</depend> -->
|
||||
<!-- Note that this is equivalent to the following: -->
|
||||
<!-- <build_depend>roscpp</build_depend> -->
|
||||
<!-- <exec_depend>roscpp</exec_depend> -->
|
||||
<!-- Use build_depend for packages you need at compile time: -->
|
||||
<!-- <build_depend>message_generation</build_depend> -->
|
||||
<!-- Use build_export_depend for packages you need in order to build against this package: -->
|
||||
<!-- <build_export_depend>message_generation</build_export_depend> -->
|
||||
<!-- Use buildtool_depend for build tool packages: -->
|
||||
<!-- <buildtool_depend>catkin</buildtool_depend> -->
|
||||
<!-- Use exec_depend for packages you need at runtime: -->
|
||||
<!-- <exec_depend>message_runtime</exec_depend> -->
|
||||
<!-- Use test_depend for packages you need only for testing: -->
|
||||
<!-- <test_depend>gtest</test_depend> -->
|
||||
<!-- Use doc_depend for packages you need only for building documentation: -->
|
||||
<!-- <doc_depend>doxygen</doc_depend> -->
|
||||
<buildtool_depend>catkin</buildtool_depend>
|
||||
<build_depend>roscpp</build_depend>
|
||||
<build_depend>rospy</build_depend>
|
||||
<build_depend>std_msgs</build_depend>
|
||||
<build_depend>geometry_msgs</build_depend>
|
||||
<build_depend>eigen</build_depend>
|
||||
<build_depend>sensor_msgs</build_depend>
|
||||
<build_depend>nav_msgs</build_depend>
|
||||
<build_depend>tf2</build_depend>
|
||||
<build_depend>tf2_ros</build_depend>
|
||||
<build_export_depend>roscpp</build_export_depend>
|
||||
<build_export_depend>rospy</build_export_depend>
|
||||
<build_export_depend>eigen</build_export_depend>
|
||||
<build_export_depend>sensor_msgs</build_export_depend>
|
||||
<build_export_depend>nav_msgs</build_export_depend>
|
||||
<build_export_depend>tf2</build_export_depend>
|
||||
<build_export_depend>tf2_ros</build_export_depend>
|
||||
<exec_depend>roscpp</exec_depend>
|
||||
<exec_depend>rospy</exec_depend>
|
||||
<exec_depend>std_msgs</exec_depend>
|
||||
<exec_depend>geometry_msgs</exec_depend>
|
||||
<exec_depend>eigen</exec_depend>
|
||||
<exec_depend>sensor_msgs</exec_depend>
|
||||
<exec_depend>nav_msgs</exec_depend>
|
||||
<exec_depend>tf2</exec_depend>
|
||||
<exec_depend>tf2_ros</exec_depend>
|
||||
|
||||
<!-- The export tag contains other, unspecified, tags -->
|
||||
<export>
|
||||
<!-- Other tools can request additional information be placed here -->
|
||||
|
||||
</export>
|
||||
</package>
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
#include "turtlebot_controller/simple_controller.h"
|
||||
#include <std_msgs/Float64.h>
|
||||
#include <Eigen/Geometry>
|
||||
#include <tf2/LinearMath/Quaternion.h>
|
||||
#include <tf2_ros/transform_broadcaster.h>
|
||||
|
||||
|
||||
SimpleController::SimpleController(const ros::NodeHandle &nh,
|
||||
double radius,
|
||||
double separation)
|
||||
: nh_(nh)
|
||||
, wheel_radius_(radius)
|
||||
, wheel_separation_(separation)
|
||||
, left_wheel_prev_pos_(0.0)
|
||||
, right_wheel_prev_pos_(0.0)
|
||||
, x_(0.0)
|
||||
, y_(0.0)
|
||||
, theta_(0.0)
|
||||
{
|
||||
ROS_INFO_STREAM("Using wheel radius " << radius);
|
||||
ROS_INFO_STREAM("Using wheel separation " << separation);
|
||||
right_cmd_pub_ = nh_.advertise<std_msgs::Float64>("wheel_right_controller/command", 10);
|
||||
left_cmd_pub_ = nh_.advertise<std_msgs::Float64>("wheel_left_controller/command", 10);
|
||||
vel_sub_ = nh_.subscribe("turtlebot_controller/cmd_vel", 1000, &SimpleController::velCallback, this);
|
||||
joint_sub_ = nh_.subscribe("joint_states", 1000, &SimpleController::jointCallback, this);
|
||||
odom_pub_ = nh_.advertise<nav_msgs::Odometry>("turtlebot_controller/odom", 10);
|
||||
|
||||
speed_conversion_ << radius/2, radius/2, radius/separation, -radius/separation;
|
||||
ROS_INFO_STREAM("The conversion matrix is \n" << speed_conversion_);
|
||||
|
||||
// Fill the Odometry message with invariant parameters
|
||||
odom_msg_.header.frame_id = "odom";
|
||||
odom_msg_.child_frame_id = "base_footprint";
|
||||
odom_msg_.pose.pose.orientation.x = 0.0;
|
||||
odom_msg_.pose.pose.orientation.y = 0.0;
|
||||
odom_msg_.pose.pose.orientation.z = 0.0;
|
||||
odom_msg_.pose.pose.orientation.w = 1.0;
|
||||
|
||||
transform_stamped_.header.frame_id = "odom";
|
||||
transform_stamped_.child_frame_id = "base_footprint";
|
||||
|
||||
prev_time_ = ros::Time::now();
|
||||
}
|
||||
|
||||
|
||||
void SimpleController::velCallback(const geometry_msgs::Twist &msg)
|
||||
{
|
||||
// Implements the differential kinematic model
|
||||
// Given v and w, calculate the velocities of the wheels
|
||||
Eigen::Vector2d robot_speed(msg.linear.x, msg.angular.z);
|
||||
Eigen::Vector2d wheel_speed = speed_conversion_.inverse() * robot_speed;
|
||||
std_msgs::Float64 right_speed;
|
||||
right_speed.data = wheel_speed.coeff(0);
|
||||
std_msgs::Float64 left_speed;
|
||||
left_speed.data = wheel_speed.coeff(1);
|
||||
|
||||
right_cmd_pub_.publish(right_speed);
|
||||
left_cmd_pub_.publish(left_speed);
|
||||
}
|
||||
|
||||
|
||||
void SimpleController::jointCallback(const sensor_msgs::JointState &state)
|
||||
{
|
||||
// Implements the inverse differential kinematic model
|
||||
// Given the position of the wheels, calculates their velocities
|
||||
// then calculates the velocity of the robot wrt the robot frame
|
||||
// and then converts it in the global frame and publishes the TF
|
||||
double dp_left = state.position.at(0) - left_wheel_prev_pos_;
|
||||
double dp_right = state.position.at(1) - right_wheel_prev_pos_;
|
||||
double dt = (state.header.stamp - prev_time_).toSec();
|
||||
|
||||
// Actualize the prev pose for the next itheration
|
||||
left_wheel_prev_pos_ = state.position.at(0);
|
||||
right_wheel_prev_pos_ = state.position.at(1);
|
||||
prev_time_ = state.header.stamp;
|
||||
|
||||
// Calculate the rotational speed of each wheel
|
||||
double fi_left = dp_left / dt;
|
||||
double fi_right = dp_right / dt;
|
||||
|
||||
// Calculate the linear and angular velocity
|
||||
double linear = (wheel_radius_ * fi_right + wheel_radius_ * fi_left) / 2;
|
||||
double angular = (wheel_radius_ * fi_right - wheel_radius_ * fi_left) / wheel_separation_;
|
||||
|
||||
// Calculate the position increment
|
||||
double d_s = (wheel_radius_ * dp_right + wheel_radius_ * dp_left) / 2;
|
||||
double d_theta = (wheel_radius_ * dp_right - wheel_radius_ * dp_left) / wheel_separation_;
|
||||
theta_ += d_theta;
|
||||
x_ += d_s * cos(theta_);
|
||||
y_ += d_s * sin(theta_);
|
||||
|
||||
// Compose and publish the odom message
|
||||
tf2::Quaternion q;
|
||||
q.setRPY(0, 0, theta_);
|
||||
odom_msg_.header.stamp = ros::Time::now();
|
||||
odom_msg_.pose.pose.position.x = x_;
|
||||
odom_msg_.pose.pose.position.y = y_;
|
||||
odom_msg_.pose.pose.orientation.x = q.getX();
|
||||
odom_msg_.pose.pose.orientation.y = q.getY();
|
||||
odom_msg_.pose.pose.orientation.z = q.getZ();
|
||||
odom_msg_.pose.pose.orientation.w = q.getW();
|
||||
odom_msg_.twist.twist.linear.x = linear;
|
||||
odom_msg_.twist.twist.angular.z = angular;
|
||||
odom_pub_.publish(odom_msg_);
|
||||
|
||||
// TF
|
||||
static tf2_ros::TransformBroadcaster br;
|
||||
transform_stamped_.transform.translation.x = x_;
|
||||
transform_stamped_.transform.translation.y = y_;
|
||||
transform_stamped_.transform.rotation.x = q.getX();
|
||||
transform_stamped_.transform.rotation.y = q.getY();
|
||||
transform_stamped_.transform.rotation.z = q.getZ();
|
||||
transform_stamped_.transform.rotation.w = q.getW();
|
||||
transform_stamped_.header.stamp = ros::Time::now();
|
||||
br.sendTransform(transform_stamped_);
|
||||
}
|
||||
|
|
@ -0,0 +1,202 @@
|
|||
cmake_minimum_required(VERSION 3.0.2)
|
||||
project(turtlebot_description)
|
||||
|
||||
## Compile as C++11, supported in ROS Kinetic and newer
|
||||
# add_compile_options(-std=c++11)
|
||||
|
||||
## Find catkin macros and libraries
|
||||
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
|
||||
## is used, also find other catkin packages
|
||||
find_package(catkin REQUIRED)
|
||||
|
||||
## System dependencies are found with CMake's conventions
|
||||
# find_package(Boost REQUIRED COMPONENTS system)
|
||||
|
||||
|
||||
## Uncomment this if the package has a setup.py. This macro ensures
|
||||
## modules and global scripts declared therein get installed
|
||||
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
|
||||
# catkin_python_setup()
|
||||
|
||||
################################################
|
||||
## Declare ROS messages, services and actions ##
|
||||
################################################
|
||||
|
||||
## To declare and build messages, services or actions from within this
|
||||
## package, follow these steps:
|
||||
## * Let MSG_DEP_SET be the set of packages whose message types you use in
|
||||
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
|
||||
## * In the file package.xml:
|
||||
## * add a build_depend tag for "message_generation"
|
||||
## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
|
||||
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
|
||||
## but can be declared for certainty nonetheless:
|
||||
## * add a exec_depend tag for "message_runtime"
|
||||
## * In this file (CMakeLists.txt):
|
||||
## * add "message_generation" and every package in MSG_DEP_SET to
|
||||
## find_package(catkin REQUIRED COMPONENTS ...)
|
||||
## * add "message_runtime" and every package in MSG_DEP_SET to
|
||||
## catkin_package(CATKIN_DEPENDS ...)
|
||||
## * uncomment the add_*_files sections below as needed
|
||||
## and list every .msg/.srv/.action file to be processed
|
||||
## * uncomment the generate_messages entry below
|
||||
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
|
||||
|
||||
## Generate messages in the 'msg' folder
|
||||
# add_message_files(
|
||||
# FILES
|
||||
# Message1.msg
|
||||
# Message2.msg
|
||||
# )
|
||||
|
||||
## Generate services in the 'srv' folder
|
||||
# add_service_files(
|
||||
# FILES
|
||||
# Service1.srv
|
||||
# Service2.srv
|
||||
# )
|
||||
|
||||
## Generate actions in the 'action' folder
|
||||
# add_action_files(
|
||||
# FILES
|
||||
# Action1.action
|
||||
# Action2.action
|
||||
# )
|
||||
|
||||
## Generate added messages and services with any dependencies listed here
|
||||
# generate_messages(
|
||||
# DEPENDENCIES
|
||||
# std_msgs # Or other packages containing msgs
|
||||
# )
|
||||
|
||||
################################################
|
||||
## Declare ROS dynamic reconfigure parameters ##
|
||||
################################################
|
||||
|
||||
## To declare and build dynamic reconfigure parameters within this
|
||||
## package, follow these steps:
|
||||
## * In the file package.xml:
|
||||
## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
|
||||
## * In this file (CMakeLists.txt):
|
||||
## * add "dynamic_reconfigure" to
|
||||
## find_package(catkin REQUIRED COMPONENTS ...)
|
||||
## * uncomment the "generate_dynamic_reconfigure_options" section below
|
||||
## and list every .cfg file to be processed
|
||||
|
||||
## Generate dynamic reconfigure parameters in the 'cfg' folder
|
||||
# generate_dynamic_reconfigure_options(
|
||||
# cfg/DynReconf1.cfg
|
||||
# cfg/DynReconf2.cfg
|
||||
# )
|
||||
|
||||
###################################
|
||||
## catkin specific configuration ##
|
||||
###################################
|
||||
## The catkin_package macro generates cmake config files for your package
|
||||
## Declare things to be passed to dependent projects
|
||||
## INCLUDE_DIRS: uncomment this if your package contains header files
|
||||
## LIBRARIES: libraries you create in this project that dependent projects also need
|
||||
## CATKIN_DEPENDS: catkin_packages dependent projects also need
|
||||
## DEPENDS: system dependencies of this project that dependent projects also need
|
||||
catkin_package(
|
||||
# INCLUDE_DIRS include
|
||||
# LIBRARIES turtlebot_description
|
||||
# CATKIN_DEPENDS other_catkin_pkg
|
||||
# DEPENDS system_lib
|
||||
)
|
||||
|
||||
###########
|
||||
## Build ##
|
||||
###########
|
||||
|
||||
## Specify additional locations of header files
|
||||
## Your package locations should be listed before other locations
|
||||
include_directories(
|
||||
# include
|
||||
# ${catkin_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
## Declare a C++ library
|
||||
# add_library(${PROJECT_NAME}
|
||||
# src/${PROJECT_NAME}/turtlebot_description.cpp
|
||||
# )
|
||||
|
||||
## Add cmake target dependencies of the library
|
||||
## as an example, code may need to be generated before libraries
|
||||
## either from message generation or dynamic reconfigure
|
||||
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
|
||||
|
||||
## Declare a C++ executable
|
||||
## With catkin_make all packages are built within a single CMake context
|
||||
## The recommended prefix ensures that target names across packages don't collide
|
||||
# add_executable(${PROJECT_NAME}_node src/turtlebot_description_node.cpp)
|
||||
|
||||
## Rename C++ executable without prefix
|
||||
## The above recommended prefix causes long target names, the following renames the
|
||||
## target back to the shorter version for ease of user use
|
||||
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
|
||||
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
|
||||
|
||||
## Add cmake target dependencies of the executable
|
||||
## same as for the library above
|
||||
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
|
||||
|
||||
## Specify libraries to link a library or executable target against
|
||||
# target_link_libraries(${PROJECT_NAME}_node
|
||||
# ${catkin_LIBRARIES}
|
||||
# )
|
||||
|
||||
#############
|
||||
## Install ##
|
||||
#############
|
||||
|
||||
# all install targets should use catkin DESTINATION variables
|
||||
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
|
||||
|
||||
## Mark executable scripts (Python etc.) for installation
|
||||
## in contrast to setup.py, you can choose the destination
|
||||
# catkin_install_python(PROGRAMS
|
||||
# scripts/my_python_script
|
||||
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
# )
|
||||
|
||||
## Mark executables for installation
|
||||
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
|
||||
# install(TARGETS ${PROJECT_NAME}_node
|
||||
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
# )
|
||||
|
||||
## Mark libraries for installation
|
||||
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
|
||||
# install(TARGETS ${PROJECT_NAME}
|
||||
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
# RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
|
||||
# )
|
||||
|
||||
## Mark cpp header files for installation
|
||||
# install(DIRECTORY include/${PROJECT_NAME}/
|
||||
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
|
||||
# FILES_MATCHING PATTERN "*.h"
|
||||
# PATTERN ".svn" EXCLUDE
|
||||
# )
|
||||
|
||||
## Mark other files for installation (e.g. launch and bag files, etc.)
|
||||
# install(FILES
|
||||
# # myfile1
|
||||
# # myfile2
|
||||
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
|
||||
# )
|
||||
|
||||
#############
|
||||
## Testing ##
|
||||
#############
|
||||
|
||||
## Add gtest based cpp test target and link libraries
|
||||
# catkin_add_gtest(${PROJECT_NAME}-test test/test_turtlebot_description.cpp)
|
||||
# if(TARGET ${PROJECT_NAME}-test)
|
||||
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
|
||||
# endif()
|
||||
|
||||
## Add folders to be run by python nosetests
|
||||
# catkin_add_nosetests(test)
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<launch>
|
||||
<arg name="model" default="$(find turtlebot_description)/urdf/turtlebot.urdf.xacro"/>
|
||||
<param name="robot_description" command="$(find xacro)/xacro $(arg model)"/>
|
||||
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher"/>
|
||||
<node pkg="joint_state_publisher_gui" type="joint_state_publisher_gui" name="joint_state_publisher_gui"/>
|
||||
<node pkg="rviz" type="rviz" name="rviz" args="-d $(find turtlebot_description)/rviz/display.rviz"/>
|
||||
</launch>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<launch>
|
||||
<arg name="model" default="$(find kubot_description)/urdf/kubot.urdf.xacro"/>
|
||||
<arg name="world" default="$(find kubot_description)/worlds/ku_lab/ku_model.sdf"/>
|
||||
<!-- <arg name="world" default="empty_world"/> -->
|
||||
|
||||
<param name="robot_description" command="$(find xacro)/xacro '$(find turtlebot_description)/urdf/turtlebot.urdf.xacro'" />
|
||||
|
||||
<include file="$(find gazebo_ros)/launch/empty_world.launch">
|
||||
<arg name="world_name" value="$(arg world)"/>
|
||||
<arg name="paused" value="false"/>
|
||||
<arg name="use_sim_time" value="true"/>
|
||||
<arg name="gui" value="true"/>
|
||||
<arg name="recording" value="false"/>
|
||||
<arg name="debug" value="false"/>
|
||||
</include>
|
||||
|
||||
<node pkg="gazebo_ros" type="spawn_model" name="spawn_model"
|
||||
args="-unpause -urdf -model robot -param robot_description"
|
||||
output="screen" respawn="false"/>
|
||||
|
||||
</launch>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0"?>
|
||||
<package format="2">
|
||||
<name>turtlebot_description</name>
|
||||
<version>0.0.0</version>
|
||||
<description>The turtlebot_description package</description>
|
||||
|
||||
<!-- One maintainer tag required, multiple allowed, one person per tag -->
|
||||
<!-- Example: -->
|
||||
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
|
||||
<maintainer email="hour@todo.todo">hour</maintainer>
|
||||
|
||||
|
||||
<!-- One license tag required, multiple allowed, one license per tag -->
|
||||
<!-- Commonly used license strings: -->
|
||||
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
|
||||
<license>TODO</license>
|
||||
|
||||
|
||||
<!-- Url tags are optional, but multiple are allowed, one per tag -->
|
||||
<!-- Optional attribute type can be: website, bugtracker, or repository -->
|
||||
<!-- Example: -->
|
||||
<!-- <url type="website">http://wiki.ros.org/turtlebot_description</url> -->
|
||||
|
||||
|
||||
<!-- Author tags are optional, multiple are allowed, one per tag -->
|
||||
<!-- Authors do not have to be maintainers, but could be -->
|
||||
<!-- Example: -->
|
||||
<!-- <author email="jane.doe@example.com">Jane Doe</author> -->
|
||||
|
||||
|
||||
<!-- The *depend tags are used to specify dependencies -->
|
||||
<!-- Dependencies can be catkin packages or system dependencies -->
|
||||
<!-- Examples: -->
|
||||
<!-- Use depend as a shortcut for packages that are both build and exec dependencies -->
|
||||
<!-- <depend>roscpp</depend> -->
|
||||
<!-- Note that this is equivalent to the following: -->
|
||||
<!-- <build_depend>roscpp</build_depend> -->
|
||||
<!-- <exec_depend>roscpp</exec_depend> -->
|
||||
<!-- Use build_depend for packages you need at compile time: -->
|
||||
<!-- <build_depend>message_generation</build_depend> -->
|
||||
<!-- Use build_export_depend for packages you need in order to build against this package: -->
|
||||
<!-- <build_export_depend>message_generation</build_export_depend> -->
|
||||
<!-- Use buildtool_depend for build tool packages: -->
|
||||
<!-- <buildtool_depend>catkin</buildtool_depend> -->
|
||||
<!-- Use exec_depend for packages you need at runtime: -->
|
||||
<!-- <exec_depend>message_runtime</exec_depend> -->
|
||||
<!-- Use test_depend for packages you need only for testing: -->
|
||||
<!-- <test_depend>gtest</test_depend> -->
|
||||
<!-- Use doc_depend for packages you need only for building documentation: -->
|
||||
<!-- <doc_depend>doxygen</doc_depend> -->
|
||||
<buildtool_depend>catkin</buildtool_depend>
|
||||
|
||||
|
||||
<!-- The export tag contains other, unspecified, tags -->
|
||||
<export>
|
||||
<!-- Other tools can request additional information be placed here -->
|
||||
|
||||
</export>
|
||||
</package>
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
Panels:
|
||||
- Class: rviz/Displays
|
||||
Help Height: 78
|
||||
Name: Displays
|
||||
Property Tree Widget:
|
||||
Expanded:
|
||||
- /Global Options1
|
||||
- /Status1
|
||||
- /RobotModel1
|
||||
- /TF1
|
||||
- /TF1/Frames1
|
||||
Splitter Ratio: 0.5
|
||||
Tree Height: 439
|
||||
- Class: rviz/Selection
|
||||
Name: Selection
|
||||
- Class: rviz/Tool Properties
|
||||
Expanded:
|
||||
- /2D Pose Estimate1
|
||||
- /2D Nav Goal1
|
||||
- /Publish Point1
|
||||
Name: Tool Properties
|
||||
Splitter Ratio: 0.5886790156364441
|
||||
- Class: rviz/Views
|
||||
Expanded:
|
||||
- /Current View1
|
||||
Name: Views
|
||||
Splitter Ratio: 0.5
|
||||
- Class: rviz/Time
|
||||
Name: Time
|
||||
SyncMode: 0
|
||||
SyncSource: ""
|
||||
Preferences:
|
||||
PromptSaveOnExit: true
|
||||
Toolbars:
|
||||
toolButtonStyle: 2
|
||||
Visualization Manager:
|
||||
Class: ""
|
||||
Displays:
|
||||
- Alpha: 0.5
|
||||
Cell Size: 1
|
||||
Class: rviz/Grid
|
||||
Color: 160; 160; 164
|
||||
Enabled: true
|
||||
Line Style:
|
||||
Line Width: 0.029999999329447746
|
||||
Value: Lines
|
||||
Name: Grid
|
||||
Normal Cell Count: 0
|
||||
Offset:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
Plane: XY
|
||||
Plane Cell Count: 10
|
||||
Reference Frame: <Fixed Frame>
|
||||
Value: true
|
||||
- Alpha: 1
|
||||
Class: rviz/RobotModel
|
||||
Collision Enabled: true
|
||||
Enabled: true
|
||||
Links:
|
||||
All Links Enabled: true
|
||||
Expand Joint Details: false
|
||||
Expand Link Details: false
|
||||
Expand Tree: false
|
||||
Link Tree Style: Links in Alphabetic Order
|
||||
base_footprint:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
base_link:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
base_scan:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
camera_link:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
camera_rgb_frame:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
camera_rgb_optical_frame:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
caster_back_left_link:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
caster_back_right_link:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
imu_link:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
wheel_left_link:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
wheel_right_link:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
Name: RobotModel
|
||||
Robot Description: robot_description
|
||||
TF Prefix: ""
|
||||
Update Interval: 0
|
||||
Value: true
|
||||
Visual Enabled: true
|
||||
- Class: rviz/TF
|
||||
Enabled: false
|
||||
Filter (blacklist): ""
|
||||
Filter (whitelist): ""
|
||||
Frame Timeout: 15
|
||||
Frames:
|
||||
All Enabled: true
|
||||
Marker Alpha: 1
|
||||
Marker Scale: 1
|
||||
Name: TF
|
||||
Show Arrows: true
|
||||
Show Axes: true
|
||||
Show Names: true
|
||||
Tree:
|
||||
{}
|
||||
Update Interval: 0
|
||||
Value: false
|
||||
Enabled: true
|
||||
Global Options:
|
||||
Background Color: 48; 48; 48
|
||||
Default Light: true
|
||||
Fixed Frame: base_footprint
|
||||
Frame Rate: 30
|
||||
Name: root
|
||||
Tools:
|
||||
- Class: rviz/Interact
|
||||
Hide Inactive Objects: true
|
||||
- Class: rviz/MoveCamera
|
||||
- Class: rviz/Select
|
||||
- Class: rviz/FocusCamera
|
||||
- Class: rviz/Measure
|
||||
- Class: rviz/SetInitialPose
|
||||
Theta std deviation: 0.2617993950843811
|
||||
Topic: /initialpose
|
||||
X std deviation: 0.5
|
||||
Y std deviation: 0.5
|
||||
- Class: rviz/SetGoal
|
||||
Topic: /move_base_simple/goal
|
||||
- Class: rviz/PublishPoint
|
||||
Single click: true
|
||||
Topic: /clicked_point
|
||||
Value: true
|
||||
Views:
|
||||
Current:
|
||||
Class: rviz/Orbit
|
||||
Distance: 0.6517211198806763
|
||||
Enable Stereo Rendering:
|
||||
Stereo Eye Separation: 0.05999999865889549
|
||||
Stereo Focal Distance: 1
|
||||
Swap Stereo Eyes: false
|
||||
Value: false
|
||||
Field of View: 0.7853981852531433
|
||||
Focal Point:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
Focal Shape Fixed Size: false
|
||||
Focal Shape Size: 0.05000000074505806
|
||||
Invert Z Axis: false
|
||||
Name: Current View
|
||||
Near Clip Distance: 0.009999999776482582
|
||||
Pitch: 0.5753997564315796
|
||||
Target Frame: <Fixed Frame>
|
||||
Yaw: 0.013627300970256329
|
||||
Saved: ~
|
||||
Window Geometry:
|
||||
Displays:
|
||||
collapsed: false
|
||||
Height: 736
|
||||
Hide Left Dock: false
|
||||
Hide Right Dock: false
|
||||
QMainWindow State: 000000ff00000000fd00000004000000000000015600000242fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d00000242000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f00000242fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d00000242000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004b80000003efc0100000002fb0000000800540069006d00650100000000000004b8000003bc00fffffffb0000000800540069006d00650100000000000004500000000000000000000002470000024200000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
|
||||
Selection:
|
||||
collapsed: false
|
||||
Time:
|
||||
collapsed: false
|
||||
Tool Properties:
|
||||
collapsed: false
|
||||
Views:
|
||||
collapsed: false
|
||||
Width: 1208
|
||||
X: 72
|
||||
Y: 27
|
||||
|
|
@ -0,0 +1,251 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<robot name="turtlebot" xmlns:xacro="http://www.ros.org/wiki/xacro">
|
||||
<xacro:arg name="model" default="$(find turtlebot_description)/urdf/turtlebot.urdf.xacro"/>
|
||||
|
||||
<xacro:include filename="$(find turtlebot_description)/urdf/turtlebot_gazebo.xacro"/>
|
||||
|
||||
<link name = "base_footprint"/>
|
||||
|
||||
<link name="base_link">
|
||||
<visual>
|
||||
<origin xyz="-0.14 0.2 -0.05" rpy="1.5708 0 0"/>
|
||||
<geometry>
|
||||
<mesh filename="package://turtlebot_description/meshes/bases/kubot_base.STL" scale="0.001 0.001 0.001"/>
|
||||
</geometry>
|
||||
<material name="light_black"/>
|
||||
</visual>
|
||||
|
||||
<collision>
|
||||
<origin xyz="-0.064 0 0.047" rpy="0 0 0"/>
|
||||
<geometry>
|
||||
<box size="0.266 0.266 0.094"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
|
||||
<inertial>
|
||||
<origin xyz="0.0 0 0.0" rpy="0 0 0"/>
|
||||
<mass value="1.6329594e+00"/>
|
||||
<inertia ixx="8.7002718e-03" ixy="-4.7576583e-05" ixz="1.1160499e-04"
|
||||
iyy="8.6195418e-03" iyz="-3.5422299e-06"
|
||||
izz="1.4612727e-02"/>
|
||||
</inertial>
|
||||
</link>
|
||||
|
||||
<link name="wheel_left_link">
|
||||
<visual>
|
||||
<origin xyz="0 0 0" rpy="1.57 0 0"/>
|
||||
<geometry>
|
||||
<mesh filename="package://turtlebot_description/meshes/wheels/left_tire.stl" scale="0.001 0.001 0.001"/>
|
||||
</geometry>
|
||||
<material name="dark"/>
|
||||
</visual>
|
||||
|
||||
<collision>
|
||||
<origin xyz="0 0 0" rpy="0 0 0"/>
|
||||
<geometry>
|
||||
<cylinder length="0.018" radius="0.033"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
|
||||
<inertial>
|
||||
<origin xyz="0 0 0" />
|
||||
<mass value="2.8498940e-02" />
|
||||
<inertia ixx="1.1175580e-05" ixy="-4.2369783e-11" ixz="-5.9381719e-09"
|
||||
iyy="1.1192413e-05" iyz="-1.4400107e-11"
|
||||
izz="2.0712558e-05" />
|
||||
</inertial>
|
||||
</link>
|
||||
|
||||
<link name="wheel_right_link">
|
||||
<visual>
|
||||
<origin xyz="0 0 0" rpy="1.57 0 0"/>
|
||||
<geometry>
|
||||
<mesh filename="package://turtlebot_description/meshes/wheels/right_tire.stl" scale="0.001 0.001 0.001"/>
|
||||
</geometry>
|
||||
<material name="dark"/>
|
||||
</visual>
|
||||
|
||||
<collision>
|
||||
<origin xyz="0 0.001 0" rpy="0 0 0"/>
|
||||
<geometry>
|
||||
<cylinder length="0.018" radius="0.033"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
|
||||
<inertial><launch>
|
||||
<arg name="model" default="$(find turtlebot_description)/urdf/turtlebot.urdf.xacro"/>
|
||||
<param name="robot_description" command="$(find xacro)/xacro --inorder $(arg model)"/>
|
||||
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher"/>
|
||||
<node pkg="joint_state_publisher_gui" type="joint_state_publisher_gui" name="joint_state_publisher_gui"/>
|
||||
<node pkg="rviz" type="rviz" args="-d $(find turtlebot_description)/rviz/display.rviz"/>
|
||||
</launch>
|
||||
|
||||
<origin xyz="0 0 0" />
|
||||
<mass value="2.8498940e-02" />
|
||||
<inertia ixx="1.1175580e-05" ixy="-4.2369783e-11" ixz="-5.9381719e-09"
|
||||
iyy="1.1192413e-05" iyz="-1.4400107e-11"
|
||||
izz="2.0712558e-05" />
|
||||
</inertial>
|
||||
</link>
|
||||
|
||||
<link name="caster_link">
|
||||
<collision>
|
||||
<origin xyz="0 0.001 0" rpy="0 0 0"/>
|
||||
<geometry>
|
||||
<box size="0.030 0.009 0.020"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
|
||||
<inertial>
|
||||
<origin xyz="0 0 0" />
|
||||
<mass value="0.005" />
|
||||
<inertia ixx="0.001" ixy="0.0" ixz="0.0"
|
||||
iyy="0.001" iyz="0.0"
|
||||
izz="0.001" />
|
||||
</inertial>
|
||||
</link>
|
||||
|
||||
<!-- <link name="caster_back_right_link">
|
||||
<collision>
|
||||
<origin xyz="0 0.001 0" rpy="0 0 0"/>
|
||||
<geometry>
|
||||
<box size="0.030 0.009 0.020"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
|
||||
<inertial>
|
||||
<origin xyz="0 0 0" />
|
||||
<mass value="0.005" />
|
||||
<inertia ixx="0.001" ixy="0.0" ixz="0.0"
|
||||
iyy="0.001" iyz="0.0"
|
||||
izz="0.001" />
|
||||
</inertial>
|
||||
</link>
|
||||
|
||||
<link name="caster_back_left_link">
|
||||
<collision>
|
||||
<origin xyz="0 0.001 0" rpy="0 0 0"/>
|
||||
<geometry>
|
||||
<box size="0.030 0.009 0.020"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
|
||||
<inertial>
|
||||
<origin xyz="0 0 0" />
|
||||
<mass value="0.005" />
|
||||
<inertia ixx="0.001" ixy="0.0" ixz="0.0"
|
||||
iyy="0.001" iyz="0.0"
|
||||
izz="0.001" />
|
||||
</inertial>
|
||||
</link> -->
|
||||
|
||||
<link name="imu_link"/>
|
||||
|
||||
<link name="base_scan">
|
||||
<visual>
|
||||
<origin xyz="0 0 0.0" rpy="0 0 0"/>
|
||||
<geometry>
|
||||
<mesh filename="package://turtlebot_description/meshes/sensors/lds.stl" scale="0.001 0.001 0.001"/>
|
||||
</geometry>
|
||||
<material name="dark"/>
|
||||
</visual>
|
||||
|
||||
<collision>
|
||||
<origin xyz="0.015 0 -0.0065" rpy="0 0 0"/>
|
||||
<geometry>
|
||||
<cylinder length="0.0315" radius="0.045"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
|
||||
<inertial>
|
||||
<mass value="0.114" />
|
||||
<origin xyz="0 0 0" />
|
||||
<inertia ixx="0.001" ixy="0.0" ixz="0.0"
|
||||
iyy="0.001" iyz="0.0"
|
||||
izz="0.001" />
|
||||
</inertial>
|
||||
</link>
|
||||
<!--
|
||||
<link name="camera_link">
|
||||
<collision>
|
||||
<origin xyz="0.005 0.011 0.013" rpy="0 0 0"/>
|
||||
<geometry>
|
||||
<box size="0.015 0.030 0.027"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
</link> -->
|
||||
|
||||
<!-- <link name="camera_rgb_frame"/> -->
|
||||
|
||||
<!-- <link name="camera_rgb_optical_frame"/> -->
|
||||
|
||||
<joint name="base_joint" type="fixed">
|
||||
<parent link="base_footprint"/>
|
||||
<child link="base_link" />
|
||||
<origin xyz="0.1 0 -0.01" rpy="0 0 0"/>
|
||||
</joint>
|
||||
|
||||
<joint name="wheel_left_joint" type="continuous">
|
||||
<parent link="base_link"/>
|
||||
<child link="wheel_left_link"/>
|
||||
<origin xyz="0.0 0.144 0.023" rpy="-1.57 0 0"/>
|
||||
<axis xyz="0 0 1"/>
|
||||
</joint>
|
||||
|
||||
<joint name="wheel_right_joint" type="continuous">
|
||||
<parent link="base_link"/>
|
||||
<child link="wheel_right_link"/>
|
||||
<origin xyz="0.0 -0.144 0.023" rpy="-1.57 0 0"/>
|
||||
<axis xyz="0 0 1"/>
|
||||
</joint>
|
||||
<!--
|
||||
<joint name="caster_back_right_joint" type="fixed">
|
||||
<parent link="base_link"/>
|
||||
<child link="caster_back_right_link"/>
|
||||
<origin xyz="-0.177 -0.064 -0.004" rpy="-1.57 0 0"/>
|
||||
</joint>
|
||||
|
||||
<joint name="caster_back_left_joint" type="fixed">
|
||||
<parent link="base_link"/>
|
||||
<child link="caster_back_left_link"/>
|
||||
<origin xyz="-0.177 0.064 -0.004" rpy="-1.57 0 0"/>
|
||||
</joint> -->
|
||||
|
||||
<joint name="caster__joint" type="fixed">
|
||||
<parent link="base_link"/>
|
||||
<child link="caster_link"/>
|
||||
<origin xyz="-0.177 0.064 -0.004" rpy="-1.57 0 0"/>
|
||||
</joint>
|
||||
|
||||
<joint name="imu_joint" type="fixed">
|
||||
<parent link="base_link"/>
|
||||
<child link="imu_link"/>
|
||||
<origin xyz="0.0 0 0.068" rpy="0 0 0"/>
|
||||
</joint>
|
||||
|
||||
<joint name="scan_joint" type="fixed">
|
||||
<parent link="base_link"/>
|
||||
<child link="base_scan"/>
|
||||
<origin xyz="-0.024 0 0.122" rpy="0 0 0"/>
|
||||
</joint>
|
||||
|
||||
<!-- <joint name="camera_joint" type="fixed">
|
||||
<origin xyz="0.073 -0.011 0.084" rpy="0 0 0"/>
|
||||
<parent link="base_link"/>
|
||||
<child link="camera_link"/>
|
||||
</joint> -->
|
||||
<!--
|
||||
<joint name="camera_rgb_joint" type="fixed">
|
||||
<origin xyz="0.003 0.011 0.009" rpy="0 0 0"/>
|
||||
<parent link="camera_link"/>
|
||||
<child link="camera_rgb_frame"/>
|
||||
</joint> -->
|
||||
|
||||
<!-- <joint name="camera_rgb_optical_joint" type="fixed">
|
||||
<origin xyz="0 0 0" rpy="-1.57 0 -1.57"/>
|
||||
<parent link="camera_rgb_frame"/>
|
||||
<child link="camera_rgb_optical_frame"/>
|
||||
</joint> -->
|
||||
|
||||
</robot>
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="turtlebot">
|
||||
|
||||
<gazebo reference="base_link">
|
||||
<material>Gazebo/DarkGrey</material>
|
||||
</gazebo>
|
||||
|
||||
<gazebo reference="base_scan">
|
||||
<material>Gazebo/FlatBlack</material>
|
||||
</gazebo>
|
||||
|
||||
<gazebo reference ="wheel_left_link">
|
||||
<mu1>1000000</mu1>
|
||||
<mu2>1000000</mu2>
|
||||
<kp>500000</kp>
|
||||
<kd>10</kd>
|
||||
<minDepth>0.001</minDepth>
|
||||
<maxVel>0.1</maxVel>
|
||||
<fdir1>1 0 0</fdir1>
|
||||
<material>Gazebo/FlatBlack</material>
|
||||
</gazebo>
|
||||
|
||||
<gazebo reference ="wheel_right_link">
|
||||
<mu1>100000</mu1>
|
||||
<mu2>100000</mu2>
|
||||
<kp>500000</kp>
|
||||
<kd>10</kd>
|
||||
<minDepth>0.001</minDepth>
|
||||
<maxVel>0.1</maxVel>
|
||||
<fdir1>1 0 0</fdir1>
|
||||
<material>Gazebo/FlatBlack</material>
|
||||
</gazebo>
|
||||
|
||||
<gazebo reference="caster_back_right_link">
|
||||
<mu1>0.1</mu1>
|
||||
<mu2>0.1</mu2>
|
||||
<kp>1000000</kp>
|
||||
<kd>100</kd>
|
||||
<minDepth>0.001</minDepth>
|
||||
<maxVel>1</maxVel>
|
||||
<fdir1>1 0 0</fdir1>
|
||||
<material>Gazebo/FlatBlack</material>
|
||||
</gazebo>
|
||||
|
||||
<gazebo reference="caster_back_left_link">
|
||||
<mu1>0.1</mu1>
|
||||
<mu2>0.1</mu2>
|
||||
<kp>1000000</kp>
|
||||
<kd>100</kd>
|
||||
<minDepth>0.001</minDepth>
|
||||
<maxVel>1</maxVel>
|
||||
<fdir1>1 0 0</fdir1>
|
||||
<material>Gazebo/FlatBlack</material>
|
||||
</gazebo>
|
||||
|
||||
<gazebo>
|
||||
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
|
||||
<robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
|
||||
<lagacyModeNS>true</lagacyModeNS>
|
||||
</plugin>
|
||||
</gazebo>
|
||||
|
||||
<transmission name="wheel_left_tranmission">
|
||||
<type>transmission_interface/SimpleTransmission</type>
|
||||
<joint name="wheel_left_joint">
|
||||
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
|
||||
</joint>
|
||||
<actuator name="wheel_left_actuator">
|
||||
<mechanicalReduction>1.0</mechanicalReduction>
|
||||
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
|
||||
</actuator>
|
||||
</transmission>
|
||||
|
||||
<transmission name="wheel_right_tranmission">
|
||||
<type>transmission_interface/SimpleTransmission</type>
|
||||
<joint name="wheel_right_joint">
|
||||
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
|
||||
</joint>
|
||||
<actuator name="wheel_right_actuator">
|
||||
<mechanicalReduction>1.0</mechanicalReduction>
|
||||
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
|
||||
</actuator>
|
||||
</transmission>
|
||||
</robot>
|
||||
Loading…
Reference in New Issue