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

david.c.liebman's profile - activity

2020-10-05 19:34:24 -0500 received badge  Famous Question (source)
2018-09-13 02:31:36 -0500 marked best answer cannot include custom .msg files in python code

I have created my own msg files and would now like to use them in python. One line trips me up over and over.

from my_package.msg import *

I get an error like this:

ImportError: No module named my_package

I do believe I have written the '.msg' files correctly, and I have executed 'catkin_make' successfully on the workspace I'm using for ros development. I also believe I've edited the CMakeLists.txt file correctly.

cmake_minimum_required(VERSION 2.8.3)
project(my_package)


find_package(catkin REQUIRED COMPONENTS
  geometry_msgs
  roscpp
  rospy
  std_msgs
  message_generation
  map_store
)

add_message_files(
  FILES
  MapListEntryList.msg
  MapListElement.msg
#   Message2.msg
)

generate_messages(
  DEPENDENCIES
  #my_package
#  MapListEntryList  
#   geometry_msgs#   std_msgs
)

catkin_package(
#  INCLUDE_DIRS include
  LIBRARIES my_package map_store
  CATKIN_DEPENDS message_runtime geometry_msgs roscpp rospy std_msgs
#  DEPENDS system_lib
)

include_directories(
  ${catkin_INCLUDE_DIRS}
)

 install(PROGRAMS
   scripts/turtlebot_listen.py
   scripts/turtlebot_map.py
   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
 )

The two .msg files are trivial:

# MapListEntryList.msg
# num of available maps/ num of maps in list
int8 len

# list of available map_id objects
my_package/MapListElement[] list

and

# MapListElement.msg

string name
string id

I can use rosmsg to look at both messages. If anyone can point out what I'm doing wrong, I'd be grateful.

2018-09-13 02:31:36 -0500 received badge  Self-Learner (source)
2017-05-16 19:37:15 -0500 marked best answer service does not exist - app_manager rapp, hydro, python, turtlebot

I am using the app_manager and three rapps. In one, the navigate rapp, I get this message when I try to use a service of my own.

[ERROR] [WallTime: 1394827317.221882] [Client 0] [id: call_service:/app_manager/application/load_map_db:7] call_service InvalidServiceException: Service /app_manager/application/load_map_db does not exist

why would the app manager tell me that this is non existant? I am running hydro on a ubuntu 12.04 system. I'm pretty sure it's there, in the srv folder there's a MapPublish.srv file, and in CMakeLists.txt there's an entry for the srevice in the 'add_service_files' section. Everything compiles right. Other services that Ive written work. What have I done wrong? I thought it was some kind of naming problem, but I think the names I've chosen are somewhat original. Any help would be appreciated. I can add more info if requested.

EDIT 1: My project works like this: I have a turtlebot and I use an internet service to transmit direction info from one computer to another, then through the chrome web browser, websockets and rosbridge server to the turtlebot. I have several services that I've authored that help me out. So far that works. I have also tried to implement amcl and gmapping functions that I try to start and stop remotely. I use the app_manager and three rapps. One rapp is for teleop, one for gmapping, and one for amcl.

I should provide documents showing some of these functions, but the idea is that the rosbridge server stuff tells the app_manager stuff to start and stop different launch files, allowing for this different functionality. This is why my service 'load_map_db' is preceded by the '/app_manager/application/'. What I don't do, is use the rocon launcher. Everything runs on the same port and there's no need to switch (I think they call it flip) from one port to another. I do use the app_manager 'start_app' and 'stop_app'.

I thought briefly that the rosbridge server didn't know about the app_manager navigation services because they weren't started when the rosbridge server was started. This didn't pan out. I restarted the rosbridge server stuff as well as I could in javascript at the time that the load_map_db service was used and there was no change.

I don't understand how some of the services work (like 'list_maps') but this one doesn't. Long ago you could have inserted a control character into a file or file name and not know it. Maybe I have done this? I suspect today's text editors will not let you do this. Below I include some source material.

This is my launch file for the whole program:

<launch>
  <arg name="rapp_lists" default="tele_presence/tele_presence_apps.rapps"/> 
  <include file="$(find tele_presence)/launch/includes/app_manager_rocon.launch.xml">
    <arg name="rapp_lists" value="$(arg rapp_lists)" />
  </include>

  <include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch"/>

</launch>

This is my rapps file:

