working turtlebot3 sim
This commit is contained in:
parent
0893234690
commit
4d41485c47
@ -41,6 +41,9 @@ class TwistPublisher(Node):
|
||||
self.publisher_ = self.create_publisher(
|
||||
Twist, "/diff_cont/cmd_vel_unstamped", 1
|
||||
)
|
||||
|
||||
self.publisher_2 = self.create_publisher(Twist, "/cmd_vel", 1)
|
||||
|
||||
self.create_subscription(Joy, "/joy", self.joy_callback, 1)
|
||||
self.timer = self.create_timer(1 / publish_frequency_hz, self.timer_callback)
|
||||
|
||||
@ -67,9 +70,10 @@ class TwistPublisher(Node):
|
||||
self.update_smooth_window()
|
||||
self.calc_smooth_speed()
|
||||
|
||||
msg.linear.x = self.linear
|
||||
msg.angular.z = self.angular
|
||||
msg.linear.x = self.linear_out
|
||||
msg.angular.z = self.angular_out
|
||||
self.publisher_.publish(msg)
|
||||
self.publisher_2.publish(msg)
|
||||
self.get_logger().info(
|
||||
"Linear_window: {}, Linear_out: {}, Angular_window: {}, Angular_out: {}".format(
|
||||
self.linear_window,
|
||||
|
@ -1,16 +1,19 @@
|
||||
from launch import LaunchDescription
|
||||
from launch_ros.actions import Node
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
return LaunchDescription([
|
||||
Node(
|
||||
package='dcaitirobot',
|
||||
executable='joy',
|
||||
name='joystick',
|
||||
),
|
||||
Node(
|
||||
package='dcaitirobot',
|
||||
executable='twistcalc',
|
||||
name='twistcalc',
|
||||
)
|
||||
])
|
||||
return LaunchDescription(
|
||||
[
|
||||
Node(
|
||||
package="dcaitirobot",
|
||||
executable="joy",
|
||||
name="joystick",
|
||||
),
|
||||
Node(
|
||||
package="dcaitirobot",
|
||||
executable="twistcalc",
|
||||
name="twistcalc",
|
||||
),
|
||||
]
|
||||
)
|
||||
|
44
src/dcaitirobot/launch/start_turtle_slam_sim.py
Normal file
44
src/dcaitirobot/launch/start_turtle_slam_sim.py
Normal file
@ -0,0 +1,44 @@
|
||||
from pathlib import Path
|
||||
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import IncludeLaunchDescription
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
from launch_ros.actions import Node
|
||||
from ament_index_python import get_package_share_directory
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
return LaunchDescription(
|
||||
[
|
||||
IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
str(Path(__file__).parent.absolute() / "remote_control_launch.py")
|
||||
)
|
||||
),
|
||||
IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
str(
|
||||
(
|
||||
Path(
|
||||
get_package_share_directory("turtlebot3_gazebo")
|
||||
).absolute()
|
||||
/ "launch"
|
||||
/ "turtlebot3_world.launch.py"
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
str(
|
||||
(
|
||||
Path(get_package_share_directory("slam_toolbox")).absolute()
|
||||
/ "launch"
|
||||
/ "online_async_launch.py"
|
||||
)
|
||||
)
|
||||
),
|
||||
launch_arguments=[("use_sim_time", "True")],
|
||||
),
|
||||
]
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user