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

d7x's profile - activity

2022-02-25 14:50:13 -0500 received badge  Nice Question (source)
2019-08-08 07:37:17 -0500 received badge  Famous Question (source)
2017-10-04 10:38:48 -0500 received badge  Famous Question (source)
2016-10-25 07:02:19 -0500 received badge  Famous Question (source)
2016-10-20 19:19:54 -0500 received badge  Famous Question (source)
2016-10-20 19:19:54 -0500 received badge  Notable Question (source)
2016-10-20 19:19:54 -0500 received badge  Popular Question (source)
2016-07-23 07:42:45 -0500 received badge  Taxonomist
2016-06-21 11:46:41 -0500 received badge  Notable Question (source)
2016-05-24 19:58:34 -0500 asked a question How to Publish Array Data for Multiple Servos on Arduino

I'm trying to publish an array in Python that is subscribed to by code on an Arduino that has callbacks for an Adafruit PWM servo controller. The code on the Arduino compiles and uploads to an Arduino Uno just fine. I'm not sure how to publish a multiarray for the following example: 3 servos that each have different integer angles between 0 and 180. I'm getting the following error messages when I run:

TypeError: Invalid number of arguments, args should be ['layout', 'data'] args are('{data: [20,50,100]}',)

How should I be publishing the multiarray in this example?

Python Publishing Code:

print "reco_event_servo_pwm: set up data values for servos"
servo_pub1 = rospy.Publisher('servo_pwm', UInt16MultiArray, queue_size=10)

n = 3
while n >= 0:
    servo_pub1.publish('{data: [20,50,100]}')  # THIS IS THE STATEMENT THAT HAS ERRORS
    rate.sleep()
    n = n - 1

Arduino Code:

#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#endif

#include <Servo.h>
#include <ros.h>
#include <std_msgs/UInt16MultiArray.h>
#include <std_msgs/String.h>
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>


/////////////////////////////////////////////////////////////////////////////////


ros::NodeHandle  nh;

// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();

// Depending on your servo make, the pulse width min and max may vary, you 
// want these to be as small/large as possible without hitting the hard stop
// for max range. You'll have to tweak them as necessary to match the servos you
// have!
#define SERVOMIN  200 // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX  400 // this is the 'maximum' pulse length count (out of 4096)

// our servo # counter
uint8_t servonum = 0;

void servo_ctlr_cb( const std_msgs::UInt16MultiArray&  cmd_msg) {
//  servo1.write(cmd_msg.data); //set servo angle, should be from 0-180

  for (int i=0; i<3; i++) { // run for all servos for TESTing
    pwm.setPWM(i, 0, cmd_msg.data[i]); //PWM signal, state where it goes high, state where it goes low, 0-4095, deadband 351-362
  }
}

ros::Subscriber<std_msgs::UInt16MultiArray> sub1("servo_pwm", servo_ctlr_cb);

void setup() {
  Serial.begin(9600);

  nh.initNode();
  nh.subscribe(sub1);

  pwm.begin();

  pwm.setPWMFreq(60);  // Analog servos run at ~60 Hz updates

  for(int j=0;j<8;j++) {  //initialize every thruster via channel (0-7) with a for-loop 
    pwm.setPWM(j,0,351);
  }

}

// you can use this function if you'd like to set the pulse length in seconds
// e.g. setServoPulse(0, 0.001) is a ~1 millisecond pulse width. its not precise!
void setServoPulse(uint8_t n, double pulse) {
  double pulselength;

  pulselength = 1000000;   // 1,000,000 us per second
  pulselength /= 60;   // 60 Hz
  pulselength /= 4096;  // 12 bits of resolution
  pulse *= 1000;
  pulse /= pulselength;
  pwm.setPWM(n, 0, pulse);
}

void loop() {
  nh.spinOnce();
  delay(20);
}
2016-03-01 01:14:08 -0500 received badge  Notable Question (source)
2016-03-01 01:13:33 -0500 received badge  Notable Question (source)
2015-11-03 02:04:43 -0500 received badge  Popular Question (source)
2015-11-02 19:35:33 -0500 received badge  Editor (source)
2015-11-02 12:42:23 -0500 received badge  Famous Question (source)
2015-10-31 12:06:06 -0500 asked a question Actionlib Tutorial: fibonacci_server.py not found

