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

Copter: use 3DoF gimbal #59

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

srmainwaring
Copy link
Collaborator

@srmainwaring srmainwaring commented Oct 30, 2024

Change the Iris model to use the 3DoF gimbal.

Dependencies

Testing

Launch simulation

ros2 launch ardupilot_gz_bringup iris_runway.launch.py console:=True

and start a mavproxy interactive session to control:

mavproxy.py --master :14550
 
STABILIZE> mode guided
GUIDED> arm throttle
GUIDED> takeoff 2
GUIDED> Take Off started
GUIDED> rc 3 1500
GUIDED> circle
  • The model appears correctly in Gazebo.
  • The model appears correctly in rviz.
  • The 3DoF gimbal links are visible in rviz2.
  • The camera topic is relayed from Gazebo to ROS 2.
iris-3dof-gimbal-rviz iris-3dof-gimbal-gz

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

Ryanf55 commented Oct 30, 2024

For some reason, I do not get synthetic video, and rviz doesn't show the vehicle frame.

In CLI, I see [Wrn] [ArduPilotPlugin.cc:1585] ArduPilot controller has reset 3 times in the logs.
image

@srmainwaring
Copy link
Collaborator Author

For some reason, I do not get synthetic video, and rviz doesn't show the vehicle frame.

@Ryanf55, I've just checked on an Ubuntu 22.04 VM (Gazebo Harmonic and ROS 2 Humble) - and is working after checking out the two branches and rebuilding. Can you please post the launch terminal log to help trace what might be going on.

@Ryanf55
Copy link
Collaborator

Ryanf55 commented Oct 31, 2024

ardupilot_gz_logs.txt
frames_2024-10-30_18.15.35.pdf

There's no /tf data or /tf_static data.

@srmainwaring
Copy link
Collaborator Author

srmainwaring commented Oct 31, 2024

There's no /tf data or /tf_static data.

The problem is here:

[robot_state_publisher-6] [ERROR] [1730333584.404356089] [sdformat_urdf]: Failed to find sdf canonical link [base_link]
[robot_state_publisher-6] Failed to parse robot description using: sdformat_urdf_plugin/SDFormatURDFParser
[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

Now I'm not sure why that is an issue on your install. It could be related to #49?

Edit if I check out the main branch of ardupilot_gazebo rather than ros2, and re-run, I see this error:

[robot_state_publisher-6] [ERROR] [1730370408.367511000] [sdformat_urdf]: Failed to find sdf canonical link [base_link]
[robot_state_publisher-6] [WARN] [1730370408.367654000] [urdf]: Failed to parse robot description using: sdformat_urdf_plugin/SDFormatURDFParser
[robot_state_publisher-6] 
[robot_state_publisher-6] libc++abi: terminating due to uncaught exception of type std::runtime_error: Unable to initialize urdf::model from robot description
[ERROR] [robot_state_publisher-6]: process has died [pid 87187, exit code -6, cmd '/Users/rhys/Code/ros2/rolling/ros2-rolling/install/robot_state_publisher/lib/robot_state_publisher/robot_state_publisher --ros-args -r __node:=robot_state_publisher --params-file /var/folders/_y/7tf19g6j2wgclxfy1m3nrr9m0000gn/T/launch_params_xo4lzeen --params-file /var/folders/_y/7tf19g6j2wgclxfy1m3nrr9m0000gn/T/launch_params_i4hxw6i3'].

This is because sdformat_urdf can only resolve SDF <uri> elements that use the package:// prefix, which is a ROS construct rather than something native to Gazebo.

One possibility is that your build / install is using the wrong branch of ardupilot_gazebo, or that an iris_with_gimbal model using the model:// prefix in the <uri> is present in the GZ_SIM_RESOURCE_PATH.

@Ryanf55
Copy link
Collaborator

Ryanf55 commented Nov 2, 2024

I checked all branches and fixed using the wrong ardupilot_gazebo branch. Once I do that, the vehicle can takeoff and circle, however the gimbal doesn't seem to be controlled.
image

Nothing seems wrong in the logs other than periodic warnings on the ArduPilot controller has reset periodically. robot_state_publisher is running.

@srmainwaring
Copy link
Collaborator Author

the gimbal doesn't seem to be controlled

Does the gimbal respond to rc commands? The following should centre it.

> rc 6 1500
> rc 7 1500
> rc 8 1500

@Ryanf55
Copy link
Collaborator

Ryanf55 commented Nov 3, 2024

the gimbal doesn't seem to be controlled

Does the gimbal respond to rc commands? The following should centre it.

> rc 6 1500
> rc 7 1500
> rc 8 1500

With rc 7 1680 that brings the pitch horizontal. Yes, it responds to those. At 1500, it looks at the center point.

Not sure why the gimbal doesn't default to that. RC<5,7,8>_TRIM is 1500.

@srmainwaring srmainwaring merged commit 6da292a into ArduPilot:main Nov 4, 2024
@srmainwaring srmainwaring deleted the prs/pr-iris-3dof-gimbal branch November 4, 2024 17:07
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