SITL drone battery level?

Hi,

Novice question here. Is there a way to access the iris SITL drone’s battery level? I’ve tried the bat command in mavproxy:

MAV> bat
STABILIZE> STABILIZE> No battery information

as well as trying to view the /battery ros2 topic:

jamison@jamison:~$ ros2 topic info /battery
Type: sensor_msgs/msg/BatteryState
Publisher count: 1
Subscription count: 0
jamison@jamison:~$ ros2 topic echo /battery

but nothing is happening when echoing.

Do I have create my own subscriber?

I’m running Gazebo Harmonic and Ros2 Humble.

Thank you!

The battery topic for ArduPilot via DDS is

/ap/battery

For a list of all topics see:

% ros2 node info /ardupilot_dds
/ardupilot_dds
  Subscribers:
    /ap/cmd_gps_pose: ardupilot_msgs/msg/GlobalPosition
    /ap/cmd_vel: geometry_msgs/msg/TwistStamped
    /ap/joy: sensor_msgs/msg/Joy
    /ap/tf: tf2_msgs/msg/TFMessage
  Publishers:
    /ap/airspeed: geometry_msgs/msg/Vector3Stamped
    /ap/battery: sensor_msgs/msg/BatteryState
    /ap/clock: rosgraph_msgs/msg/Clock
    /ap/geopose/filtered: geographic_msgs/msg/GeoPoseStamped
    /ap/gps_global_origin/filtered: geographic_msgs/msg/GeoPointStamped
    /ap/imu/experimental/data: sensor_msgs/msg/Imu
    /ap/navsat/navsat0: sensor_msgs/msg/NavSatFix
    /ap/pose/filtered: geometry_msgs/msg/PoseStamped
    /ap/tf_static: tf2_msgs/msg/TFMessage
    /ap/time: builtin_interfaces/msg/Time
    /ap/twist/filtered: geometry_msgs/msg/TwistStamped
  Service Servers:
    /ap/arm_motors: ardupilot_msgs/srv/ArmMotors
    /ap/mode_switch: ardupilot_msgs/srv/ModeSwitch
  Service Clients:

  Action Servers:

  Action Clients:
1 Like