Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

シミュレータ環境に擬似的なラズパイマウスノードを追加 #69

Merged
merged 9 commits into from
Oct 16, 2023

Conversation

YusukeKato
Copy link
Contributor

@YusukeKato YusukeKato commented Oct 11, 2023

What does this implement/fix?

raspimouse_ros2_examplesのjoystick_controlを実行するために、Gazebo起動時に擬似的なラズパイマウスノードを起動します。

理由は下記のコマンドを実行しても、ラズパイマウスノードの3つのサービスが存在せず、cmd_velトピックが配信されないため。

ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=false

警告↓

[joystick_control.py-2] [WARN] [1696487338.996039667] [joystick_control]: raspimouse/get_state service not available

Does this close any currently open issues?

しません。

How has this been tested?

1つ目の端末で下記のコマンドを実行します。

ros2 launch raspimouse_gazebo raspimouse_with_emptyworld.launch.py

2つ目の端末で下記のコマンドを実行します。

ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=false

このとき下記のログが出力されます。

[component_container_mt-8] [INFO] [1697014237.789293288] [raspimouse]: fake_raspimouse node is configured.
[component_container_mt-8] [INFO] [1697014237.790332010] [raspimouse]: fake_raspimouse node is activated.

ジョイスティックコントローラをPCに接続して操作するとcmd_velトピックが配信されます。

ただし、トピック名がシミュレータ側とサンプル側で異なるので、シミュレータ上のラズパイマウスは動きません。

# シミュレータ側のトピック名
/diff_drive_controller/cmd_vel_unstamped
# サンプル側のトピック名
/cmd_vel

また下記のコマンドを実行すると、モータがONになったことを知らせるログが出力されます。

$ ros2 service call /motor_power std_srvs/SetBool '{data: true}'

requester: making request: std_srvs.srv.SetBool_Request(data=True)

response:
std_srvs.srv.SetBool_Response(success=True, message='Motors are on')

Any other comments?

Checklists

@YusukeKato YusukeKato self-assigned this Oct 11, 2023
@YusukeKato YusukeKato added the Type: Feature New Feature label Oct 11, 2023
@YusukeKato YusukeKato marked this pull request as ready for review October 11, 2023 07:14
@YusukeKato
Copy link
Contributor Author

lifecycle_node_manager.cppを削除したので、概要文を修正しました。

Copy link

@ShotaAk ShotaAk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

実装内容は良いと思います。

細かいコメントをしたので対応お願いします。


ament_export_dependencies(rclcpp)
ament_export_dependencies(rclcpp_components)
ament_export_dependencies(rclcpp_lifecycle)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std_srvsも追加してください

Suggested change
ament_export_dependencies(rclcpp_lifecycle)
ament_export_dependencies(rclcpp_lifecycle)
ament_export_dependencies(std_srvs)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lifecycle_msgs も使用しているので、find_packgeやdepend等を追加してください。

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lifecycle_msgsも追加してください

Copy link

@ShotaAk ShotaAk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ShotaAk ShotaAk merged commit 4249b47 into ros2 Oct 16, 2023
2 checks passed
@ShotaAk ShotaAk deleted the add-fake-raspimouse-node branch October 16, 2023 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants