mirror of
https://github.com/bjoernellens1/cps_loki.git
synced 2024-11-22 23:33:50 +00:00
update
This commit is contained in:
parent
816ff0faf9
commit
1adff23b78
14
README.md
14
README.md
@ -1,7 +1,7 @@
|
||||
# cps_bot_mini_ws
|
||||
temporary ws for developming ros2 control on robot mini with odrive
|
||||
temporary ws for developing ros2 control on robot mini with odrive
|
||||
|
||||
nedded repos are:
|
||||
needed repos are:
|
||||
- https://github.com/bjoernellens1/odrive_ros2_control on branch humble-fw-v0.5.1
|
||||
- https://github.com/bjoernellens1/rmp220_teleop on branch bot_mini
|
||||
- https://github.com/bjoernellens1/ros2_cam_openCV
|
||||
@ -9,4 +9,12 @@ nedded repos are:
|
||||
|
||||
For initialization, just call "python3 initialize.py"
|
||||
|
||||
TODO: extend bot_mini_bringup
|
||||
TODO: extend bot_mini_bringup, python scripts for simplyfiyng startup process.
|
||||
|
||||
## Useful commands:
|
||||
|
||||
### Localization using predefined map and navigation
|
||||
don't forget to set transient_local in rviz to see the map
|
||||
ros2 launch bot_mini_bringup nav2.launch.py map_subscribe_transient_local:=true
|
||||
ros2 launch nav2_bringup localization_launch.py map:=/home/bjorn/Documents/ros_projects/cps_bot_mini_ws/src/bot_mini_bringup/maps/cps_save_map.yaml
|
||||
|
||||
|
BIN
office1_map_save.pgm
Normal file
BIN
office1_map_save.pgm
Normal file
Binary file not shown.
7
office1_map_save.yaml
Normal file
7
office1_map_save.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
image: office1_map_save.pgm
|
||||
mode: trinary
|
||||
resolution: 0.05
|
||||
origin: [1.87, -8.61, 0]
|
||||
negate: 0
|
||||
occupied_thresh: 0.65
|
||||
free_thresh: 0.25
|
BIN
office1_map_serial.data
Normal file
BIN
office1_map_serial.data
Normal file
Binary file not shown.
BIN
office1_map_serial.posegraph
Normal file
BIN
office1_map_serial.posegraph
Normal file
Binary file not shown.
63
run_localization.py
Normal file
63
run_localization.py
Normal file
@ -0,0 +1,63 @@
|
||||
import subprocess
|
||||
import signal
|
||||
import os
|
||||
import time
|
||||
|
||||
processes = []
|
||||
current_directory = os.getcwd()
|
||||
|
||||
def source_setup_files():
|
||||
subprocess.Popen("source /opt/ros/humble/setup.bash", shell=True, executable="/bin/bash")
|
||||
subprocess.Popen("source ./install/setup.bash", shell=True, executable="/bin/bash")
|
||||
print("Setup files sourced")
|
||||
|
||||
def start_process(command):
|
||||
process = subprocess.Popen(command, shell=True, executable="/bin/bash", preexec_fn=os.setsid)
|
||||
processes.append(process)
|
||||
print(f"Started process with command: {command}")
|
||||
|
||||
def stop_processes():
|
||||
for process in processes:
|
||||
os.killpg(os.getpgid(process.pid), signal.SIGTERM)
|
||||
print("Stopped all processes")
|
||||
|
||||
def handle_interrupt(signal, frame):
|
||||
print("Keyboard interrupt detected")
|
||||
stop_processes()
|
||||
exit(0)
|
||||
|
||||
# Define the base command
|
||||
base_command = "ros2 launch bot_mini_bringup"
|
||||
|
||||
# Define the commands to launch
|
||||
launch_commands = [
|
||||
"rsp.launch.py",
|
||||
"robot_controller.launch.py",
|
||||
"robot_joy_teleop.launch.py",
|
||||
"robot_twist_mux.launch.py",
|
||||
"robot_lidar.launch.py"
|
||||
]
|
||||
|
||||
# Add the base directory to the commands
|
||||
commands = [os.path.join(base_command, command) for command in launch_commands]
|
||||
|
||||
# Add the path to the map file
|
||||
map_file = os.path.join(current_directory, "src", "bot_mini_bringup", "maps", "default_save_map.yaml")
|
||||
map_command = f"ros2 launch nav2_bringup localization_launch.py map:={map_file}"
|
||||
commands.append(map_command)
|
||||
|
||||
# Register the signal handler
|
||||
signal.signal(signal.SIGINT, handle_interrupt)
|
||||
|
||||
# Source the setup files
|
||||
source_setup_files()
|
||||
|
||||
# Start the processes
|
||||
for command in commands:
|
||||
start_process(command)
|
||||
|
||||
# Wait for user input to stop the processes
|
||||
input("Press Enter to stop all processes...")
|
||||
|
||||
# Stop all processes
|
||||
stop_processes()
|
@ -27,11 +27,12 @@ def handle_interrupt(signal, frame):
|
||||
|
||||
# Add your commands here
|
||||
commands = [
|
||||
"ros2 launch bot_mini_bringup rsp.launch.py",
|
||||
"ros2 launch bot_mini_bringup controller.launch.py",
|
||||
"ros2 launch bot_mini_bringup joy_teleop.launch.py",
|
||||
"ros2 launch bot_mini_bringup lidar.launch.py",
|
||||
"ros2 launch bot_mini_bringup mapper.launch.py"
|
||||
#"ros2 launch bot_mini_bringup rsp.launch.py",
|
||||
"ros2 launch bot_mini_bringup robot_controller.launch.py",
|
||||
"ros2 launch bot_mini_bringup robot_joy_teleop.launch.py",
|
||||
"ros2 launch bot_mini_bringup robot_twist_mux.launch.py",
|
||||
"ros2 launch bot_mini_bringup robot_lidar.launch.py",
|
||||
"ros2 launch bot_mini_bringup robot_mapper.launch.py"
|
||||
]
|
||||
|
||||
# Register the signal handler
|
||||
|
Loading…
Reference in New Issue
Block a user