Skip to content

Commit

Permalink
Merge pull request #63 from ichiro-its/feature/adapt-main-to-ros2-launch
Browse files Browse the repository at this point in the history
[Feature / PD-420] Adapt Tachimawari Main to Remove Ros Arguments
  • Loading branch information
hiikariri authored Jun 25, 2024
2 parents 399e94e + ac8029a commit 39e20e0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 5 deletions.
40 changes: 40 additions & 0 deletions launch/tachimawari_launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (c) 2024 ICHIRO ITS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import os
import socket
from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
hostname = socket.gethostname()
config_path = os.path.expanduser(f'~/ros2-ws/configuration/{hostname}/ipm/')

return LaunchDescription([
Node(
package='tachimawari',
executable='main',
name='main',
output='screen',
arguments=['cm740', config_path],
respawn=True,
respawn_delay=1
)
])
10 changes: 5 additions & 5 deletions src/tachimawari_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@

int main(int argc, char * argv[])
{
rclcpp::init(argc, argv);
auto args = rclcpp::init_and_remove_ros_arguments(argc, argv);

if (argc < 2) {
if (args.size() < 2) {
std::cerr << "Please specify the mode! [sdk / cm740]" << std::endl;
return 0;
} else if (argc < 3) {
} else if (args.size() < 3) {
std::cerr << "Please specify the tf configuration path" << std::endl;
}

std::string mode = argv[1];
std::string path = argv[2];
std::string mode = args[1];
std::string path = args[2];
std::shared_ptr<tachimawari::control::ControlManager> controller;

if (mode == "sdk") {
Expand Down

0 comments on commit 39e20e0

Please sign in to comment.