ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

rospy sensor_msgs.msg.BatteryState is not found

asked 2016-04-12 14:45:15 -0600

zacwitte gravatar image

For some reason I'm not able to import the BatteryState message with rospy. This is the only message I've encountered that seems to be missing.

I'm using ros-indigo. Anyone else have this problem?

zac@nuc-2:~$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sensor_msgs.msg import Imu
>>> from sensor_msgs.msg import BatteryState
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name BatteryState
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-04-12 23:45:48 -0600

ahendrix gravatar image

The BatteryState message was added to Indigo in the most recent release of sensor_msgs, and it has not yet reached the public apt repository.

If you really need the battery message, you can use sensor_msgs from source, or you can keep an eye on the ros-users mailing list for the announcement of the next sync, which will be made when the updated version of the package reaches the public apt repo.

edit flag offensive delete link more


How might I install sensor_msgs for source for rospy?

zacwitte gravatar image zacwitte  ( 2016-04-13 17:49:28 -0600 )edit

Have a look at the answer here: , but replace the git URL for descartes with the git URL provided on the sensor_msgs wiki page.

ahendrix gravatar image ahendrix  ( 2016-04-14 03:26:53 -0600 )edit

Thanks. I actually ended up installing BatteryState as a custom message in my package, copy/pasted from github.

zacwitte gravatar image zacwitte  ( 2016-04-14 14:27:49 -0600 )edit

Question Tools

1 follower


Asked: 2016-04-12 14:45:15 -0600

Seen: 1,036 times

Last updated: Apr 12 '16