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

Rover: add lidar to rover example #34

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

srmainwaring
Copy link
Collaborator

@srmainwaring srmainwaring commented Oct 7, 2023

This is a follow up to #33 that adds a lidar to the rover model. It enables the rover model to be used with the cartographer and navigation launch configurations developed by @pedro-fuoco as part of his 2023 GSoC project.

Dependencies

For testing and further details see the descriptions in the above PRs.

Tasks

@srmainwaring srmainwaring added the enhancement New feature or request label Oct 7, 2023
Copy link
Collaborator

@Ryanf55 Ryanf55 left a comment

Choose a reason for hiding this comment

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

Works well, only thing was for building, do this instead of what you said:

colcon build --packages-up-to ardupilot_gz_bringup

Do you intend to add the models repo to here: https://raw.githubusercontent.com/ArduPilot/ardupilot_gz/main/ros2_gz.repos?

When testing, looks a package wasn't built that needed to be. ros_gz_bridge was missing as a dependency, even before your PR. Here's a patch: srmainwaring#1

ryan@B650-970:~/Dev/ros2_ws$ ros2 launch ardupilot_gz_bringup wildthumper_playpen.launch.py rviz:=true use_gz_tf:=true
[INFO] [launch]: All log files can be found below /home/ryan/.ros/log/2023-10-24-20-22-46-006796-B650-970-94165
[INFO] [launch]: Default logging verbosity is set to INFO
namespace:        
transport:        udp4
middleware:       dds
verbose:          4
discovery:        7400
port:             2019
refs:             /home/ryan/Dev/ros2_ws/install/ardupilot_sitl/share/ardupilot_sitl/config/dds_xrce_profile.xml
command:          ardurover
model:            json
speedup:          1
slave:            0
sim_address:      127.0.0.1
instance:         0
defaults:         /home/ryan/Dev/ros2_ws/install/ardupilot_sitl/share/ardupilot_sitl/config/default_params/rover-skid.parm,/home/ryan/Dev/ros2_ws/install/ardupilot_sitl/share/ardupilot_sitl/config/default_params/dds_udp.parm
synthetic_clock:  True
command:          mavproxy.py
master:           tcp:127.0.0.1:5760
sitl:             127.0.0.1:5501
[ERROR] [launch]: Caught exception in launch (see debug for traceback): "package 'ros_gz_bridge' not found, searching: ['/home/ryan/Dev/ros2_ws/install/ardupilot_gz_bringup', '/home/ryan/Dev/ros2_ws/install/ros_gz_sim', '/home/ryan/Dev/ros2_ws/install/ardupilot_sitl', '/home/ryan/Dev/ros2_ws/install/micro_ros_agent', '/home/ryan/Dev/ros2_ws/install/ardupilot_sitl_models', '/home/ryan/Dev/ros2_ws/install/ardupilot_msgs', '/home/ryan/Dev/ros2_ws/install/ardupilot_gz_gazebo', '/home/ryan/Dev/ros2_ws/install/ardupilot_gz_description', '/opt/ros/humble']"

@srmainwaring
Copy link
Collaborator Author

Here's a patch: srmainwaring#1

Merged and updated in PR.

@srmainwaring
Copy link
Collaborator Author

Do you intend to add the models repo to here: https://raw.githubusercontent.com/ArduPilot/ardupilot_gz/main/ros2_gz.repos?

0a570cd

@Ryanf55
Copy link
Collaborator

Ryanf55 commented Oct 26, 2023

With latest changes:

