Closed MatCapLynx closed 2 years ago
What is your mavros configuraton? It doesn't read SDF, so somewhere must be set params section like that: https://github.com/mavlink/mavros/blob/ros2/mavros/launch/px4_config.yaml#L140
NOTE: it's possible to set custom rotation.
My config for this sensor is :
distance_sensor:
rangefinder_pub4:
id: 4
frame_id: "lidar4"
send_tf: true
sensor_position: {x: 0.0, y: 0.0, z: -0.1}
field_of_view: 0.0
I've also tried with orientation :
rangefinder_pub4:
id: 4
orientation: YAW_45
frame_id: "lidar4"
send_tf: true
sensor_position: {x: 0.0, y: 0.0, z: -0.1}
field_of_view: 0.0
but in this case I get another error :
[ERROR] [1641647988.732717328, 4.408000000]: SENSOR: wrong orientation index: 100
[ERROR] [1641647988.732796576, 4.408000000]: DS: rangefinder_pub4: received sensor data has different orientation (100) than in config (YAW_45)!
This is is what gave me the impression it read the SDF file.
I found bug in enum_sensor_orientation.cpp introduced by CUSTOM entry.
Could you please build master and test?
I've built master and I don't get the SENSOR: wrong orientation index: 100
message anymore. My sensor orientation is now recognized as CUSTOM and it seems to be working.
But normally is should be recognized as YAW_45 and indeed I get the error message DS: rangefinder_pub4: received sensor data has different orientation (CUSTOM) than in config (YAW_45)!
. Any clue to solve this ?
You have to modify simulator code to send different orientation because mavros plugin just checks if it matches config (like sanity check). That's been essential before message been extended to have quaternion. Now it is likely that you can leave CUSTOM and just use tf frame which would have that rotation.
Ok thanks !
Issue details
I'm trying to use a rangefinder (distance sensor) at a 45° angle in SITL with Gazebo. I've successfully set orientation to NONE, YAW_90, YAW_180, YAW_270. For example for YAW_90, the sensor definition in my .sdf file is :
Similarly for YAW_45, I used :
But I get the following error :
SENSOR: wrong orientation index: 100
From what I understood of https://github.com/mavlink/mavros/blob/master/mavros/src/lib/enum_sensor_orientation.cpp my orientation is considered as CUSTOM while it should be considered as YAW_45. Maybe this is a deg/rad conversion error or approximation. I've tried with several approximations of π/4.MAVROS version and platform
Mavros: latest ROS: Noetic Ubuntu: 20.04
Autopilot type and version
[ ] ArduPilot [ X ] PX4
Version: latest
Node logs
Diagnostics
Check ID