-
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.
Fixes, launch from launch file instead from motor_node
- Loading branch information
1 parent
4e2eaf0
commit 32151c8
Showing
14 changed files
with
237 additions
and
636 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
# Ubiquity motor ROS 2 | ||
|
||
## Build the motor node and its msgs | ||
colcon build --base-paths src/ubiquity_motor_ros2 src/ubiquity_motor_ros2/ubiquity_motor_ros2_msgs --cmake-args --event-handlers console_direct+ | ||
colcon build --base-paths src/ubiquity_motor_ros2 src/ubiquity_motor_ros2/ubiquity_motor_ros2_msgs --cmake-args --event-handlers console_direct+ | ||
|
||
## Run motor node | ||
|
||
ros2 launch ubiquity_motor_ros2 motors.launch.py | ||
|
||
## Teleop | ||
|
||
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -p stamped:=true --remap cmd_vel:=/ubiquity_velocity_controller/cmd_vel |
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,55 @@ | ||
controller_manager: | ||
ros__parameters: | ||
update_rate: 20 | ||
|
||
ubiquity_velocity_controller: | ||
# ros__parameters: | ||
type: "diff_drive_controller/DiffDriveController" | ||
|
||
|
||
ubiquity_velocity_controller: | ||
ros__parameters: | ||
# Specify the joints connected to the wheels | ||
left_wheel_names: ["left_wheel_joint"] | ||
right_wheel_names: ["right_wheel_joint"] | ||
|
||
# Publish rate for odometry messages | ||
publish_rate: 50.0 | ||
|
||
# Covariance for pose and twist (six elements representing the covariance matrix diagonal) | ||
pose_covariance_diagonal: [0.2, 0.2, 0.2, 0.2, 0.2, 0.2] | ||
twist_covariance_diagonal: [0.2, 0.2, 0.2, 0.2, 0.2, 0.2] | ||
|
||
# Velocity command timeout | ||
cmd_vel_timeout: 0.25 | ||
|
||
# Enable publishing of the transform from odom to base_frame_id | ||
enable_odom_tf: true | ||
|
||
# Robot physical parameters | ||
wheel_separation: 0.33 | ||
wheel_radius: 0.1015 | ||
|
||
# Base frame ID for the robot | ||
base_frame_id: "base_footprint" | ||
|
||
# Multipliers to adjust wheel separation and radius | ||
wheel_separation_multiplier: 1.0 | ||
wheel_radius_multiplier: 1.0 | ||
|
||
# Velocity and acceleration limits for linear and angular motion | ||
linear: | ||
x: | ||
has_velocity_limits: true | ||
max_velocity: 1.0 | ||
has_acceleration_limits: true | ||
max_acceleration: 1.1 | ||
|
||
angular: | ||
z: | ||
has_velocity_limits: true | ||
max_velocity: 2.0 | ||
has_acceleration_limits: true | ||
max_acceleration: 5.0 | ||
|
||
|
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import os | ||
import launch | ||
import launch_ros.actions | ||
from launch.actions import DeclareLaunchArgument, ExecuteProcess, LogInfo | ||
from launch.substitutions import Command, LaunchConfiguration, PathJoinSubstitution | ||
from launch_ros.substitutions import FindPackageShare | ||
|
||
def generate_launch_description(): | ||
# Define the path to the xacro file | ||
xacro_file = PathJoinSubstitution( | ||
[FindPackageShare('magni_description'), 'urdf', 'magni.urdf.xacro'] | ||
) | ||
|
||
# Define the command to run xacro as a subprocess | ||
xacro_command = Command( | ||
[ | ||
'xacro ', xacro_file, | ||
] | ||
) | ||
|
||
# Use ExecuteProcess to run the xacro command | ||
run_xacro = ExecuteProcess( | ||
cmd=['xacro', xacro_file], | ||
output='screen', | ||
shell=True | ||
) | ||
|
||
# Use the robot_description generated from the xacro command | ||
robot_state_publisher = launch_ros.actions.Node( | ||
package='robot_state_publisher', | ||
executable='robot_state_publisher', | ||
output='screen', | ||
parameters=[{'robot_description': xacro_command}] | ||
) | ||
|
||
# ros2_control_node | ||
# Step 1: Run the stty command to configure the serial port | ||
serial_config = ExecuteProcess( | ||
cmd=['sudo', 'stty', '-F', '/dev/ttyS0', 'sane'], | ||
shell=True | ||
) | ||
|
||
# Path to the test.yaml configuration file | ||
config_file = PathJoinSubstitution( | ||
[FindPackageShare('ubiquity_motor_ros2'), 'cfg', 'conf.yaml'] | ||
) | ||
|
||
# Step 2: Run the ros2_control_node with parameters | ||
controller_node = launch_ros.actions.Node( | ||
package='controller_manager', | ||
executable='ros2_control_node', | ||
output='screen', | ||
parameters=[config_file], | ||
) | ||
|
||
# Spawning the controller using spawner command | ||
spawn_controller = ExecuteProcess( | ||
cmd=[ | ||
'ros2', 'run', 'controller_manager', 'spawner', 'ubiquity_velocity_controller' | ||
], | ||
output='screen' | ||
) | ||
|
||
# Return the launch description without ros2_control_node | ||
return launch.LaunchDescription([ | ||
run_xacro, # Runs the xacro process | ||
robot_state_publisher, # Starts the robot_state_publisher with xacro output | ||
serial_config, | ||
controller_node, | ||
spawn_controller | ||
]) |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.