-
Notifications
You must be signed in to change notification settings - Fork 7
sender with yaml config #62
Changes from 6 commits
02def9b
91f1c39
6bec70e
3cb6f7c
c275c6f
85a47ee
2644080
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# consai2_sender | ||
|
||
ロボット(grSim)へ動作司令を送信するパッケージです。 | ||
<!-- ロボット(実機/grSim)へ動作司令を送信するパッケージです。 --> | ||
|
||
|
||
## ノードの起動方法 | ||
|
||
次のコマンドでsenderが起動します。 | ||
|
||
```sh | ||
ros2 launch consai2r2_sender sender.launch.py | ||
``` | ||
|
||
<!-- | ||
## 実機 / grSim の切り替え方法 | ||
|
||
`consai2_sender/launch/sender.launch`を編集するか、 | ||
launchファイルの引数で設定できます。 | ||
|
||
```sh | ||
# 例:実機のロボットに動作司令を送信する | ||
roslaunch consai2_sender sender.launch sim:=false | ||
|
||
# 例:grSimのロボットに動作司令を送信する | ||
roslaunch consai2_sender sender.launch sim:=true | ||
``` | ||
--> | ||
|
||
<!-- | ||
## grSimのサーバアドレス・ポートの変更方法 | ||
|
||
`consai2_description/param/game.yaml`を編集します。 | ||
--> | ||
|
||
<!-- | ||
## 実機送信機のデバイス・ボーレートの変更方法 | ||
|
||
`consai2_description/param/game.yaml`を編集します。 | ||
|
||
## Subsribe Topics | ||
- sim_sender | ||
- consai2_control/robot_commands' (consai2_msgs/RobotCommands) | ||
- ロボットの動作司令 | ||
- real_sender | ||
- consai2_control/robot_commands' (consai2_msgs/RobotCommands) | ||
- ロボットの動作司令 | ||
--> | ||
|
||
## 参考ページ | ||
### Google proto files --> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 末尾の |
||
- grSim | ||
- https://github.com/RoboCup-SSL/grSim/tree/master/src/proto |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
consai2r2_sim_sender: | ||
ros__parameters: | ||
grsim_addr: '127.0.0.1' | ||
grsim_port: 20011 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright (c) 2019 SSL-Roots | ||
# | ||
# 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 | ||
from ament_index_python.packages import get_package_share_directory | ||
from launch import LaunchDescription | ||
from launch_ros.actions import Node | ||
|
||
|
||
def generate_launch_description(): | ||
start_sender_cmd = Node( | ||
package='consai2r2_sender', node_executable='sim_sender', | ||
output='screen', | ||
parameters=[os.path.join(get_package_share_directory( | ||
'consai2r2_sender'), 'config', 'grsim.yaml')] | ||
) | ||
|
||
ld = LaunchDescription() | ||
|
||
ld.add_action(start_sender_cmd) | ||
|
||
return ld |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,13 +8,16 @@ | |
<license>MIT</license> | ||
|
||
<buildtool_depend>ament_cmake</buildtool_depend> | ||
<buildtool_depend>python_cmake_module</buildtool_depend> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不要なので,削除する方向で修正します.ありがとうございます. |
||
|
||
<depend>rclcpp</depend> | ||
<depend>std_msgs</depend> | ||
<depend>consai2r2_msgs</depend> | ||
<depend>protobuf-dev</depend> | ||
<depend>boost</depend> | ||
|
||
<exec_depend>ament_index_python</exec_depend> | ||
<exec_depend>launch_ros</exec_depend> | ||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>ament_lint_common</test_depend> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
#include "grSim_Replacement.pb.h" | ||
|
||
using std::placeholders::_1; | ||
using namespace std::chrono_literals; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. こちらに関しては,同期パラメータクライアントが必要だと思いこんでいた際にパラメータ取得待ちのため追加したものでした. |
||
|
||
namespace asio = boost::asio; | ||
|
||
|
@@ -63,14 +64,10 @@ class SimSender : public rclcpp::Node | |
SimSender() | ||
: Node("consai2r2_sim_sender") | ||
{ | ||
std::string host; | ||
int port; | ||
|
||
this->declare_parameter("grsim_addr", "127.0.0.1"); | ||
this->declare_parameter("grsim_port", 20011); | ||
|
||
this->get_parameter("grsim_addr", host); | ||
this->get_parameter("grsim_port", port); | ||
auto host = this->get_parameter("grsim_addr").as_string(); | ||
auto port = this->get_parameter("grsim_port").as_int(); | ||
|
||
sub_commands_ = this->create_subscription<consai2r2_msgs::msg::RobotCommands>( | ||
"robot_commands", 10, std::bind(&SimSender::send_commands, this, std::placeholders::_1)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ついでに
consai2r2_sender
にしてくれるとありがたいです。