apps:
 - tele_presence/mapping
 - tele_presence/navigate
 - tele_presence/teleop

This is ... (more)

2017-04-20 16:54:03 -0500 marked best answer turtlebot amcl hydro rapp scenario -- goal position

I have a problem with my Turtlebot and amcl, but I don't know exactly how to describe it. I am working on a project that uses programming elements to direct a turtlebot from a remote computer over an internet connection. I use rosbridge server to direct the turtlebot. I can, for instance, perform simple tele-op in this way. I also want to remotely start the gmapping and amcl functions. I can use gmapping to make a map, and then in amcl load the map and even track it on rviz. That is where I have my problem. I can give amcl my start position, and then when I give it the goal position it doesn't go to the new place.

I have gone through the turtlebot howto demos online. I can do all the three functions teleop, mapping, and amcl. In the demos in amcl I can set the start position, the goal position, and watch my turtlebot move from one to the other. I have used the launch file from amcl_demo.launch as the basis for my own launch file.

In my application there is a central launch file called 'app_manager.launch'. It starts the app manager application. I then launch the amcl launch file as a rapp. This way I can launch an amcl rapp, a gmapping rapp, or a teleop rapp. The topic names for the rapps are all converted to '/app_manager/application/name' where 'name' is the name of the original topic. This means I have to send all my messages to '/app_manager/application/name' not '/name'. The name of my catkin package is 'tele_presence'. (My python code in 'tele_presence' minimal.launch loads maps and saves maps to the mongodb instance...)

This is my 'app_manager.launch' file. It's part of my 'tele_presence' package.

<launch>

  <arg name="rapp_lists" default="tele_presence/tele_presence_apps.rapps"/> 
  <include file="$(find tele_presence)/launch/includes/app_manager_rocon.launch.xml">
    <arg name="rapp_lists" value="$(arg rapp_lists)" />
  </include>

  <include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch"/>
</launch>

This is my 'navigate.launch' file. It's part of the 'navigate' rapp.

<launch>

  <include file="$(find turtlebot_bringup)/launch/minimal.launch"/>
  <include file="$(find tele_presence)/launch/minimal.launch"/>

  <include file="$(find turtlebot_bringup)/launch/3dsensor.launch">
    <arg name="rgb_processing" value="true" />
    <arg name="depth_registration" value="false" />
    <arg name="depth_processing" value="false" />

    <!-- We must specify an absolute topic name because if not it will be prefixed by "$(arg camera)".
Probably is a bug in the nodelet manager: https://github.com/ros/nodelet_core/issues/7 -->
    <arg name="scan_topic" value="/app_manager/application/scan" />
  </include>


  <!-- Map server -->
  <include file="$(find tele_presence)/launch/manage_map.launch"/>

  <arg name="initial_pose_x" default="0.0"/> <!-- Use 17.0 for willow's map in simulation -->
  <arg name="initial_pose_y" default="0.0"/> <!-- Use 17.0 for willow's map in simulation -->
  <arg name="initial_pose_a" default="0.0"/>
  <include file="$(find turtlebot_navigation)/launch/includes/amcl.launch.xml">
    <arg name="initial_pose_x" value="$(arg initial_pose_x)"/>
    <arg name="initial_pose_y" value="$(arg initial_pose_y)"/>
    <arg name="initial_pose_a" value="$(arg initial_pose_a)"/>
    <arg name="use_map_topic" value="true"/>

  </include ...
(more)
2017-04-20 16:38:00 -0500 marked best answer turtlebot amcl robot footprint error

I'm trying to use amcl on the turtlebot robot. My amcl launch file is modified from the android app_manager amcl launcher. I have authored several of my own rapp files, and that part seems to work for now. I am able to load amcl and a map file, and then once one is loaded I can try to programmatically designate start (/initialpose) and stop (/move_base_simple/goal) coordinates. After doing so I even observe a small blue line on rviz that covers what I expect would be the path of the robot, BUT the robot doesn't move. I get the following two errors. The first on I get on the rviz computer. The second one I get on the Turtlebot computer.

[ERROR] [1394045389.663173820]: TF_NAN_INPUT: Ignoring transform for child_frame_id "odom" from authority "/app_manager/application/amcl" because of a nan value in the transform (-nan -nan nan) (-nan -nan -nan -nan)

[ERROR] [1394045392.583904722]: You must specify at least three points for the robot footprint, reverting to previous footprint.

