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

rosserial, Arduino and uArm [closed]

asked 2015-02-16 10:22:48 -0500

Kahn gravatar image

Hi guys,
I`m trying to control my uArm (made by uFactory) via ROS, which has a Arduino UNO in it.
I installed as tutorials wrote and could run all the examples.
Then I modified "float64_test" example and added "#include <eeprom.h> #include <uf_uarm.h>" to the codes.
When I added the sentence "UF_uArm uarm; ", which tries to initialize the uArm, the connection failed as:

$ rosrun rosserial_python serial_node.py _port:=/dev/ttyUSB0
[INFO] [WallTime: 1424100015.682196] ROS Serial Python Node
[INFO] [WallTime: 1424100015.685933] Connecting to /dev/ttyUSB0 at 57600 baud
/opt/ros/indigo/lib/python2.7/dist-packages/rosserial_python/SerialClient.py:336: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers for more information.
  self.pub_diagnostics = rospy.Publisher('/diagnostics', diagnostic_msgs.msg.DiagnosticArray)
[ERROR] [WallTime: 1424100032.791215] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

The version of rosserial is Indigo so I think there shouldn`t be mismatch in versions...
I already searched for many solutions but all failed.
Anyone have any idea?
Thank you so much!!

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2016-05-08 16:10:47.740578

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-09-06 12:42:21 -0500

LorenzH gravatar image

I am also trying to get my uArm working with rosserial.

I experienced the same odd behaviour, that the chatter example works perfectly, the uArm Motion demo works perfectly, but when I try to combine both the connection to rosserial is not working anymore or the robot is moving very odd.

Any ideas someone?

I tried this without luck: http://answers.ros.org/question/16419...

Here my code

#include <EEPROM.h>
#include <UF_uArm.h>

#include <ros.h>
#include <sensor_msgs/JointState.h>

UF_uArm uarm; // initialize the uArm library

float positions[5] = {0.0};
char *joint_names[5] = {"SERVO_ROT", "SERVO_L", "SERVO_R", "SERVO_HAND_ROT", "SERVO_HAND"};

ros::NodeHandle nh;

sensor_msgs::JointState joint_state_msg;
ros::Publisher joint_state_pub("/joint_states", &joint_state_msg);

void setup()
{
 uarm.init();          // initialize the uArm position

 uarm.setServoSpeed(SERVO_R,    50);  // 0=full speed, 1-255 slower to faster
 uarm.setServoSpeed(SERVO_L,    50);  // 0=full speed, 1-255 slower to faster
 uarm.setServoSpeed(SERVO_ROT, 50);  // 0=full speed, 1-255 slower to faster

 nh.initNode();
 nh.advertise(joint_state_pub);

 joint_state_msg.position_length = 5;
 joint_state_msg.position = positions;
 joint_state_msg.name_length = 5;
 joint_state_msg.name = joint_names;
 delay(500);
}

void loop()
{
   uarm.setPosition(0, 0, 0, 0);        // original pose
   joint_state_msg.header.stamp = nh.now();
   joint_state_msg.position[0] = (float)uarm.readAngle(SERVO_ROT);
   joint_state_msg.position[1] = (float)uarm.readAngle(SERVO_L);
   joint_state_msg.position[2] = (float)uarm.readAngle(SERVO_R);
   joint_state_msg.position[3] = (float)uarm.readAngle(SERVO_HAND_ROT);
   joint_state_msg.position[4] = (float)uarm.readAngle(SERVO_HAND); 

   joint_state_pub.publish( &joint_state_msg );
   uarm.gripperDetach();
   delay(100);
   nh.spinOnce();
}
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-02-16 10:22:48 -0500

Seen: 634 times

Last updated: Feb 16 '15