ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
2013-05-03 04:56:26 -0500 | received badge | ● Famous Question (source) |
2013-04-23 21:28:19 -0500 | commented answer | rosserial RosServoControl arduino with two servos Thank you very much, I will try some things and I will post if I have any interesting result! |
2013-04-23 11:00:44 -0500 | received badge | ● Notable Question (source) |
2013-04-22 23:07:44 -0500 | commented answer | rosserial RosServoControl arduino with two servos Hi Christian, just one more question! When you write: rostopic pub /servo1 std_msgs/UInt16 $i$j is there any way to send an angle to the servo2 in the same line??so I move both servos at the same time but different angles? |
2013-04-22 23:03:14 -0500 | received badge | ● Scholar (source) |
2013-04-22 23:02:55 -0500 | commented answer | rosserial RosServoControl arduino with two servos You just saved my day!! I wrote a code similar to yours and it works as I needed :D thank you very much Christian |
2013-04-22 20:43:42 -0500 | received badge | ● Popular Question (source) |
2013-04-22 05:58:44 -0500 | commented answer | rosserial RosServoControl arduino with two servos THank you!! I will try it tomorrow and I'll tell the result :) |
2013-04-21 23:31:24 -0500 | received badge | ● Supporter (source) |
2013-04-21 23:20:46 -0500 | asked a question | rosserial RosServoControl arduino with two servos Hi all!! I am trying to go further with the basic example of Ros Serial with Arduino and a Servo. In this example, the publisher asks for an angle where to drive a servo. I am trying to do this with two servos, but the only thing I can do is to drive both to the same position. I need some tip for how to write two parameters in Ros, so each servo goes to its position. The code I have for the moment is as follows: ros::NodeHandle nh; Servo servo, servo2; void servo_cb( const std_msgs::UInt16& cmd_msg){
servo.write(cmd_msg.data); //set servo angle, should be from 0-180 ros::Subscriber<std_msgs::uint16> sub("servo",="" servo_cb);="" ros::subscriber<std_msgs::uint16>="" sub2("servo2",="" servo_cb);<="" p=""> void setup(){ pinMode(13, OUTPUT); nh.initNode(); nh.subscribe(sub); servo.attach(9); //attach it to pin 9 servo2.attach(3); } void loop(){ nh.spinOnce(); delay(1); } Can anyone help me please?? |