EDIT 1: This is my launcher file. It comes almost directly from the android example. BTW I would like to get rid of the functionality that sends images to the android phone. I'm actually using a rosbridge server interface to control the robot and I don't need to see images from the kinect. Maybe I don't need the optimization code too. Also I'm using hydro on an ubuntu 12.04 system.

<launch>
  <include file="$(find turtlebot_bringup)/launch/minimal.launch"/>
  <include file="$(find tele_presence)/launch/minimal.launch"/>

  <!-- *********************** Teleoperation ********************** -->
  <param name="camera/rgb/image_color/compressed/jpeg_quality" value="22"/>

  <include file="$(find turtlebot_bringup)/launch/3dsensor.launch">
    <arg name="rgb_processing" value="true" />
    <arg name="depth_registration" value="false" />
    <arg name="depth_processing" value="false" />
  </include>

  <!-- Make a slower camera feed available. -->
  <node pkg="topic_tools" type="throttle" name="camera_throttle" args="messages camera/rgb/image_color/compressed 5"/>

  <node pkg="nodelet" type="nodelet" name="teleop_velocity_smoother"
        args="load yocs_velocity_smoother/VelocitySmootherNodelet /mobile_base_nodelet_manager">
    <rosparam file="$(find turtlebot_bringup)/param/defaults/smoother.yaml" command="load"/>
    <remap from="teleop_velocity_smoother/raw_cmd_vel" to="android/virtual_joystick/cmd_vel"/>
    <remap from="teleop_velocity_smoother/smooth_cmd_vel" to="/cmd_vel_mux/input/teleop"/>

    <!-- Robot velocity feedbacks; use the one configured as base default -->
    <remap from="teleop_velocity_smoother/odometry" to="/odom"/>
    <remap from="teleop_velocity_smoother/robot_cmd_vel" to="/mobile_base/commands/velocity"/>
  </node>

  <!-- *********************** Optimisation *********************** -->
  <node pkg="tf" type="tf_change_notifier" name="tf_throttle_for_android_gui">
    <param name="polling_frequency" value="5"/>
    <param name="translational_update_distance" value="-1"/>
    <param name="angular_update_distance" value="-1"/>
    <rosparam param="frame_pairs">
      - {source_frame: base_footprint, target_frame: map}
      - {source_frame: camera_depth_frame, target_frame: map}
    </rosparam>
  </node>


  <!-- *************************** Navi *************************** -->
  <include file="$(find turtlebot_navigation)/launch/includes/move_base.launch.xml">
    <arg name="odom_topic" value ="/odom" />
  </include>
  <include file="$(find turtlebot_navigation)/launch/includes/amcl.launch.xml">
    <arg name="use_map_topic" value ="true"/>
  </include>


  <!-- *************************** Maps *************************** -->
  <!-- this launcher lets me use some map_store services -->

    <include file="$(find tele_presence)/launch/manage_map.launch"/>
</launch>

How do I specify the robot footprint? Will doing so help at all with the TF amcl error?

2017-04-20 16:27:28 -0500 marked best answer using services from android_map_manager and other rapps

I am having some trouble. I have found a resource online for the 'android_map_manager', for example.

http://wiki.ros.org/android_map_manager

I have figured out how to start the app from my program. Now I would like to use some of the services that the online resource says are available to me. I cannot see them (they are services) when I type 'rossrv list' and when I try to access them from my program I get a message like this:

[ERROR] [WallTime: 1391876649.155091] [Client 0] [id: call_service:/android/list_maps:31] call_service InvalidServiceException: Service /android/list_maps does not exist

I feel though that this should work, as I know the app manager is running. I have this in my logs:

[WARN] [WallTime: 1391877076.029768] App Manager : an app is already running [turtlebot_core_apps/android_map_manager]

If I could find out how to list the maps, I could figure out how to rename, delete, etc. My next goals are to implement services in the 'android_make_a_map' rapp and possibly the nav rapp too. I did notice that the map_store package is being started by the launcher. Is the map_store package working independently of the map_manager? The launcher that I'm using is a slightly modified version of the 'minimal_with_appmanager.launch' file. Thanks.