[ERROR] [launch]: Caught exception in launch (see debug for traceback): "package 'topic_tools' not found, searching: ['/home/ryan/Dev/ros2_ws/install_humble/ardupilot_gz_bringup', '/home/ryan/Dev/ros2_ws/install_humble/ros_gz_sim', '/home/ryan/Dev/ros2_ws/install_humble/ros_gz_bridge', '/home/ryan/Dev/ros2_ws/install_humble/ros_gz_interfaces', '/home/ryan/Dev/ros2_ws/install_humble/ardupilot_sitl', '/home/ryan/Dev/ros2_ws/install_humble/micro_ros_agent', '/home/ryan/Dev/ros2_ws/install_humble/ardupilot_sitl_models', '/home/ryan/Dev/ros2_ws/install_humble/ardupilot_gz_gazebo', '/home/ryan/Dev/ros2_ws/install_humble/ardupilot_gz_description', '/home/ryan/Dev/ros2_ws/install_humble/ardupilot_gazebo', '/home/ryan/Dev/ros2_ws/install/ardupilot_sitl_models', '/home/ryan/Dev/ros2_ws/install/ardupilot_gazebo', '/home/ryan/Dev/ros2_ws/install/ardupilot_gz_bringup', '/home/ryan/Dev/ros2_ws/install/ros_gz_sim', '/home/ryan/Dev/ros2_ws/install/ardupilot_sitl', '/home/ryan/Dev/ros2_ws/install/micro_ros_agent', '/home/ryan/Dev/ros2_ws/install/ardupilot_gz_gazebo', '/home/ryan/Dev/ros2_ws/install/ardupilot_gz_description', '/opt/ros/humble']"

Perhaps add this to the workspace or package.xml if binaries are available?
https://github.com/ros-tooling/topic_tools

@srmainwaring
Copy link
Collaborator Author

Ah, thought I'd added topic_tools to the package.xml already. Will update.

@Ryanf55
Copy link
Collaborator

Ryanf55 commented Oct 26, 2023

Ah, thought I'd added topic_tools to the package.xml already. Will update.

Seems like it's an issue for iris_maze.launch.py also; it was missed earlier.

@srmainwaring
Copy link
Collaborator Author

Seems like it's an issue for iris_maze.launch.py also; it was missed earlier.

No, wasn't missed. A dependency on topic_tools is in main as an <exec_depend>:

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_python</buildtool_depend>
<exec_depend>ament_index_python</exec_depend>
<exec_depend>ardupilot_gz_description</exec_depend>
<exec_depend>ardupilot_gz_gazebo</exec_depend>
<exec_depend>ardupilot_sitl</exec_depend>
<exec_depend>launch</exec_depend>
<exec_depend>launch_ros</exec_depend>
<exec_depend>ros_gz_sim</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>topic_tools</exec_depend>
<test_depend>ament_cmake_pytest</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

@Ryanf55
Copy link
Collaborator

Ryanf55 commented Oct 26, 2023

Seems like it's an issue for iris_maze.launch.py also; it was missed earlier.

No, wasn't missed. A dependency on topic_tools is in main as an <exec_depend>:

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_python</buildtool_depend>
<exec_depend>ament_index_python</exec_depend>
<exec_depend>ardupilot_gz_description</exec_depend>
<exec_depend>ardupilot_gz_gazebo</exec_depend>
<exec_depend>ardupilot_sitl</exec_depend>
<exec_depend>launch</exec_depend>
<exec_depend>launch_ros</exec_depend>
<exec_depend>ros_gz_sim</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>topic_tools</exec_depend>
<test_depend>ament_cmake_pytest</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

Ah my bad, I missed the rosdep call. Alright, after re-running that, robot_state_publisher is crashing. Same behavior on iris_runway and wildthumper_playpen.

