Closed emmhaych closed 6 years ago
I haven't used copter_visualization
before. From the documentation at http://wiki.ros.org/mavros_extras, it subscribes to geometry_msgs/PoseStamped
messages. This message type is published on topic local_position/pose
by the multiwii node. You also need to provide the frame names for fixed_frame_id
and child_frame_id
. The frame id for the published multiwii pose is multiwii
, i.e. the provided pose is the transformation between your world frame (e.g. world
) and the frame multiwii
of the quadrocopter. Therefore, you need to set child_frame_id
to multiwii
and fixed_frame_id
to your world frame, e.g. world
, map
or something like this.
You can try to run it with:
rosrun mavros_extras copter_visualization _fixed_frame_id:=world _child_frame_id:=multiwii local_position:=/multiwii/local_position/pose
I added the above command to my launch file as follows:
<node name="copter_viz" pkg="mavros_extras" type="copter_visualization">
<param name="fixed_frame_id" value="world"/>
<param name="child_frame_id" value="multiwii"/>
<remap from="/local_position" to="/multiwii/local_position/pose" />
</node>
I have a static tf broadcasting world
but rviz complains For frame [multiwii]: Frame [multiwii] does not exist
.
I believe the issue is that the tf /multiwii
is in the geometry_msgs/PoseStamped
but not broadcasted as a tf
. I used rosrun tf view_frames
to confirm and I only see my static world
frame.
I am heading off now but will investigate this further tonight. Meanwhile let me know if you have any thoughts.
It is what I suspected. Will be making a pull request shortly with a TransformStamped
being published which maps multiwii
to a parent frame. I'll input the parent frame as an optional parameter to the node with the default being map
. Also, I'll create a launch file as a demo for the feature.
Would like to hear your thoughts on how we fuse attitude and altitude given both need to be part of the transformation but are part of two separate callbacks. I can see two methods of doing this with the current code architecture:
world > multiwii_cartesian > multiwii_attitude
. Apply altitude to the multiwii_cartesian
frame and apply pitch/roll/yaw to multiwii_attitude
.onAttitude
method.Do you mean that a TransformStamped
is required for copter_visualization
?
From the documentation, I suspect that copter_visualization
is only using the PoseStamped
and the source and target frames (which contains the same information as a TransformStamped
) to publish markers on vehicle_marker
.
So I think that a TransformStamped
is actually not required for copter_visualization
itself.
However, if you still want to have a TransformStamped
I would prefer the first option, i.e. having two transforms for translation and rotation.
Apologies for not being clear the first time. copter_visualization
is happy with just PoseStamped
. However, rviz requires a valid transformation between world
and multiwii
which doesn't exist in the tf
namespace unless a TransformStamped
is broadcasted.
I might be completely wrong because I'm new to ROS. Why would copter_visualization
care about PoseStamped if it is only building a static model and not transforming it. Have a look at the following for how I got it to work:
https://github.com/emmhaych/ros-multiwii/blob/master/src/multiwii_node.cpp#L281-L291
You should be able to run my fork using the copter_visualization.launch and open the copter_visualization.rviz to see visualize it in rviz.
I might misinterpret how copter_visualization
works, but I thought that it already visualises the model at the given pose. Why would it otherwise subscribe to a PoseStamped
if it could get the same information from the TransformStamped
? If you would like to visualise the copter pose without using copter_visualization
, you would indeed need to publish a TransformStamped
.
Anyway, when you get the copter_visualization
working, i.e. it's publishing markers on the topic vehicle_marker
, can you open a pull request? It is then easier to track which changes need to be applied.
Looks like copter_visualization
doesn't use the PoseStamped
for visualising the quad; only for visualizing track markers (shows flight path) - ref copter_visualization.cpp;line 191. The stuff we discussed about should work - will finish it off tonight and make a pull request. Thanks!
Would it be possible to provide a launch file/example on how to use multiwii data to visualise the drone with mavros_extras?