I'm running the tutorial Writing a Simple Action Server using the Execute Callback (Python) but getting errors that the file fibonacci_server.py isn't installed. I don't see a directory named simple_action_servers that is supposed to contain this file according to the directions in ( http://wiki.ros.org/actionlib_tutoria... )

ubuntu@ubuntu python fibonacci_server.py
python: can't open file 'fibonacci_server.py': [Errno 2] No such file or directory
ubuntu@ubuntu:/opt/ros/indigo$

I'm running Indigo on Ubuntu 14.04 and just reinstalled ros-indigo-common-tutorials but I'm getting the same result. Do I need to install the actionlib_tutorials from a separate package than common tutorials or do I need to create the file?

NEW PROBLEM DATA In order to make this issue easier to understand, I'm providing additional info. When looking at the contents of the actionlib_tutorial in [ http://wiki.ros.org/actionlib_tutoria... ), it states that The following code can be found in actionlib_tutorials/simple_action_servers/fibonacci_server.py, and implements a python action server for the fibonacci action. However, when I run an ls, the simple_action_servers directory has not been installed.

ubuntu@ubuntu:/opt/ros/indigo/share/actionlib_tutorials$ ls action cmake msg package.xml

As part of the tutorial, should I create the directory as well as fibonacci_server.py (and for the next tutorial, fibonacci_client.py)? Or, does this indicate a bad install?

2015-10-30 21:46:04 -0500 received badge  Popular Question (source)
2015-10-30 21:27:42 -0500 commented answer Adding Executables, Dependencies and Target Link Libraries - Client Example

Perfect, thanks for explaining this.

2015-10-30 18:22:05 -0500 marked best answer Best Board for Running Multiple Processor Intensive Libraries

I'm trying to decide between running ROS Indigo on a single board computer like a Nvidia Jetson TK1, Inforce 6410 Plus or an Odroid vs. using multiple low-cost single board computers like the new Raspberry Pi. The reason I'm looking for a very fast board or multiple boards is that I want to run multiple packages that are computationally expensive like vision, learning, SLAM, etc. I've heard that using distributed processors is pretty easy given the support in ROS so I'm not sure which approach is wiser. While ROS can allow some packages to run on different boards, I'm guessing that only a single board can be assigned to a specific package like vision. So, which approach would be the wisest?

2015-10-30 18:21:41 -0500 received badge  Famous Question (source)
2015-10-30 17:32:10 -0500 asked a question Adding Executables, Dependencies and Target Link Libraries - Client Example

I'm running Indigo on Ubuntu 14.04 and in the tutorial [ http://wiki.ros.org/actionlib_tutoria... ], under section 1.3, CMakeLists.txt is modified to add Executables, Dependencies and Target Link Libraries. Since this builds on the work of the SimpleActionServer, should these be ADDED to this file or should they replace what was used for the prior lesson:

http://wiki.ros.org/actionlib_tutoria...

add_executable(fibonacci_server src/fibonacci_server.cpp)

target_link_libraries(
  fibonacci_server
  ${catkin_LIBRARIES}
)

add_dependencies(
  fibonacci_server
  ${learning_actionlib_EXPORTED_TARGETS}
)

I can get the tutorial for the client working fine when I replace the above dependencies, link libraries and executables. But, the directions seem to say ADD the new dependencies, link libraries and executables to what was used for the client example. If that is the case, how do you add multiple dependencies, executables and link libraries. I haven't found the correct syntax.

2015-10-06 17:25:40 -0500 received badge  Famous Question (source)
2015-09-02 15:40:12 -0500 received badge  Notable Question (source)
2015-08-03 08:08:10 -0500 received badge  Notable Question (source)
2015-08-02 15:27:30 -0500 received badge  Popular Question (source)
2015-08-02 13:15:39 -0500 received badge  Popular Question (source)
2015-07-28 18:45:48 -0500 marked best answer Getting Started with ROS