2016-10-26 03:53:51 -0500 received badge  Self-Learner (source)
2016-10-26 03:53:51 -0500 received badge  Teacher (source)
2016-06-13 10:07:36 -0500 received badge  Famous Question (source)
2016-02-08 03:20:37 -0500 received badge  Famous Question (source)
2015-04-08 19:39:17 -0500 received badge  Notable Question (source)
2015-04-08 19:39:17 -0500 received badge  Famous Question (source)
2014-12-09 05:27:27 -0500 received badge  Taxonomist
2014-12-04 10:23:04 -0500 received badge  Famous Question (source)
2014-10-23 04:35:59 -0500 received badge  Famous Question (source)
2014-10-22 19:16:33 -0500 received badge  Famous Question (source)
2014-10-10 03:38:07 -0500 received badge  Notable Question (source)
2014-10-10 03:38:07 -0500 received badge  Popular Question (source)
2014-08-05 22:27:13 -0500 received badge  Notable Question (source)
2014-07-18 19:16:12 -0500 received badge  Famous Question (source)
2014-06-27 17:35:32 -0500 received badge  Famous Question (source)
2014-06-18 15:36:14 -0500 received badge  Famous Question (source)
2014-05-14 10:25:46 -0500 received badge  Famous Question (source)
2014-05-11 17:43:43 -0500 received badge  Notable Question (source)
2014-04-30 00:24:11 -0500 received badge  Popular Question (source)
2014-04-24 05:29:24 -0500 received badge  Notable Question (source)
2014-04-20 06:57:00 -0500 marked best answer tf and amcl turtlebot demo immediately after gmap demo

On the turtlebot I am trying to launch the amcl demo after launching the gmapping demo, but without shutting down all of ros.

