-
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.
- Loading branch information
Showing
5 changed files
with
136 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# SPDX-FileCopyrightText: 2025 Kenta Hirachi | ||
# SPDX-License=Identifier: Apache 2.0 | ||
|
||
import rclpy | ||
from rclpy.node import Node | ||
from geometry_msgs.msg import Twist | ||
|
||
class keyboard_receive(Node): | ||
def __init__(self): | ||
super().__init__('cmd_vel_subscriber') | ||
self.subscription = self.create_subscription(Twist,'cmd_vel',self.listener_callback,10) | ||
self.subscription | ||
|
||
def listener_callback(self, msg): | ||
|
||
self.get_logger().info(f"Received Twist message: linear.x = {msg.linear.x}, linear.y = {msg.linear.y}, angular.z = {msg.angular.z}") | ||
|
||
def main(): | ||
rclpy.init() | ||
node = keyboard_receive() | ||
rclpy.spin(node) | ||
rclpy.shutdown() | ||
|
||
if __name__ == '__main__': | ||
main() | ||
|
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,23 @@ | ||
# SPDX-FileCopyrightText: 2025 Kenta Hirachi | ||
# SPDX-License=Identifier: Apache 2.0 | ||
|
||
import launch | ||
import launch.actions | ||
import launch.substitutions | ||
import launch_ros.actions | ||
|
||
def generate_launch_description(): | ||
return launch.LaunchDescription([ | ||
|
||
launch_ros.actions.Node( | ||
package='keyboard_teleop', | ||
executable='keyboard_teleop' | ||
), | ||
|
||
launch_ros.actions.Node( | ||
package='keyboard_teleop', | ||
executable='keyboard_receive', | ||
output='screen', | ||
), | ||
]) | ||
|
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