I've built a couple of small robots using the Arduino for 2 servo control in addition to a distance sensor. I've also gone through the ROS tutorial using VM VirtualBox to get Ubuntu to run ROS. The reason I want to develop using ROS is given the extensive libraries that exist for ROS. However, I've read that in order to run ROS reasonably, the Raspberry PI or BeagleBone may run a bit slow if one is using multiple processor-intensive libraries like machine computer vision. Is there a microcontroller that is able to run intensive libraries or do you really need to use at minimum a laptop for a robot that needs a number of libraries like computer vision, learning, motor control, path planning, etc.?

Also, I'd like to know what level of difficulty exists in trying to run libraries like computer vision, machine learning, etc. Would I be better off 1) first building robots with the Raspberry PI to get more used to interfacing motor controllers and servos with the PI and to also get more experience with Ubuntu (I'm familiar with it enough to follow the tutorial and build an image)? I'm pretty familiar with C++ but not Python. Or, would you recommend 2) diving into ROS and trying to build simple robots with either the Raspberry PI or a VirtualBox?


Edit: The TK1 looks very intriguing - what sounds like very high performance and very low power consumption. Would the TK1 be used only for computer vision or as a standalone microcontroller? Or, would you recommend adding the TK1 to another microcontroller that would handle other processing? If you recommend adding the TK1 to another microcontroller, which one would you recommend and how would you join the 2 together to communicate?

Also, are there any rules of thumb for how much processing and RAM various libraries typically use - like computer vision, path planning, learning, etc.?

2015-07-28 17:07:40 -0500 marked best answer Capabilities of Distributed Processing in ROS

I have 2 questions about how distributed processing works: 1) Is it possible to selectively choose which computer/single board computer is used for different packages? For example, can the open cv package be run on board 1 while packages related to SLAM are run on board 2? So, is it possible to tell ROS where each package should be run and just have a default board identified that is used to run all packages that aren't specifically identified? Would that just mean that one would start different processes on different boards - just wondering how this is done. 2) For packages that are very computationally intense is it possible to split the processing of a package like open cv to run on multiple boards?

2015-07-28 14:01:50 -0500 commented question Many Unmet Dependencies on Indigo Trying to Install Tutorial Packages

That makes perfect sense to specify the platform given the challenges of ARM vs x86. My platform is a Raspberry PI (B version, not the new RPI 2) and I installed ROS Indigo by building an image from link text .

2015-07-28 12:47:27 -0500 received badge  Notable Question (source)
2015-07-27 23:49:09 -0500 asked a question Many Unmet Dependencies on Indigo Trying to Install Tutorial Packages