Usually I can get the gmapping to work (that's the first demo I test) and then the amcl will partially work. I can load a map using 'map_store' and then see the map on the rviz screen. I also can usually see the turtlebot on the rviz screen. I have trouble directing the turtlebot, though, and I don't exactly know why.

When I look at the RobotModel listing under the 'Displays' box in rviz it's red, and the cause is that the tf's from all the components are red. (base_footprint, base_link, etc., all red). They all say 'No transform from [base_footprint] to [map]'. When I execute view_frames and look at the pdf it says "no tf data received". When I type rostopic list '/tf' comes up as one of my topics. Is there something I can start that will restart the tf data in the turtlebot?

If I don't start gmapping first I can usually load a map and direct the turtlebot with /initialpose, etc.

2014-04-20 06:56:57 -0500 marked best answer clear a topic to make it 'unpublished'

I am working on a project where I want to be able to launch the turtlebot gmapping demo immediately after the amcl demo. I do not want to add to a map that I've already been navigating, instead I want to clear the map that was used by the amcl navigation demo and start a new one. The problem I have is that the /map topic seems to hold the values that the navigating demo was using. I don't want to quit ros and start it over again. What I was hoping was that there was some way to clear the map and proceed from there.

How does one clear a topic to the state of emptyness or the state of not being published at all? Can this be done programmatically? Does this make sense?

2014-04-20 06:56:48 -0500 marked best answer map_msgs/GetMapROI

what does ROI mean? Can someone link me to something that points out how this is used? I see it has an OccupancyGrid in it. I'm looking for a little direction. Any help would be appreciated. Thanks.

2014-04-20 06:56:46 -0500 marked best answer master node to control two or three others

I'm trying to make a single app that controls a turtlebot robot. I would like to be able to run the gmapping software that makes a map at one point and then switch to the software that navigates the map, all from the interface of my program. I am under the impression that these elements don't work well together, so I want to be able to start one node that does the gmapping and then stop that node and start the node that does the navigating -- all from my program.

I was searching on line and I found that there used to be software called rosspawn. (I'm not even sure if this would do what I want) anyway I don't think it's part of hydro???

So what I'm looking for is a master node that allows me to configure several other nodes at startup and then allows me to start and stop these other nodes either by service or through some topic publishing scheme. Any help would be appreciated.

2014-04-20 06:56:45 -0500 marked best answer help with simple /map publisher that will not publish - python

How do I publish this test data to the /map topic. I would like to use this routine to test other things I'm working on. I think I'm doing it right but when I type 'rostopic echo /map' I see nothing. If I run the script at the command prompt after typing 'roscore' in another terminal I see the test OccupancyGrid on the screen. I don't know what I'm doing wrong.

#!/usr/bin/env python

import rospy
import sys


from nav_msgs.msg import *
from std_msgs.msg import *

def map_stuff():
    rospy.init_node('turtlebot_map', anonymous=True)
    if not rospy.is_shutdown():
        create_map()
        rospy.spin()

def create_map( ):
    test_map = OccupancyGrid()
    test_map.info.resolution = 1.0 
    test_map.info.width = 10
    test_map.info.height = 10
    test_map.info.origin.position.x = 0.0 
    test_map.info.origin.position.y = 1.0 
    test_map.info.origin.position.z = 2.0 
    test_map.info.origin.orientation.x = 3.0 
    test_map.info.origin.orientation.y = 4.0 
    test_map.info.origin.orientation.z = 5.0 
    test_map.info.origin.orientation.w = 6.0 
    test_map.data = []
    for i in range(0, 100):
        test_map.data.append(i)
    print test_map
    map_pub = rospy.Publisher('/map', OccupancyGrid)
    map_pub.publish(test_map);
    return 

if __name__ == '__main__':
    try:
        map_stuff()
    except rospy.ROSInterruptException:
        pass

I followed online tutorials as closely as I could. Any help would be appreciated.

2014-04-20 06:56:38 -0500 marked best answer Python node with more than one publisher/subscriber

Is it possible to make a ros python node that has more than one subscriber and more than one publisher? Are there examples of this?

2014-04-20 06:56:30 -0500 marked best answer python PointCloud2 read_points() problem

I'm working on a kinect project. I'm trying to write a pair of files that test out the PointCloud2 sensor message. I don't know how to make the 'listener' python script read the value that I have created in the 'talktest' script. I am using the class defined here:

sensor_msgs/point_cloud2.py (I could not post a link)

This is my code. These are my includes. I use them pretty much the same in both files.

#!/usr/bin/env python
import rospy
import sensor_msgs.point_cloud2 as pc2
from sensor_msgs.msg import PointCloud2, PointField

This is the 'talktest' code.

#talktest
def test():
    rospy.init_node('talktest', anonymous=True)
    pub_cloud = rospy.Publisher("camera/depth_registered/points", PointCloud2)
    while not rospy.is_shutdown():
        pcloud = PointCloud2()
        # make point cloud
        cloud = [[33,22,11],[55,33,22],[33,22,11]]
        pcloud = pc2.create_cloud_xyz32(pcloud.header, cloud)
        pub_cloud.publish(pcloud)
        rospy.loginfo(pcloud)
        rospy.sleep(1.0)

if __name__ == '__main__':
    try:
        test()
    except rospy.ROSInterruptException:
        pass

Then I have written a script that listens for point cloud data. It always throws a AttributeError.

#listener
def listen():
    rospy.init_node('listen', anonymous=True)
    rospy.Subscriber("camera/depth_registered/points", PointCloud2, callback_kinect)

def callback_kinect(data) :
    # pick a height
    height =  int (data.height / 2)
    # pick x coords near front and center
    middle_x = int (data.width / 2)
    # examine point
    middle = read_depth (middle_x, height, data)
    # do stuff with middle


def read_depth(width, height, data) :
    # read function
    if (height >= data.height) or (width >= data.width) :
        return -1
    data_out = pc2.read_points(data, field_names=None, skip_nans=False, uvs=[width, height])
    int_data = next(data_out)
    rospy.loginfo("int_data " + str(int_data))
    return int_data


if __name__ == '__main__':
    try:
        listen()
    except rospy.ROSInterruptException:
        pass

I always get this error:

[ERROR] [WallTime: 1389040976.560028] bad callback: <function callback_kinect="" at="" 0x2a51b18=""> Traceback (most recent call last):
File "/opt/ros/hydro/lib/python2.7/dist-packages/rospy/topics.py", line 681, in _invoke_callback cb(msg) File "./turtlebot_listen.py", line 98, in callback_kinect left = read_depth (left_x, height, data) File "./turtlebot_listen.py", line 126, in read_depth int_data = next(data_out) File "/opt/ros/hydro/lib/python2.7/dist-packages/sensor_msgs/point_cloud2.py", line 74, in read_points assert isinstance(cloud, roslib.message.Message) and cloud._type == 'sensor_msgs/PointCloud2', 'cloud is not a sensor_msgs.msg.PointCloud2' AttributeError: 'module' object has no attribute 'message'

Can anyone tell me how to use this library correctly?

2014-04-15 05:31:26 -0500 received badge  Famous Question (source)
2014-04-10 00:51:35 -0500 received badge  Popular Question (source)
2014-04-09 04:08:15 -0500 received badge  Famous Question (source)