Python Robotics ROS

TensorFlow / Keras Model Predict Error

Unexpected error: Tensor Tensor("dense_1/BiasAdd:0", shape=(?, 3), dtype=float32) is not an element of this graph.

To Fix:

Make sure to include the following global:

import tensorflow as tf

global graph,model
graph = tf.get_default_graph()

And surround the prediction as such:

with graph.as_default():
                segment = self.model.predict(features)
Posts Programming ROS

ROS – rviz X Window System error.

rosrun rviz rviz
[ INFO] [1322561467.803234807]: rviz revision number 1.6.7
[ INFO] [1322561467.803351442]: ogre_tools revision number 1.6.2
[ INFO] [1322561467.803374070]: compiled against OGRE version 1.7.3 (Cthugha)
[ INFO] [1322561467.946771146]: Loading general config from [/home/alex/.rviz/config]
[ INFO] [1322561467.946953292]: Loading display config from [/home/alex/.rviz/display_config]
[ INFO] [1322561467.972674791]: RTT Preferred Mode is PBuffer.
The program 'rviz' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadDrawable (invalid Pixmap or Window parameter)'.
  (Details: serial 22 error_code 9 request_code 137 minor_code 3)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

I got this error when I incorrectly compiled rviz using:

rosmake rviz rviz

You’ll want to re-compile it correctly, with only 1 input as followed:

rosmake rviz

Now when you run it, everything should be working.

C/C++ Linux Posts Programming Robotics ROS

ROS: Publishing and Subscribing to Arrays

In ROS (Robot Operating System) it’s really easy to publish variables to be used between nodes running on the same roscore however I was having some difficulty doing the same for arrays. The problem came when there was no real examples of how to use them, so here is a working example of std_msgs/*MultiArray in CPP.