I'm trying to install the ros indigo tutorial packages and am getting a large number of errors. When I use the command form to show debug info, I get the second code block below. I'm not sure how to correct this and am wondering when it makes sense to try to debug all of these issues vs. reinstalling desktop full from scratch. Or, is there a quicker solution?

 sudo apt-get install ros-indigo-ros-tutorials ros-indigo-geometry-tutorials ros-indigo-rviz ros-indigo-rosbash ros-indigo-rqt-tf-tree
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 ros-indigo-geometry-tutorials : Depends: ros-indigo-turtle-tf but it is not going to be installed
                                 Depends: ros-indigo-turtle-tf2 but it is not going to be installed
 ros-indigo-ros-tutorials : Depends: ros-indigo-roscpp-tutorials but it is not going to be installed
                            Depends: ros-indigo-rospy-tutorials but it is not going to be installed
                            Depends: ros-indigo-turtlesim but it is not going to be installed
 ros-indigo-rosbash : Depends: ros-indigo-catkin but it is not going to be installed
 ros-indigo-rqt-tf-tree : Depends: python-rospkg but it is not going to be installed
                          Depends: ros-indigo-geometry-msgs but it is not going to be installed
                          Depends: ros-indigo-rospy but it is not going to be installed
                          Depends: ros-indigo-rqt-graph but it is not going to be installed
                          Depends: ros-indigo-rqt-gui but it is not going to be installed
                          Depends: ros-indigo-rqt-gui-py but it is not going to be installed
                          Depends: ros-indigo-tf2 but it is not going to be installed
                          Depends: ros-indigo-tf2-msgs but it is not going to be installed
                          Depends: ros-indigo-tf2-ros but it is not going to be installed
 ros-indigo-rviz : Depends: libboost-filesystem1.54.0 but it is not installable
                   Depends: libboost-program-options1.54.0 but it is not installable
                   Depends: libboost-system1.54.0 but it is not installable
                   Depends: libboost-thread1.54.0 but it is not installable
                   Depends: liburdfdom-world0.2 but it is not installable
                   Depends: libyaml-cpp0.5 but it is not installable
                   Depends: ros-indigo-geometry-msgs but it is not going to be installed
                   Depends: ros-indigo-image-geometry but it is not going to be installed
                   Depends: ros-indigo-image-transport but it is not going to be installed
                   Depends: ros-indigo-interactive-markers but it is not going to be installed
                   Depends: ros-indigo-laser-geometry but it is not going to be installed
                   Depends: ros-indigo-map-msgs but it is not going to be installed
                   Depends: ros-indigo-message-filters but it is not going to be installed
                   Depends: ros-indigo-nav-msgs but it is not going to be installed
                   Depends: ros-indigo-pluginlib but it is not going to be installed
                   Depends: ros-indigo-resource-retriever but it is not going to be installed
                   Depends: ros-indigo-rosbag but it is not going to be installed
                   Depends: ros-indigo-rosconsole but it is not going to be installed
                   Depends: ros-indigo-roscpp but it is not going to be installed
                   Depends: ros-indigo-roslib but it is not going to be installed
                   Depends: ros-indigo-rospy but it is not going to be installed ...
(more)
2015-07-27 23:34:49 -0500 answered a question Unable to locate package - troubleshooting tips

That command allowed the packages to be located. However, after locating the packages and trying to install again, I'm getting the message below. I'll post that to a different question so it's not lost.

`Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:

The following packages have unmet dependencies:`

2015-07-27 23:34:37 -0500 received badge  Scholar (source)
2015-07-27 22:55:28 -0500 received badge  Popular Question (source)
2015-07-27 09:45:47 -0500 asked a question Unable to locate package - troubleshooting tips

I'm running into an issue where I'm getting package not found on an Indigo install. It looks like there are a lot of questions about specific packages in the forum and I was wondering if there are general troubleshooting steps that should be taken to 1) determine if the packages are in fact in storage but not installed or 2) not installed at all. If apt-get isn't finding the package, I"m thinking that the location for packages in my configuration that's missing. Could that be the case? I ran roslocate for the rviz package (see below) and it came back with a 404 error. Are there other tools that I should be using to determine if this is the issue?

sudo apt-get install ros-indigo-ros-tutorials ros-indigo-geometry-tutorials ros-indigo-rviz ros-indigo-rosbash ros-indigo-rqt-tf-tree
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ros-indigo-ros-tutorials
E: Unable to locate package ros-indigo-geometry-tutorials
E: Unable to locate package ros-indigo-rviz
E: Unable to locate package ros-indigo-rosbash
E: Unable to locate package ros-indigo-rqt-tf-tree

roslocate info ros-indigo-rviz
Using ROS_DISTRO: indigo
Not found via rosdistro - falling back to information provided by rosdoc
error contacting http://ros.org/doc/indigo/api/ros-indigo-rviz/stack.yaml:
HTTP Error 404: Not Found
error contacting http://ros.org/doc/indigo/api/ros-indigo-rviz/manifest.yaml:
HTTP Error 404: Not Found
cannot locate information about ros-indigo-rviz

Edit:

Try sudo apt-get update and then the install

That command allowed the packages to be located. However, after locating the packages and trying to install again, I'm getting the message below. I'll post that to a different question so it's not lost.

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
2015-07-27 01:30:27 -0500 received badge  Popular Question (source)