forked from iRobotEducation/create3_sim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds diffdrive controller (iRobotEducation#4)
* diffdrive control package * removes unnecessary dependency * Adds missing dependencies * code cleanup * comment hard to understand code * address review comments * updates control.yaml * included into irobot_create_gazebo and launched from there * fix flake 8 erros * applies 'safety enabled' controller parameters to robot * uses joint_state_publisher instead of joint_state_publisher_gui * Address comments * doubled the cmd_vel_timeout * republish node * Address comments * Adds QoS parameter * Add resource directory * creates irobot_create_toolbox package * changes order of node execution * same name convention to variables * correct flake8 errors * more flake 8 fixes * new line at end of gitignore * flake8 * flake8 * replace subscription by underscore * rename QoS to qos * add dependency rcl_interfaces * add test_depends * get qos and message type by inspecting publisher * adds uncrustify * fix flake 8 * updates .gitignore * check_published_topic moved to init * Adds the correct version of uncrustify and makes republisher output debug. * Fix merge conflicts * Fix uncrustify failures * Update irobot_create_toolbox/irobot_create_toolbox/topic_republisher.py Co-authored-by: Emiliano Borghi <creativa_eborghi@irobot.com> * Add comments to explain functionality * removes uncrustify because collides with clang_format * Obtain qos and msg_type from subscriber * Adds docstrings * Subscription instead of subscriber * docstring how to use the tool Co-authored-by: Emiliano Borghi <creativa_eborghi@irobot.com>
- Loading branch information
1 parent
aac3471
commit 40d3c41
Showing
20 changed files
with
403 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.vscode | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
project(irobot_create_control) | ||
|
||
find_package(ament_cmake REQUIRED) | ||
|
||
install( | ||
DIRECTORY | ||
launch | ||
config | ||
DESTINATION | ||
share/${PROJECT_NAME}/ | ||
) | ||
|
||
ament_package() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
controller_manager: | ||
ros__parameters: | ||
update_rate: 100 # Hz | ||
|
||
joint_state_broadcaster: | ||
type: joint_state_broadcaster/JointStateBroadcaster | ||
|
||
diffdrive_controller: | ||
type: diff_drive_controller/DiffDriveController | ||
|
||
diffdrive_controller: | ||
ros__parameters: | ||
left_wheel_names: ["wheel_left_joint"] | ||
right_wheel_names: ["wheel_right_joint"] | ||
|
||
wheel_separation: 0.233 | ||
wheel_radius: 0.03575 | ||
|
||
# Multiplier applied to the wheel separation parameter. | ||
# This is used to account for a difference between the robot model and a real robot. | ||
wheel_separation_multiplier: 1.0 | ||
|
||
# Multipliers applied to the wheel radius parameter. | ||
# This is used to account for a difference between the robot model and a real robot. | ||
left_wheel_radius_multiplier: 1.0 | ||
right_wheel_radius_multiplier: 1.0 | ||
|
||
publish_rate: 62.0 | ||
odom_frame_id: odom | ||
base_frame_id: base_footprint | ||
pose_covariance_diagonal : [0.001, 0.001, 0.001, 0.001, 0.001, 0.01] | ||
twist_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.01] | ||
|
||
open_loop: false | ||
enable_odom_tf: true | ||
|
||
cmd_vel_timeout: 0.5 | ||
use_stamped_vel: false | ||
|
||
# Preserve turning radius when limiting speed/acceleration/jerk | ||
preserve_turning_radius: true | ||
|
||
# Publish limited velocity | ||
publish_cmd: true | ||
|
||
# Publish wheel data | ||
publish_wheel_data: true | ||
|
||
# Velocity and acceleration limits | ||
# Whenever a min_* is unspecified, default to -max_* | ||
linear.x.has_velocity_limits: true | ||
linear.x.has_acceleration_limits: true | ||
linear.x.has_jerk_limits: false | ||
linear.x.max_velocity: 0.306 | ||
linear.x.min_velocity: -0.306 | ||
linear.x.max_acceleration: 0.9 | ||
# Not using jerk limits yet | ||
# linear.x.max_jerk: 0.0 | ||
# linear.x.min_jerk: 0.0 | ||
|
||
angular.z.has_velocity_limits: true | ||
angular.z.has_acceleration_limits: false | ||
angular.z.has_jerk_limits: false | ||
angular.z.max_velocity: 1.9 | ||
angular.z.min_velocity: -1.9 | ||
# Not using angular acceleration limits yet | ||
# angular.z.max_acceleration: 1.0 | ||
# angular.z.min_acceleration: -1.0 | ||
# Not using jerk limits yet | ||
# angular.z.max_jerk: 0.0 | ||
# angular.z.min_jerk: 0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright 2021 iRobot Corporation. All Rights Reserved. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# @author Rodrigo Jose Causarano Nunez (rcausaran@irobot.com) | ||
# | ||
# Launch Create3 with diffdrive controller in Gazebo and optionally also in RViz. | ||
|
||
from ament_index_python.packages import get_package_share_directory | ||
from launch import LaunchDescription | ||
from launch.actions import RegisterEventHandler | ||
from launch.event_handlers import OnProcessExit | ||
from launch.substitutions import PathJoinSubstitution | ||
from launch_ros.actions import Node | ||
|
||
|
||
def generate_launch_description(): | ||
pkg_create3_control = get_package_share_directory('irobot_create_control') | ||
|
||
control_params_file = PathJoinSubstitution( | ||
[pkg_create3_control, 'config', 'control.yaml']) | ||
|
||
diffdrive_controller_node = Node( | ||
package='controller_manager', | ||
executable='spawner.py', | ||
parameters=[control_params_file], | ||
arguments=['diffdrive_controller', '-c', '/controller_manager'], | ||
output='screen', | ||
) | ||
|
||
joint_state_broadcaster_spawner = Node( | ||
package='controller_manager', | ||
executable='spawner.py', | ||
arguments=['joint_state_broadcaster', '-c', '/controller_manager'], | ||
output='screen', | ||
) | ||
|
||
cmd_vel_republish_node = Node( | ||
package='irobot_create_toolbox', | ||
name='republish_node', | ||
executable='topic_republisher', | ||
parameters=[ | ||
{'current_topic': 'cmd_vel'}, | ||
{'new_topic': 'diffdrive_controller/cmd_vel_unstamped'}, | ||
] | ||
) | ||
|
||
# Ensure diffdrive_controller_node starts after joint_state_broadcaster_spawner | ||
diffdrive_controller_callback = RegisterEventHandler( | ||
event_handler=OnProcessExit( | ||
target_action=joint_state_broadcaster_spawner, | ||
on_exit=[diffdrive_controller_node], | ||
) | ||
) | ||
|
||
ld = LaunchDescription() | ||
|
||
ld.add_action(joint_state_broadcaster_spawner) | ||
ld.add_action(diffdrive_controller_callback) | ||
ld.add_action(cmd_vel_republish_node) | ||
|
||
return ld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0"?> | ||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
<package format="3"> | ||
<name>irobot_create_control</name> | ||
<version>0.0.1</version> | ||
<description>Provides the diff-drive controller for the iRobot Create 3 platform.</description> | ||
<maintainer email="ekumen@irbt.onmicrosoft.com">Ekumen</maintainer> | ||
<license>Apache-2.0</license> | ||
|
||
<author>iRobot</author> | ||
|
||
<buildtool_depend>ament_cmake</buildtool_depend> | ||
|
||
<exec_depend>ros2launch</exec_depend> | ||
<exec_depend>gazebo_ros2_control</exec_depend> | ||
<exec_depend>joint_state_controller</exec_depend> | ||
<exec_depend>ros2_controllers</exec_depend> | ||
<exec_depend>irobot_create_toolbox</exec_depend> | ||
|
||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>ament_lint_common</test_depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.