ryan@B650-970:~/Dev/ros2_ws$ ros2 launch ardupilot_gz_bringup iris_runway.launch.py rviz:=true use_gz_tf:=true
[INFO] [launch]: All log files can be found below /home/ryan/.ros/log/2023-10-26-15-54-35-059657-B650-970-144838
[INFO] [launch]: Default logging verbosity is set to INFO
namespace:        
transport:        udp4
middleware:       dds
verbose:          4
discovery:        7400
port:             2019
refs:             /home/ryan/Dev/ros2_ws/install_humble/ardupilot_sitl/share/ardupilot_sitl/config/dds_xrce_profile.xml
command:          arducopter
model:            json
speedup:          1
slave:            0
sim_address:      127.0.0.1
instance:         0
defaults:         /home/ryan/Dev/ros2_ws/install_humble/ardupilot_gazebo/share/ardupilot_gazebo/config/gazebo-iris-gimbal.parm,/home/ryan/Dev/ros2_ws/install_humble/ardupilot_sitl/share/ardupilot_sitl/config/default_params/dds_udp.parm
synthetic_clock:  True
command:          mavproxy.py
master:           tcp:127.0.0.1:5760
sitl:             127.0.0.1:5501
[INFO] [ruby $(which gz) sim-1]: process started with pid [144839]
[INFO] [ruby $(which gz) sim-2]: process started with pid [144841]
[INFO] [micro_ros_agent-3]: process started with pid [144843]
[INFO] [dds_udp.parm --synthetic-clock -4]: process started with pid [144845]
[INFO] [mavproxy.py --out 127.0.0.1:14550 --out 127.0.0.1:14551 --master tcp:127.0.0.1:5760 --sitl 127.0.0.1:5501 --non-interactive -5]: process started with pid [144848]
[INFO] [robot_state_publisher-6]: process started with pid [144851]
[INFO] [parameter_bridge-7]: process started with pid [144856]
[INFO] [rviz2-8]: process started with pid [144858]
[dds_udp.parm --synthetic-clock -4] Setting SIM_SPEEDUP=1.000000
[dds_udp.parm --synthetic-clock -4] Starting SITL: JSON
[dds_udp.parm --synthetic-clock -4] JSON control interface set to 127.0.0.1:9002
[dds_udp.parm --synthetic-clock -4] Starting sketch 'ArduCopter'
[dds_udp.parm --synthetic-clock -4] Starting SITL input
[dds_udp.parm --synthetic-clock -4] Using Irlock at port : 9005
[dds_udp.parm --synthetic-clock -4] Waiting for connection ....
[INFO] [relay-9]: process started with pid [144861]
[dds_udp.parm --synthetic-clock -4] bind port 5760 for 0
[dds_udp.parm --synthetic-clock -4] Serial port 0 on TCP port 5760
[micro_ros_agent-3] [1698357275.179578] info     | UDPv4AgentLinux.cpp | init                     | running...             | port: 2019
[micro_ros_agent-3] [1698357275.180044] info     | Root.cpp           | set_verbose_level        | logger setup           | verbose_level: 4
[robot_state_publisher-6] Error:   Could not find the 'robot' element in the xml file
[robot_state_publisher-6]          at line 109 in ./urdf_parser/src/model.cpp
[robot_state_publisher-6] Failed to parse robot description using: urdf_xml_parser/URDFXMLParser
[robot_state_publisher-6] terminate called after throwing an instance of 'std::runtime_error'
[robot_state_publisher-6]   what():  Unable to initialize urdf::model from robot description

This is with the command in the README.

@srmainwaring
Copy link
Collaborator Author

srmainwaring commented Oct 26, 2023

Now that looks like a missing exec dependency on sdformat_urdf.

Added to #33 in 54314b8 and rebased this PR on #33.

@srmainwaring srmainwaring force-pushed the prs/pr-rover-part2 branch 2 times, most recently from 0743b7c to 869fced Compare October 26, 2023 23:08
Signed-off-by: Rhys Mainwaring <[email protected]>

Rover: add SITL_Models to ros2 repos

Signed-off-by: Rhys Mainwaring <[email protected]>
Copy link
Collaborator

@Ryanf55 Ryanf55 left a comment

Choose a reason for hiding this comment

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

The code is working, the lidar is added and detecting in rviz. I could spin it around with rc 1 1450 and see the lidar continues to report in the correct frame (static with respect to the world).

image

Just a minor change needed on branch names.

ros2_gz.repos Show resolved Hide resolved
ros2_gz_macos.repos Show resolved Hide resolved
@Ryanf55 Ryanf55 merged commit 49706c7 into ArduPilot:main Oct 27, 2023
@srmainwaring srmainwaring deleted the prs/pr-rover-part2 branch October 27, 2023 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants