Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all 314 articles
Browse latest View live

rosserial_arduino error on terminal

$
0
0
When I write this command on terminal: rosrun rosserial_python serial_node.py /dev/ttyUSB0 but I change my port from USB0 to ACM0 as I work on ACM0 it appears to me that: [INFO] [WallTime: 1374151755.600608] ROS Serial Python Node [INFO] [WallTime: 1374151755.601022] Connecting to /dev/ttyACM0 at 57600 baud [ERROR] [WallTime: 1374151755.603582] Error opening serial: could not open port /dev/ttyACM0: [Errno 2] No such file or directory: '/dev/ttyACM0' and I rum roscore in a new terminal I am on groovy

rosserial compile error: missing rosserial_msgs/TopicInfo.h

$
0
0
Hi, I'm using Ubuntu 14.04 with ros indigo. I've dowloaded the rosserial source from git git clone https://github.com/ros-drivers/rosserial When I try to compile in catkin_ws I get the message that rosserial_msgs/TopicInfo.h is missing (see below). Now I'm wondering where this file is. It's not in the repository. Where can I get it? ... [ 4%] Building CXX object rosserial/rosserial_server/CMakeFiles/rosserial_server_serial_node.dir/src/serial_node.cpp.o [ 4%] Building CXX object rosserial/rosserial_server/CMakeFiles/rosserial_server_socket_node.dir/src/socket_node.cpp.o In file included from /home/pat/catkin_ws/src/rosserial/rosserial_server/include/rosserial_server/serial_session.h:43:0, from /home/pat/catkin_ws/src/rosserial/rosserial_server/src/serial_node.cpp:40: /home/pat/catkin_ws/src/rosserial/rosserial_server/include/rosserial_server/session.h:44:38: fatal error: rosserial_msgs/TopicInfo.h: Datei oder Verzeichnis nicht gefunden #include ^ compilation terminated. In file included from /home/pat/catkin_ws/src/rosserial/rosserial_server/src/socket_node.cpp:40:0: /home/pat/catkin_ws/src/rosserial/rosserial_server/include/rosserial_server/session.h:44:38: fatal error: rosserial_msgs/TopicInfo.h: Datei oder Verzeichnis nicht gefunden #include ^ compilation terminated. ...

Problems with Serial port code for Ros

$
0
0
I wanted the ROS pc to communicate over the UART with a microcontroller on mobile robot, I canot use ros serial as on the controller I canot use C++ code, so I have used a wrapper code for serial port in linux following the example code from this link: https://code.google.com/p/team-diana/source/browse/ros_workspace/fuerte/Serial/src/r2Serial.cpp?r=b3ad5adc6b1e885620b615c5f56ccf929cfbcdc2 My code is as follows: #define DEFAULT_BAUDRATE 115200 #define DEFAULT_SERIALPORT "/dev/ttyUSB0" //Global data FILE *fpSerial = NULL; //serial port file pointer ros::Publisher ucResponseMsg; ros::Subscriber ucCommandMsg; int ucIndex; //ucontroller index number int FileDesc; unsigned char crc_sum=0; //Initialize serial port, return file descriptor FILE *serialInit(char * port, int baud) { int BAUD = 0; int fd = -1; struct termios newtio, oldtio; FILE *fp = NULL; //Open the serial port as a file descriptor for low level configuration // read/write, not controlling terminal for process, fd = open(port, O_RDWR | O_NOCTTY | O_NDELAY); ROS_INFO("FileDesc : %d",fd); if ( fd<0 ) { ROS_ERROR("serialInit: Could not open serial device %s",port); return fp; } // save current serial port settings tcgetattr(fd,&oldtio); // clear the struct for new port settings bzero(&newtio, sizeof(newtio)); //Look up appropriate baud rate constant switch (baud) { case 38400: default: BAUD = B38400; break; case 19200: BAUD = B19200; break; case 115200: BAUD = B115200; break; case 9600: BAUD = B9600; break; case 4800: BAUD = B4800; break; case 2400: BAUD = B2400; break; case 1800: BAUD = B1800; break; case 1200: BAUD = B1200; break; } //end of switch baud_rate if (cfsetispeed(&newtio, BAUD) < 0 || cfsetospeed(&newtio, BAUD) < 0) { ROS_ERROR("serialInit: Failed to set serial baud rate: %d", baud); close(fd); return NULL; } // set baud rate, (8bit,noparity, 1 stopbit), local control, enable receiving characters. newtio.c_cflag = BAUD | CRTSCTS | CS8 | CLOCAL | CREAD; // ignore bytes with parity errors newtio.c_iflag = IGNPAR; // raw output newtio.c_oflag = 0; // set input mode to non - canonical newtio.c_lflag = 0; // inter-charcter timer newtio.c_cc[VTIME] = 0; // blocking read (blocks the read until the no.of charcters are read newtio.c_cc[VMIN] = 0; // clean the line and activate the settings for the port tcflush(fd, TCIFLUSH); tcsetattr (fd, TCSANOW,&newtio); //Open file as a standard I/O stream fp = fdopen(fd, "r+"); if (!fp) { ROS_ERROR("serialInit: Failed to open serial stream %s", port); fp = NULL; } ROS_INFO("FileStandard I/O stream: %d",fp); return fp; } //serialInit //Process ROS command message, send to uController void ucCommandCallback(const geometry_msgs::TwistConstPtr& cmd_vel) { unsigned char msg[14]; float test1,test2; unsigned long i; // build the message packet to be sent msg = packet to be sent; msg[13] = crc_sum; for (i=0;i<14;i++) { fprintf(fpSerial, "%c", msg[i]); } tcflush(FileDesc, TCOFLUSH); } //ucCommandCallback //Receive command responses from robot uController //and publish as a ROS message void *rcvThread(void *arg) { int rcvBufSize = 200; char ucResponse[10];//[rcvBufSize]; //response string from uController char *bufPos; std_msgs::String msg; std::stringstream ss; int BufPos,i; unsigned char crc_rx_sum =0; while (ros::ok()) { BufPos = fread((void*)ucResponse,1,10,fpSerial); for (i=0;i<10;i++) { ROS_INFO("T: %x ",(unsigned char)ucResponse[i]); ROS_INFO("NT: %x ",ucResponse[i]); } msg.data = ucResponse; ucResponseMsg.publish(msg); } return NULL; } //rcvThread int main(int argc, char **argv) { char port[20]; //port name int baud; //baud rate char topicSubscribe[20]; char topicPublish[20]; pthread_t rcvThrID; //receive thread ID int err; //Initialize ROS ros::init(argc, argv, "r2SerialDriver"); ros::NodeHandle rosNode; ROS_INFO("r2Serial starting"); //Open and initialize the serial port to the uController if (argc > 1) { if(sscanf(argv[1],"%d", &ucIndex)==1) { sprintf(topicSubscribe, "uc%dCommand",ucIndex); sprintf(topicPublish, "uc%dResponse",ucIndex); } else { ROS_ERROR("ucontroller index parameter invalid"); return 1; } } else { strcpy(topicSubscribe, "uc0Command"); strcpy(topicPublish, "uc0Response"); } strcpy(port, DEFAULT_SERIALPORT); if (argc > 2) strcpy(port, argv[2]); baud = DEFAULT_BAUDRATE; if (argc > 3) { if(sscanf(argv[3],"%d", &baud)!=1) { ROS_ERROR("ucontroller baud rate parameter invalid"); return 1; } } ROS_INFO("connection initializing (%s) at %d baud", port, baud); fpSerial = serialInit(port, baud); if (!fpSerial ) { ROS_ERROR("unable to create a new serial port"); return 1; } ROS_INFO("serial connection successful"); //Subscribe to ROS messages ucCommandMsg = rosNode.subscribe("cmd_vel" /*topicSubscribe*/, 100, ucCommandCallback); //Setup to publish ROS messages ucResponseMsg = rosNode.advertise(topicPublish, 100); //Create receive thread err = pthread_create(&rcvThrID, NULL, rcvThread, NULL); if (err != 0) { ROS_ERROR("unable to create receive thread"); return 1; } //Process ROS messages and send serial commands to uController ros::spin(); fclose(fpSerial); ROS_INFO("r2Serial stopping"); return 0; } The problems are: communication is not reliable, I get many broken packets in between (the communication is asynchronous), what might be the problem..? and while receiving the data from the micro controller, I will keep on continuously receiving the same last received data even the controller stops sending the data, what might be the problem for this behavior any internal buffer's need to be cleared..? or Is there any serial port library I can readily use (with example) many thanks in advance.

Is it possible to publish messages between 2 Raspberry Pis running ros using a serial type connection (i2c, etc)?

$
0
0
Hello all, first of all let me say how amazing ROS is, I just started with it a couple of days ago and have been extremely impressed with its capabilities and speed. I would like to off load some of my computational power by paralleling multiple Raspberry Pis (2+) on the I2C bus, I've seen a lot of tutorials on hooking up an Arduino to a Pi over the I2C bus / other serial connections but I haven't seen how you would hook 2 Pis together. http://wiki.ros.org/rosserial_arduino/Tutorials/Measuring%20Temperature I know we have the technology, because all the Arduino is doing is posting to Serial and the Raspberry Pi is picking up the messages published (with the command: `rosrun rosserial_python serial_node.py _port:=/dev/ttyUSB0`). But I don't see a similar library to publish these serial messages via python or C. Any help in pointing me in the right direction would be greatly appreciated, Thank you! Dustin

Rosserial HelloWorld On Mac OS X vs. Ubuntu 14.04

$
0
0
Hello All, I'm attempting to use rosserial on a DAGU T'REX Motor controller to receive statuses and send commands to it, but I wanted to become familiar with rosserial first. So, I began working through the tutorials for rosserial, initially on my Ubuntu 14.04 VM (where my installation of ROS indigo resides), specifically the Publisher tutorial for my Arduino Mega 256. Everything worked beautifully and without a hitch. I was able to see the topic and subscribe to it to receive the published "hello world!" string. But, if work through the same tutorial on the Mac side (setting up the IDE and compiling/uploading the sketch), and then connect my arduino back to my Ubuntu VM, rosserial_python will never synch up to forward the topic to the ROS system. One thing to note: to setup ros_lib for my Mac, I just copied the ros_lib folder from the libraries folder on my VM to the libraries folder on my Mac. Would anyone have a suggestion as to my this may be happening?

rosserial and wireless communication

$
0
0
Hi, I am using [APC220](http://www.dfrobot.com/index.php?route=product/product&product_id=57) Radio Communication Module on my arduino atmega2560, in order to communicate with my computer wirelessly. i have written a simple publisher/subscriber node for my arduino using arduino ide and ros_lib, it's works fine using usb to serial cable, but when i'm using APC220(which is actually acts as an serial interface, conntected toRX/TX pins), i am getting following errors:
[ERROR] [WallTime: 1410187017.536715] Tried to publish before configured, topic id 125 
[ERROR] [WallTime: 1410187017.538328] Tried to publish before configured, topic id 125
[WARN] [WallTime: 1410187017.549967] Serial Port read returned short (expected 16 bytes, received 13 instead).
[WARN] [WallTime: 1410187017.550437] Serial Port read failure: 
[INFO] [WallTime: 1410187017.550810] Packet Failed :  Failed to read msg data
[INFO] [WallTime: 1410187017.551095] msg len is 16
I am almost sure about my hardware settings and baud rates, because it's works with a single publisher, my problem is a node with subscriber and publisher working simultaneously. Is there any tips about using rosserial_arduino with wireless modules? Is there any body who has experienced APC220 modules with ROS and Arduino?

Serial Port read returned short error with arduino uno via bluetootle with rosserial

$
0
0
Hi all! I'm working with arduino car under directly ROS topic command. I have a arduino uno board with Arduino Sensor Shield v5.0 installed. I'm running the basic publish and subscribe tutorial from rosserial: http://wiki.ros.org/rosserial_arduino/Tutorials/Hello%20World http://wiki.ros.org/rosserial_arduino/Tutorials/Blink When using USB shown as dev/ttyACM0, things are doing well. Then, I'm trying to connect with HC-05 bluetooth module. First I connect it with command: > sudo rfcomm connect /dev/rfcomm0 00:06:71:00:3E:87 1 And the Then launching rosserial as before with additional argument : > rosrun rosserial_python serial_node.py _port:=/dev/rfcomm0 _baud:=9600 With the tutorial code on the car: #include #include ros::NodeHandle nh; std_msgs::String str_msg; ros::Publisher chatter("chatter", &str_msg); char hello[13] = "hello world!"; void setup() { nh.getHardware()->setBaud(9600); nh.initNode(); nh.advertise(chatter); } void loop() { str_msg.data = hello; chatter.publish( &str_msg ); nh.spinOnce(); delay(1000); } The terminal become a waterfall of running warning: [INFO] [WallTime: 1410329846.797489] ROS Serial Python Node [INFO] [WallTime: 1410329846.814548] Connecting to /dev/rfcomm0 at 9600 baud [WARN] [WallTime: 1410329849.792440] Serial Port read returned short (expected 72 bytes, received 8 instead). [WARN] [WallTime: 1410329849.793548] Serial Port read failure: [INFO] [WallTime: 1410329849.794408] Packet Failed : Failed to read msg data [INFO] [WallTime: 1410329849.795036] msg len is 8 [WARN] [WallTime: 1410329850.814268] Serial Port read returned short (expected 16 bytes, received 13 instead). [WARN] [WallTime: 1410329850.815325] Serial Port read failure: [INFO] [WallTime: 1410329850.816327] Packet Failed : Failed to read msg data [INFO] [WallTime: 1410329850.816984] msg len is 8 For most of the time its complaining about expected 72 bytes. And thetopic, > rostopic info chatter will return result (hello world!) quite randomly (it correctly shows with 1 Hz when using USB) I've done another experiment on subscribe function. Arduino Car subscribe to std_msgs/Empty and topic is published by > rostopic pub toggle_led std_msgs/Empty --rate=1 The result is similar: some of the command can arrived (by moving the sonar servo) but quite randomly, and sometimes move more then 1 time in 1 second (published in 1Hz). I've tried to read the source but still couldn't locate the problem. Any help or suggestion are very welcome, thanks.

changing the port on rosserial_embeddedlinux node results in segmentation fault?

$
0
0
running the HelloRos example in rosserial_embeddedlinux package on Raspberry Pi, Raspbian. if default port is used, compiles and runs OK when adding port number to path like so: nh.initNode(192.168.1.101:114411) results in immediate segmentation fault.. how can the port number be added to the initNode call? Quoted from UPenn Publisher example: > NodeHandle.initNode() accepts> arguments like:>> /dev/ttyUSB1 uses the designated> serial port for messages to> rosserial_python> 192.168.1.2 connects to rosserial_python at the specified IP> address on the default port 11411> 192.168.1.2:12345 connects to rosserial_python at the specified IP> address on the specified port number

rosserial arduino use PROGMEM in ros_lib

$
0
0
Hi all, as stated here (http://arduino.cc/en/pmwiki.php?n=Tutorial/Memory) adruinos usually do not have much SRAM and it is easy to use it all up by using many constant strings > Notice that there's not much SRAM> available in the Uno. It's easy to use> it all up by having lots of strings in> your program.<sarcasm warning> The nice feature of the arduino IDE in this cases is that it does not fail to compile or upload but only the arduino programm will run 'strangely' </sarcasm warning>> If you run out of SRAM, your program> may fail in unexpected ways; it will> appear to upload successfully, but not> run, or run strangely. To check if> this is happening, you can try> commenting out or shortening the> strings or other data structures in> your sketch (without changing the> code). If it then runs successfully,> you're probably running out of SRAM. I have observed this behaviour with my arduino code that uses ros_lib. One of the causes is that ros_lib stores for each topic (publish/subscribe) 3 strings ( md5sum, message type name and topic name ). Particularly if I use topics with namespaces if have observed the problem on arduino uno after setting up only 3 or 4 topics. How the question: Has anyone considered modifying the message generator for Ardunio such that it uses PROGMEM for storing md5sum, topic and stuff? (Or is it even possible?) http://www.arduino.cc/en/Reference/PROGMEM The data is static and I think this would significantly reduce the SRAM usage.... Thank you! Edit 22.09.: anyone?

rosserial_arduino sync error

$
0
0
I am running an arduino Uno connected to a odroid through usb. The odroid is connected through wifi to pc. I am not able to make the odroid get the hello_world rosserial_arduino program to work. If I run the same program by connecting the arduino to the pc,it works. ROS hydro in all devices. A belkin n750 router(has high bandwidth). ---------- Error msg: Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

Unable to sync with device (arduino uno)

$
0
0
Hello guys, Im trying to connect my Arduino Uno to Gazebo simulator via ROS to control a robot model. I set up the installation of rosserial according to the tutorial and moved on to the hello world tutorial. However when I want to connect my arduino Uno with: `rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0` (Im sure I have the correct serial port) I get the following message: [INFO] [WallTime: 1414579866.487628] ROS Serial Python Node [INFO] [WallTime: 1414579866.493390] Connecting to /dev/ttyACM0 at 57600 baud /home/max/catkin_ws/install/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: 1414579883.599380] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino I already reinstalled rosserial, but that didn't help. Anyone with an idea? Thanks in advance!

Arduino mega and rosserial problem

$
0
0
I am using the arduino mega pro board [https://www.sparkfun.com/products/10743](https://www.sparkfun.com/products/10743) I have tested this board using stand alone sketches without ros and have no issues with that. Any sketch below 30kb works with rosserial and arduino mega pro smoothly. As soon as my sketch size increases beyond 30kb, I start getting the error: Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino If I comment some functions in my sketch to bring the size below 30kb, things are working again. One reason why I am using this board over arduino uno is that arduino mega lets me upload sketches over 32k (which is the maximum sketch size for arduino uno). Any idea why this is happening? Does ros think that my mega pro board has a memory of 32k and failing when the sketch size goes beyond that. Any help would be appreciated. Thanks.

Rosserial fails to generate rosserial_msgs library

$
0
0
I've followed this tutorial to set up rosserial for Arduino: http://wiki.ros.org/rosserial_arduino/Tutorials/Arduino%20IDE%20Setup But once I get to the step where I generate the libraries for the Arduino with the command rosrun rosserial_arduino make_libraries.py . I get the following output at the end: *** Warning, failed to generate libraries for the following packages: *** hector_quadrotor_controller_gazebo (missing dependency) rosserial_msgs map_msgs rosserial_arduino The output above that doesn't tell me anything: Exporting rosserial_msgs Messages: TopicInfo,Exporting std_srvs Services: Empty, ... Exporting map_msgs Messages: OccupancyGridUpdate,PointCloud2Update,ProjectedMapInfo,ProjectedMap, Services: SetMapProjections,GetPointMapROI,ProjectedMapsInfo,Exporting tf2_msgs Messages: LookupTransformActionResult,LookupTransformAction,LookupTransformActionGoal,LookupTransformFeedback,TFMessage,LookupTransformActionFeedback,TF2Error,LookupTransformGoal,LookupTransformResult, Services: FrameGraph, ... Exporting rosserial_arduino Messages: Adc,Exporting hector_gazebo_plugins Services: SetBias, I'm not immediately interested in the first and third libraries, but the second and fourth are a problem, because they make it impossible to use rosserial. How do I solve this?

Cannot Subscribe or Publish with latest release & Arduino Diecimila

$
0
0
I have installed and compiled the latest version of the rosserial stack. I have been attempting to run the samples (Hello World, etc.), after I wasn't able to get my own code to work. It turns out, none of the sample work properly. For example, the hello world sample, when I start the python client there are no errors, but the topic from the arduino is never published. i.e. run: roscore rosrun rosserial_python serial_node.py /dev/ttyUSB0 rostopic list The topic is not there. I have verified that the arduino is running properly, and on the correct port (and no port errors are given). The only output is: [INFO] [WallTime: 1331948389.955027] ROS Serial Python Node [INFO] [WallTime: 1331948389.956859] Connected on /dev/ttyUSB0 at 57600 baud Device is Diecimila, running on ros-electric/Ubuntu 11.04 Natty No errors in making the packages, etc.

How to calculate bandwidth requirements for rosserial link?

$
0
0
We are beginning to prototype a small robot with differential drive, an IMU, and multiple sensors. For the first iteration we plan to put an Arduino with rosserial on the robot and run ROS on a PC. I want to calculate the bandwidth needed for the expected message traffic to determine if rosserial will work for us or if we need to use a different approach, however I can't find any references to the size of ROS messages *once they've been serialized.* Can anyone give me some advice on how to approach **calculating** this rather than running a simulation and measuring the bandwidth? Cheers, Mike

rosserial_arduino failed to create service server

$
0
0
I'm filling out functionality of my Arduino controller and want to make an empty service for updating parameters. I'm mimicking the ros_lib examples but whenever I launch the serial node I get a message about "Creation of service server failed: 'NoneType' object has no attribute srv". There are other questions here that are somewhat similar but nothing recent. I'm using rosserial 0.6 with ROS Indigo so from what I can tell rosserial supports services but I've yet to make it work. I've looked at the python code for serial_node but it's a little difficult to tell where the "srv" error comes from. **Server callback function** void paramUpdateCallback(const Empty::Request & request, Empty::Response & response) { ... } **Server definition** ros::ServiceServer parameterUpdate("/arduino/updateparams", &paramUpdateCallback); **ROS init** nh.advertiseService(parameterUpdate);

rosserial_arduino avoid lost messages

$
0
0
Hi, i'm using rosserial_arduino package to communicate with my robot hardware. I'm noticing that some messages are lost in both ways (Arduino->Desktop & Desktop->Arduino) I'm not publishing at high speed, to be more precise messages are sent with several seconds interval between them. Is there a way to make message delivery guaranteed? I can wrap messages in services and use the service responses as aknowledges for but it sounds pretty ugly.

How to change the serial port in the rosserial lib for the Arduino side?

$
0
0
For a lab at my university I have developed a robot with an Arduino Mega ADK that can be controlled by ROS via the rosserial package. The connection between the Arduino and the laptop running ROS is made via bluetooth. During the prototyping phase the bluetooth module, HC-05, was connected to the Serial port that is also used for flashing the Arduino. Whenever I wanted to flash the Arduino I just disconnected the bluetooth module to prevent it from interfering. However, we need to put all the electronics in a 3D printed casing, because we don't want students to touch the electronics during the lab. This revealed that we needed a solution for the interference of the bluetooth module. One option is to turn off the bluetooth with a switch, but this is far from ideal. The other option is to force the Arduino to use another Serial port (Serial1 in this case) for communication with ROS. In ros_lib (generated when running rosrun rosserial_arduino make_libraries.py .) I found the file ArduinoHardware.h which contains some definitions including the iostream on lines 66-72. I changed line 71 to Serial1 which forced the Arduino to use Serial1 instead of Serial. Although this did the job, it is not a very elegant solution. Is there some other, better way to solve this problem? For instance, could I use #define USBCON to change the Serial port or will this have other implications because this is for the Leonardo? (I only saw this just now, so I still have to test this) P.S. Just to be sure, I'm looking for an answer for the client side, not the host side. I already found numerous answers for changing the port on the host side.

Rosserial_arduino: Ok with Float32MultiArray, not with Int32MultiArray

$
0
0
Hello, I am new to both Arduino and ROS. I have connected 3 IR detectors (E18-D50NK) to my Arduino Mega 2560. I am using ROS-Indigo, standard installation on ubuntu Here is the sketch I have uploaded: #include #include std_msgs::Float32MultiArray obstacles_and_holes_msg; ros::Publisher pub_obstacles_and_holes("obstacles_and_holes", &obstacles_and_holes_msg); ros::NodeHandle nh; // IR detectors #define INFRA_NUM 3 #define INFRA_LATENCY 100 const int INFRA_Pins[INFRA_NUM] = {A0, A1, A2}; void setup() { nh.initNode(); // ROS node publisher initialization obstacles_and_holes_msg.data_length = 3; // length of the message (8 IR detectors and 6 sonars) nh.advertise(pub_obstacles_and_holes); } long publisher_timer; void loop() { if (millis() > publisher_timer) { for(int i = 0; i

sync rosserial arduino

$
0
0
There was a couple of seconds a couple of seconds ago a question regarding rosserial arduino I accidentally deleted (I wanted to delete my own comment but accidentally deleted the entire question), sorry. The issue was after running rosrun `rosserial_python serial_node.py _port:=/dev/ttyACM0` the error `unable to sync with device occurred.` The code looked quite like the example service client code but with a custom message (does not matter for the issue) and some parts commented out: /* * rosserial Service Client */ #include #include #include ros::NodeHandle nh; using rosserial_arduino::Test; ros::ServiceClient client("test_srv"); // std_msgs::String str_msg; // ros::Publisher chatter("chatter", &str_msg); // char hello[13] = "hello world!"; void setup() { nh.initNode(); nh.serviceClient(client); // nh.advertise(chatter); while(!nh.connected()) nh.spinOnce(); nh.loginfo("Startup complete"); } void loop() { Test::Request req; Test::Response res; req.input = hello; client.call(req, res); // str_msg.data = res.output; // chatter.publish( &str_msg ); // nh.spinOnce(); delay(100); }
Viewing all 314 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>