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

Roslocate shows wrong package version - how do I install the right one?

$
0
0
I've just installed ROS Kinetic from source on my Raspberry Pi (running Raspbian Stretch), and I'd like to add rosserial and rosserial_arduino. When I looked up the packages with roslocate, I got this: pi@raspberrypi:~/ros_catkin_ws $ roslocate info rosserial Using ROS_DISTRO: kinetic - git: local-name: rosserial uri: https://github.com/ros-drivers/rosserial.git version: jade-devel pi@raspberrypi:~/ros_catkin_ws $ roslocate info rosserial_arduino Using ROS_DISTRO: kinetic - git: local-name: rosserial_arduino uri: https://github.com/ros-drivers/rosserial.git version: jade-devel I haven't generated a rosinstall including these yet, because I'm worried about those version descriptions. Is it nothing to worry about, or do I have to do something special to get the Kinetic versions rather than the Jade ones?

Does anyone have tips/examples getting a rosserial_windows publisher in a class?

$
0
0
I can get things working in main and/or using global functions but can't seem to get things working as a member of a class. I am not sure how to initialize the member variables for NodeHandle and Publisher and not totally who should be calling spin (i.e., the class via some callback or the parent function/class that owns the class with said publisher). This particular stack seems dangerous with respect to assumptions regarding ros APIs (vs their native counterparts). Thanks, Brett

How to use publish and use multiple sonar range_msg data (using rosserial) on a single topic?

$
0
0
Hi, I am learning ROS by developing a differential drive collision avoidance robot. (Specifically the Parallax ARLO Robot). I have written a code that can publish one ping sensor's range value to a node, and then have the Arduino subscribe to that node and read the data and execute it's if loop based on that data. **My question is, how do I publish multiple range messages to a topic and decide which ultrasonic sensor value should be used when subscribing to that topic?** Below is the current working code. What I'm unsure how to figure out is: in the callback function, the distance (this is the front sensor) is equal to range_msg.range. So what if I have multiple range messages, and don't know how to define which distance belongs to each sensor? For example, distance_left = range_msg.range distance_right = range_msg.range and so on is all I know how to do as of now. I know how to publish multiple messages to that range_msg but I my understanding of subscribing is still very weak. Thank you very much for your help, and I am very new to this ros community so please let me know if there are ways I can improve my question. #include // Include ARLO Library #include // Include SoftwareSerial Library #include #include #include #include // Create Arlo and Serial Objects ArloRobot Arlo; // Arlo Object SoftwareSerial ArloSerial(12, 13); // Serial in I/O 12, Servo servo; ros::NodeHandle nh; sensor_msgs::Range range_msg; long duration; int distance; /**** Motor Callback Function ****/ void motor_cb( const sensor_msgs::Range& range_msg){ distance = range_msg.range; if (distance < 30) { Arlo.writeMotorPower(0,0); } else { Arlo.writeMotorPower(30,30); } } ros::Publisher pub_range1("/ultrasound1", &range_msg); ros::Publisher pub_range2("/ultrasound2", &range_msg); ros::Subscriber sub_range("/ultrasound1", motor_cb); char frameid[] = "/ultrasound"; void setup() { servo.attach(9); nh.initNode(); nh.advertise(pub_range1); // Front Sensor nh.advertise(pub_range2); // Back Sensor nh.subscribe(sub_range); ArloSerial.begin(19200); Arlo.begin(ArloSerial); Arlo.writeMotorPower(60, 60); delay(3000); Arlo.writeMotorPower(0,0); } long range_time; void loop() { if ( millis() >= range_time ){ range_msg.range = getRange_Ultrasound(14); pub_range1.publish(&range_msg); pub_range2.publish(&range_msg); range_time = millis() + 50; } nh.spinOnce(); } /**** Get Ultrasonic Ranges ****/ float getRange_Ultrasound(int pin_num) { pinMode(pin_num, OUTPUT); digitalWrite(pin_num, LOW); delayMicroseconds(2); digitalWrite(pin_num, HIGH); delayMicroseconds(10); digitalWrite(pin_num, LOW); pinMode(pin_num, INPUT); duration = pulseIn(pin_num, HIGH); return duration/58; }

How to set up an Arduino sub-node which is connected to raspberry pi via usb.

$
0
0
I want to set up a remote pick and place bot (Arduino+Raspberry pi) whose angle parameters are controlled by potentiometer values of another bot (Arduino+Raspberry pi) both of which are on the same network. The following image might help visualise what I mean. ![Setup](https://i.imgur.com/wC1Kebf.png) So what I want is to make 2 Raspi nodes (publishers and subscriber) which relay data obtained from Arduino connected to them via USB. Now I'm not sure how I can make the setup as most of the tutorials I've found use Arduino as the node and raspi as the roscore. In my case that is not possible as the two raspberry pis are at two different locations (but on the same network). Can someone please guide me in this regard

time functions

$
0
0
Hi, does someone now what the function reqestSyncTime() and syncTime(data) do? Which time they are synchronizing? between host and ros? They are defined in nodehandle.h and get executed every time spinOnce() gets executed. Thanks

rosserial embedded - tf to Publish an Odometry transform cause Segmentation fault

$
0
0
Hi Community, i'm trying to include odometry to my tiny robot. So far, rosserial is running on a small linux board and gehts its sensor_msgs::imu from onboard an imu sensor. Now i am working on odomety (primitive one)... For reference i have used: [Navigatin Tutorial](http://wiki.ros.org/navigation/Tutorials/RobotSetup/Odom) which worked great on my PC with rosbag an rviz. But when i try to combine rosserial with tf (from the tutorial) on my rosserial node, i get an segmentation fault while: odom_broadcaster.sendTransform(odom_trans); // Line 55 on the Tutorial page Changes for rosserial for the tutorial: from: ros::Publisher odom_pub = n.advertise("odom", 50); to: ros::Publisher odom_pub ("odom", &odom_msg); nh.advertise(odom_pub); but what ever i try, odom_broadcaster.sendTransform(odom_trans); from tutorial an in libs/ros_lib/tf/transform_broadcaster.h causes an segmentation fault. my other messages are quiet good, as long as this one line is commented out... Has anyone an advice for me, or has encountered the same/similar problem?

Subscriber Callback not being triggered when JointState message is passed

$
0
0
Dear all, I have come across a strange problem; maybe it's just something simple, but I am not really good at ROS programming. Explaining the problem: I am using the rosserial package on Arduino Mega to log data and apply control inputs to a set of servos. In order to do that, I created a subscriber as follows: void controlCallback(const sensor_msgs::JointState& servo_des_states); ros::Subscriber control_sub("controlInput", controlCallback); void setup(){ ... nh.subscribe(control_sub); ... } ... void controlCallback(const sensor_msgs::JointState& servo_des_states){ servoRadians = servo_des_states.position; sendControlInput(RadToPWM(servoRadians), controlSpeed); digitalWrite(13, HIGH-digitalRead(13)); } when invoking the serial_node.py it lists that the subscriber is active and listening on the right topic: cr055@cr055:~/catkin_ws$ rosrun rosserial_python serial_node.py /dev/ttyACM0 _baud:=115200 [INFO] [1548676899.466166]: ROS Serial Python Node [INFO] [1548676899.471357]: Connecting to /dev/ttyACM0 at 115200 baud [INFO] [1548676901.575863]: Requesting topics... [INFO] [1548676904.505507]: Note: publish buffer size is 512 bytes [INFO] [1548676904.505995]: Setup publisher on /tf [tf/tfMessage] [INFO] [1548676904.509778]: Note: subscribe buffer size is 1024 bytes [INFO] [1548676904.510289]: Setup subscriber on controlInput [sensor_msgs/JointState] Although it seems everything correctly set up, the callback does not get triggered when I publish the mentioned messages. If I try to send another kind of message (redefining the subscriber type and callback), for instance Float32, it works flawlessly. It seems that the problem comes out when I use more complex kinds of messages (like sensor_msgs or MultiArray). I hope someone has any clue about what's wrong here. TL;DR: the callback function in the subscriber does not get invoked if the message type is multidimensional like JointState or Float32MultiArray. If I use simple floats I get the callback working. UPDATE which might help: if I publish only a vector of two elements e.g. {position:[0,0]} the callback works. Am I missing something in the declaration of the published message? UPDATE #2: I think that the arduino serial cannot handle packages as big as JointState if I publish 18 servos all together. Still, a workaround / alternative to publish 18 float values is welcome. Sincerely, Alessandro

ros msg serialize and deserialize for type double

$
0
0
Hi I have done a custom message for a type uint64_t but how I do this for type double? Here my code: class EkfParameters : public ros::Msg { public: typedef uint64_t _residual_type; _residual_type residual; EkfParameters(): residual(0) { } virtual int serialize(unsigned char *outbuffer) const { int offset = 0; *(outbuffer + offset + 0) = (this->residual >> (8 * 0)) & 0xFF; *(outbuffer + offset + 1) = (this->residual >> (8 * 1)) & 0xFF; *(outbuffer + offset + 2) = (this->residual >> (8 * 2)) & 0xFF; *(outbuffer + offset + 3) = (this->residual >> (8 * 3)) & 0xFF; *(outbuffer + offset + 4) = (this->residual >> (8 * 4)) & 0xFF; *(outbuffer + offset + 5) = (this->residual >> (8 * 5)) & 0xFF; *(outbuffer + offset + 6) = (this->residual >> (8 * 6)) & 0xFF; *(outbuffer + offset + 7) = (this->residual >> (8 * 7)) & 0xFF; offset += sizeof(this->residual); return offset; } virtual int deserialize(unsigned char *inbuffer) { int offset = 0; this->residual = ((uint64_t) (*(inbuffer + offset))); this->residual |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); this->residual |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); this->residual |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); this->residual |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); this->residual |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); this->residual |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); this->residual |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); offset += sizeof(this->residual); return offset; } const char * getType(){ return "arduino_vi_sync/EkfParameters"; }; const char * getMD5(){ return "429a0337b7125479e9bf5f4056e69192"; }; }; But how I do this for a type double. If I just change the type then I get a error message because << is not for type double. What can I do? Thanks

How to connect ROS with my Parallax microcontroller?

$
0
0
Hi, I have almost no experience writing sorts of serial communication protocols. So far, I have been using rosserial but I keep running into an issue where it states [ERROR] [1550568650.647942]: Lost sync with device, restarting... , and I have searched up this issue but there is no one definite way. I am trying to publish encoder counts but I'm guessing it's just updating way too quickly to ROS, since the arduino mega only has 8KB of dynamic memory. (I will open another question for this, because I still think rosserial is very convenient for me.) I want to connect my Parallax ActivityBoard WX Microcontroller from my Arlo Robot to publish messages. I looked at this question, https://answers.ros.org/question/10114/how-can-ros-communicate-with-my-microcontroller/, and it suggests that I write simply push out messages to a serial port, and use an individual ros node in order to convert those messages. I am simply just trying to use the microcontroller for the odometry of my wheeled robot. What I was originally doing over rosserial was sending out encoder tick values and then subscribing to cmd_vel messages. Is bridging this connection between microprocessor and ROS feasible for someone with limited serial protocol experience, and if so how should I do it?

rosserial Losing Sync with Device when publishing encoder counts.

$
0
0
Hi, I have an Arduino on Kinetic that is supposed to be publishing encoder counts. It is working properly but for some reason now I am running into an issue where the device falls out of sync with ROS. [ERROR] [1550568650.647942]: Lost sync with device, restarting... My code is working properly, and it publishes counts successfully except every 20 seconds it times out and restarts. I looked at other answers, and I have made sure my distro is up to date, and made sure I gave permissions to the USB port that it is on. I actually seemed to start having this issue today, when I was testing my code for my ultrasonic sensor range publishing. I never had this issue before with that arduino sketch, so I'm not necessarily sure if it's an Arduino problem.. If it makes any difference, the only major change I made in my computer is upgrading from Python 3.5 to 3.6 a couple days ago before I started working again on my robot. Here is my code following, #include // Include ARLO Library #include // Include SoftwareSerial Library #include #include #include #include #include #include #include int countsLeft, countsRight; // Encoder counting variables /**** CREATE ARLO OBJECT AND SERIAL COMMUNICATION ****/ ArloRobot Arlo; // Arlo Object SoftwareSerial ArloSerial(12, 13); // Serial in I/O 12, Servo servo; ros::NodeHandle_ nh; long duration; int distance; volatile long lwheel; volatile long rwheel; //std_msgs::Int32 lwheelMsg; //ros::Publisher countsLeftPub("/lwheel_ticks", &lwheelMsg); std_msgs::Int32 rwheelMsg; ros::Publisher countsRightPub("/rwheel_ticks", &rwheelMsg); void setup() { ArloSerial.begin(19200); Arlo.begin(ArloSerial); Arlo.clearCounts(); nh.initNode(); // nh.advertise(countsLeftPub); nh.advertise(countsRightPub); while(!nh.connected()) { nh.spinOnce(); } } void loop() { Arlo.writeMotorPower(30,30); // lwheelMsg.data = Arlo.readCountsLeft(); // countsLeftPub.publish(&lwheelMsg); rwheelMsg.data = Arlo.readCountsRight(); countsRightPub.publish(&rwheelMsg); nh.spinOnce(); }

rqt_image_view look at only one image

$
0
0
Hi I have a rosbag with images and with rqt_image_view I can see them, but only the whole bag at once. Is there a way to look at one image for several secondes/minutes? Now the images are like a video, in the same frequency as the rosbag is recored. Thanks

Time synchronization rosserial

$
0
0
Hi [link text](http://wiki.ros.org/rosserial#Time) Does someone have more information to the point 3.3 Time? How is this done excatly? and where? Thanks

Why do we need the time sync functions? arduino node handle

$
0
0
Hi Why do we need the time sync functions in the node_handle.h file? [link text](https://github.com/ros-drivers/rosserial/blob/40f61b98e6865ec4127d8949158ee607d62a3aaf/rosserial_client/src/ros_lib/ros/node_handle.h#L368-L390) Whats the problem if the clock from the arduino and the host are not in sync? The arduino starts from 0 and from 1970 or something. And if I use node_handle.now(), is this the time from the host or the Arduino? Thanks

rosserial: node_handle hardware.read()

$
0
0
Hi What does this line of code do (from [here](https://github.com/ros-drivers/rosserial/blob/40f61b98e6865ec4127d8949158ee607d62a3aaf/rosserial_client/src/ros_lib/ros/node_handle.h#L246)): int data = hardware_.read(); thx

requestSyncTime() node_handle, Arduino

$
0
0
Hi Does someone know what this line [link text](https://github.com/ros-drivers/rosserial/blob/40f61b98e6865ec4127d8949158ee607d62a3aaf/rosserial_client/src/ros_lib/ros/node_handle.h#L375) does? publish(TopicInfo::ID_TIME, &t); It is in `requestSync()` function. Also what is the purpose of the function `requestSync()`and `syncTime(uint8_t data)`? The first one publishes a message to the host, the second receives it? How does this happen in detail? Thanks

rosserial packages not available in ros

$
0
0
Hi All, I am working on ROS Melodic. On running the command: **rosrun rosserial_python serial_node.py /dev/ttyACM0**. I'm getting an error which says **No module named 'SerialClient'** Error Output Traceback (most recent call last): File "/opt/ros/melodic/lib/rosserial_python/serial_node.py", line 39, in from rosserial_python import SerialClient, RosSerialServer File "/opt/ros/melodic/lib/python2.7/dist-packages/rosserial_python/__init__.py", line 1, in from SerialClient import * ModuleNotFoundError: No module named 'SerialClient'

Rosserial Creation of Subscriber Failed

$
0
0
After running: rosrun rosserial_python serial_node.py /dev/ttyACM0 I receive these info and error messages (node connects, but can't find subscriber): [INFO] [1553102815.473901]: ROS Serial Python Node [INFO] [1553102815.508651]: Connecting to /dev/ttyACM0 at 57600 baud [ERROR] [1553102817.635874]: Creation of subscriber failed: need more than 1 value to unpack I am running ROS Kinetic on a 4G/64G LattePanda with Ubuntu 16.04 LTS, 64 bit, kernel 4.12.1-20180417 This is my first time using ROS. My goal is to use rosserial and the LattePanda's onboard arduino (Arduino Leonardo) to create a subscriber to a custom message format. I have another publisher that is running in a terminal session on the LattePanda. I use the following procedure as setup: After using: catkin_make I see no errors or issues. I then try and build the arduino headers that will be necessary to flash. First, I delete the ros_lib folder in the ~/Arduino/library/ directory. Then: ~/Arduino/libraries$ rosrun rosserial_client make_libraries . This seems to run properly, giving output in the terminal and recreating the ros_lib folder in the ~/Arduino/libraries/ directory. After running roscore and my publisher node, the messages are being published properly because I can view them using: rostopic echo /moveControl I will say that one of my issues is that after creating the header files for the arduino, when I try and use #include in the arduino code, I am presented with the following error when I attempt to compile: movementControl:4:41: error: beginner_tutorials/Movement.h: No such file or directory compilation terminated. exit status 1 beginner_tutorials/Movement.h: No such file or directory This is extra irksome, because I can clearly see that the file and directory do exist. I assumed that this was a problem that could be resolved by exiting and reopening the arduino editor (maybe to refresh libraries?), but that did not solve the issue. The only fix I found was to manually include the absolute filepath as shown in my code below. After doing this, it does compile, but I can't help but feel it must be related to rosserial not being able to see my subscriber on the arduino. I will say that I have had rosserial working before when I was using a std_msgs uint16_t. This must be an issue with my custom message type. I am a newbie when it comes to ROS and C++, so I would appreciate any and all help! All of my files are below: **Movement.msg:** int16 servoVal int16 motorVal **movementControl.ino:** #define USE_USBCON #include #include ros::NodeHandle n; #include #include SoftwareSerial maestroSerial(7, 8); MiniMaestro maestro(maestroSerial); // Defining upper and lower bounds for servo target values int16_t servoLowTarget = 4000; int16_t servoMid = 6000; int16_t servoHighTarget = 8000; int16_t servoGroup1 = 6000; int16_t servoGroup2 = 6000; // Defining Pins for Motor Drivers const int IN1=10; const int IN2=11; const int ENA=9; const int IN3=5; const int IN4=6; const int ENB=3; // ###################################################### // void Maestro::setAcceleration ( uint8_t channelNumber, // uint16_t acceleration ) // ###################################################### // ###################################################### // void Maestro::setSpeed ( uint8_t channelNumber, // uint16_t speed ) // ###################################################### // ###################################################### // void Maestro::setTarget ( uint8_t channelNumber, // uint16_t target ) // // Where target is represented in quarter-microseconds // ###################################################### void servo_cb( const beginner_tutorials::Movement& cmd_msg ){ servoGroup1 = servoMid + cmd_msg.servoVal; servoGroup2 = servoMid - cmd_msg.servoVal; // Setting servos to current target values maestro.setTarget(0, (uint16_t)servoGroup1); maestro.setTarget(2, (uint16_t)servoGroup1); maestro.setTarget(4, (uint16_t)servoGroup2); maestro.setTarget(6, (uint16_t)servoGroup2); // Setting motors to current target values if (cmd_msg.motorVal == 1) Move_Forward(100); if (cmd_msg.motorVal == -1) Move_Backward(100); } ros::Subscriber sub("moveControl", servo_cb); void setup() { // Setting maestro serial buad rate to 9600 (standard) maestroSerial.begin(9600); n.initNode(); n.subscribe(sub); // Setting servo speed to unlimited maestro.setSpeed(0, 0); maestro.setSpeed(2, 0); maestro.setSpeed(4, 0); maestro.setSpeed(6, 0); // Setting servo acceleration to unlimited maestro.setAcceleration(0,0); maestro.setAcceleration(2,0); maestro.setAcceleration(4,0); maestro.setAcceleration(6,0); // Setting Pin Modes for Motor Driver pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(ENA, OUTPUT); pinMode(IN4, OUTPUT); pinMode(IN3, OUTPUT); pinMode(ENB, OUTPUT); } void loop() { n.spinOnce(); delay(1); } //####################################################### //#############DEFINING MOTOR FUNCTIONS################## //####################################################### void Motor1_Forward(int Speed) { digitalWrite(IN1,HIGH); digitalWrite(IN2,LOW); analogWrite(ENA,Speed); } void Motor1_Backward(int Speed) { digitalWrite(IN1,LOW); digitalWrite(IN2,HIGH); analogWrite(ENA,Speed); } void Motor1_Brake() { digitalWrite(IN1,LOW); digitalWrite(IN2,LOW); } void Motor2_Forward(int Speed) { digitalWrite(IN3,HIGH); digitalWrite(IN4,LOW); analogWrite(ENB,Speed); } void Motor2_Backward(int Speed) { digitalWrite(IN3,LOW); digitalWrite(IN4,HIGH); analogWrite(ENB,Speed); } void Motor2_Brake() { digitalWrite(IN3,LOW); digitalWrite(IN4,LOW); } void Move_Forward(int Speed) { Motor1_Forward(Speed); Motor2_Forward(Speed); delay(500); Motor1_Brake(); Motor2_Brake(); delay(100); } void Move_Backward(int Speed) { Motor1_Backward(Speed); Motor2_Backward(Speed); delay(500); Motor1_Brake(); Motor2_Brake(); delay(100); } //####################################################### //####################################################### //####################################################### **command_pub.cpp running on in terminal session on LattePanda:** #include "ros/ros.h" #include "beginner_tutorials/Movement.h" #include #include uint16_t servoLowTarget = 4000; uint16_t servoHighTarget = 8000; int maxDisplace = 2000; int main(int argc, char **argv) { initscr(); raw(); keypad(stdscr, TRUE); noecho(); cbreak(); ros::init(argc, argv, "command_pub"); ros::NodeHandle n; ros::Publisher command_pub = n.advertise("moveControl", 1000); ros::Rate loop_rate(10); int c = 0; int currentServoVal = 0; int currentMotorVal = 0; beginner_tutorials::Movement command; while (ros::ok()) { c = 0; c = getch(); currentMotorVal = 0; switch(c) { case 'q': printw("quitting..."); endwin(); return 0; break; case KEY_RIGHT: currentServoVal += 200; break; case KEY_LEFT: currentServoVal -= 200; break; case KEY_UP: currentMotorVal = 1; break; case KEY_DOWN: currentMotorVal = -1; break; default: printw("I don't recognize that\n"); } if (currentServoVal >= maxDisplace) currentServoVal = maxDisplace; if (currentServoVal <= -(maxDisplace)) currentServoVal = -(maxDisplace); command.servoVal = currentServoVal; command.motorVal = currentMotorVal; command_pub.publish(command); printw("Current Servo Value: %d\n", (int)currentServoVal); printw("Current Motor Value: %d\n", (int)currentMotorVal); refresh(); ros::spinOnce(); loop_rate.sleep(); } endwin(); return 0; } **package.xml:** beginner_tutorials0.0.0The beginner_tutorials packagerosuserTODOmessage_generationmessage_runtimecatkinroscpprospystd_msgsroscpprospystd_msgsroscpprospystd_msgsbeginner_tutorials/Movement **excerpts from CMakeLists.txt:** find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs message_generation ) add_message_files( FILES Movement.msg ) generate_messages( DEPENDENCIES std_msgs ) CATKIN_DEPENDS message_runtime find_package(Curses REQUIRED) add_executable(talker src/talker.cpp) target_link_libraries(talker ${catkin_LIBRARIES}) add_dependencies(talker beginner_tutorials_generate_messages_cpp) add_executable(listener src/listener.cpp) target_link_libraries(listener ${catkin_LIBRARIES}) add_dependencies(listener beginner_tutorials_generate_messages_cpp) add_executable(command_pub src/command_pub.cpp) target_link_libraries(command_pub ${catkin_LIBRARIES} ${CURSES_LIBRARIES}) add_dependencies(command_pub beginner_tutorials_generate_messages_cpp)

About rosserial_stm32 on STM32 Nucleo L4 series

$
0
0
Excuse me, I am not fluent in English.So I use machine translation. I tried to operate STM32 L4 series using this library (https://github.com/yoneken/rosserial_stm32). I referred to here(https://www.slideshare.net/k_yone/rosserial-stm32). However, I got such an error. ``` $rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0 _baud:=57600 [INFO] [1553585723.997853]: ROS Serial Python Node [INFO] [1553585724.007428]: Connecting to /dev/ttyACM0 at 57600 baud [INFO] [1553585726.113745]: Requesting topics... [ERROR] [1553585741.116108]: Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino ``` How can I solve this error? ##environment## - Ubuntu 16.04 + kinetic - STM32L476 - [rosserial_stm32](https://github.com/yoneken/rosserial_stm32) - SW4STM32 + CubeMX + ST-Link ##used commands## `$ code STM32Hardware.h` In `STM32Hardware.h` `-#include "stm32f3xx_hal.h"` `-#include "stm32f3xx_hal_uart.h"` `-#include "stm32f3xx_hal_tim.h"` `+#include "stm32l4xx_hal.h"` `+#include "stm32l4xx_hal_uart.h"` `+#include "stm32l4xx_hal_tim.h"` then... `$ cd ~/catkin_ws` `$ catkin_make` `$ cd ./src/rosserial_stm32/src/ros_lib/examples` `$ cp -r chatter ~/workspace` `$ cd ~/workspace/chatter` `$ rosrun rosserial_stm32 make_libraries.py .` Start CubeMX and load chatter.ioc. Configure peripheral settings. `Configuration chatter STM32CubeMX 5.0.1 Date 03/27/2019 MCU STM32L476RGTx ` ` PERIPHERALS MODES FUNCTIONS PINS RCC Crystal/Ceramic Resonator RCC_OSC32_IN PC14-OSC32_IN (PC14) RCC Crystal/Ceramic Resonator RCC_OSC32_OUT PC15-OSC32_OUT (PC15) SYS Serial Wire SYS_JTCK-SWCLK PA14 (JTCK-SWCLK) SYS Serial Wire SYS_JTMS-SWDIO PA13 (JTMS-SWDIO) SYS SysTick SYS_VS_Systick VP_SYS_VS_Systick TIM2 Internal Clock TIM2_VS_ClockSourceINT VP_TIM2_VS_ClockSourceINT USART2 Asynchronous USART2_RX PA3 USART2 Asynchronous USART2_TX PA2 ` ` Pin Nb PINs FUNCTIONs LABELs 2 PC13 GPIO_EXTI13 B1 [Blue PushButton] 3 PC14-OSC32_IN (PC14) RCC_OSC32_IN 4 PC15-OSC32_OUT (PC15) RCC_OSC32_OUT 5 PH0-OSC_IN (PH0)* RCC_OSC_IN 6 PH1-OSC_OUT (PH1)* RCC_OSC_OUT 16 PA2 USART2_TX USART_TX 17 PA3 USART2_RX USART_RX 21 PA5 GPIO_Output LD2 [green Led] 46 PA13 (JTMS-SWDIO) SYS_JTMS-SWDIO TMS 49 PA14 (JTCK-SWCLK) SYS_JTCK-SWCLK TCK 55 PB3 (JTDO-TRACESWO)* SYS_JTDO-SWO SWO PERIPHERALS MODES FUNCTIONS PINS RCC Crystal/Ceramic Resonator RCC_OSC32_IN PC14-OSC32_IN (PC14) RCC Crystal/Ceramic Resonator RCC_OSC32_OUT PC15-OSC32_OUT (PC15) SYS Serial Wire SYS_JTCK-SWCLK PA14 (JTCK-SWCLK) SYS Serial Wire SYS_JTMS-SWDIO PA13 (JTMS-SWDIO) SYS SysTick SYS_VS_Systick VP_SYS_VS_Systick TIM2 Internal Clock TIM2_VS_ClockSourceINT VP_TIM2_VS_ClockSourceINT USART2 Asynchronous USART2_RX PA3 USART2 Asynchronous USART2_TX PA2 ` ` Pin Nb PINs FUNCTIONs LABELs 2 PC13 GPIO_EXTI13 B1 [Blue PushButton] 3 PC14-OSC32_IN (PC14) RCC_OSC32_IN 4 PC15-OSC32_OUT (PC15) RCC_OSC32_OUT 5 PH0-OSC_IN (PH0)* RCC_OSC_IN 6 PH1-OSC_OUT (PH1)* RCC_OSC_OUT 16 PA2 USART2_TX USART_TX 17 PA3 USART2_RX USART_RX 21 PA5 GPIO_Output LD2 [green Led] 46 PA13 (JTMS-SWDIO) SYS_JTMS-SWDIO TMS 49 PA14 (JTCK-SWCLK) SYS_JTCK-SWCLK TCK 55 PB3 (JTDO-TRACESWO)* SYS_JTDO-SWO SWO ` ` SOFTWARE PROJECT `` Project Settings : Project Name : chatter Project Folder : /home/hoge1/workspace/chatter Toolchain / IDE : SW4STM32 Firmware Package Name and Version : STM32Cube FW_L4 V1.13.0 ` ` Code Generation Settings : STM32Cube Firmware Library Package : Copy only the necessary library files Generate peripheral initialization as a pair of '.c/.h' files per peripheral : No Backup previously generated files when re-generating : No Delete previously generated files when not re-generated : Yes Set all free pins as analog (to optimize the power consumption) : No ` `Toolchains Settings : Compiler Optimizations :` then,generate code for SW4STM32. At SW4STM32 ,convert C to C++.

About rosserial_stm32 on STM32 L4 series

$
0
0
Excuse me, I am not fluent in English.So I use machine translation. I tried to operate STM32 L4 series using this library (https://github.com/yoneken/rosserial_stm32). I referred to here(https://www.slideshare.net/k_yone/rosserial-stm32). However, I got such an error. `$rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0 _baud:=57600` `[INFO] [1553585723.997853]: ROS Serial Python Node` `[INFO] [1553585724.007428]: Connecting to /dev/ttyACM0 at 57600 baud` `[INFO] [1553585726.113745]: Requesting topics...` `[ERROR] [1553585741.116108]: Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino` How can I solve this error? ##environment## - Ubuntu 16.04 + kinetic - STM32L476 - [rosserial_stm32](https://github.com/yoneken/rosserial_stm32) - SW4STM32 + CubeMX + ST-Link ##used commands## `$ code STM32Hardware.h` In `STM32Hardware.h` `-#include "stm32f3xx_hal.h"` `-#include "stm32f3xx_hal_uart.h"` `-#include "stm32f3xx_hal_tim.h"` `+#include "stm32l4xx_hal.h"` `+#include "stm32l4xx_hal_uart.h"` `+#include "stm32l4xx_hal_tim.h"` then... `$ cd ~/catkin_ws` `$ catkin_make` `$ cd ./src/rosserial_stm32/src/ros_lib/examples` `$ cp -r chatter ~/workspace` `$ cd ~/workspace/chatter` `$ rosrun rosserial_stm32 make_libraries.py .` Start CubeMX and load chatter.ioc. Configure peripheral settings. `Configuration chatter STM32CubeMX 5.0.1 Date 03/27/2019 MCU STM32L476RGTx ` ` PERIPHERALS MODES FUNCTIONS PINS RCC Crystal/Ceramic Resonator RCC_OSC32_IN PC14-OSC32_IN (PC14) RCC Crystal/Ceramic Resonator RCC_OSC32_OUT PC15-OSC32_OUT (PC15) SYS Serial Wire SYS_JTCK-SWCLK PA14 (JTCK-SWCLK) SYS Serial Wire SYS_JTMS-SWDIO PA13 (JTMS-SWDIO) SYS SysTick SYS_VS_Systick VP_SYS_VS_Systick TIM2 Internal Clock TIM2_VS_ClockSourceINT VP_TIM2_VS_ClockSourceINT USART2 Asynchronous USART2_RX PA3 USART2 Asynchronous USART2_TX PA2 ` ` Pin Nb PINs FUNCTIONs LABELs 2 PC13 GPIO_EXTI13 B1 [Blue PushButton] 3 PC14-OSC32_IN (PC14) RCC_OSC32_IN 4 PC15-OSC32_OUT (PC15) RCC_OSC32_OUT 5 PH0-OSC_IN (PH0)* RCC_OSC_IN 6 PH1-OSC_OUT (PH1)* RCC_OSC_OUT 16 PA2 USART2_TX USART_TX 17 PA3 USART2_RX USART_RX 21 PA5 GPIO_Output LD2 [green Led] 46 PA13 (JTMS-SWDIO) SYS_JTMS-SWDIO TMS 49 PA14 (JTCK-SWCLK) SYS_JTCK-SWCLK TCK 55 PB3 (JTDO-TRACESWO)* SYS_JTDO-SWO SWO PERIPHERALS MODES FUNCTIONS PINS RCC Crystal/Ceramic Resonator RCC_OSC32_IN PC14-OSC32_IN (PC14) RCC Crystal/Ceramic Resonator RCC_OSC32_OUT PC15-OSC32_OUT (PC15) SYS Serial Wire SYS_JTCK-SWCLK PA14 (JTCK-SWCLK) SYS Serial Wire SYS_JTMS-SWDIO PA13 (JTMS-SWDIO) SYS SysTick SYS_VS_Systick VP_SYS_VS_Systick TIM2 Internal Clock TIM2_VS_ClockSourceINT VP_TIM2_VS_ClockSourceINT USART2 Asynchronous USART2_RX PA3 USART2 Asynchronous USART2_TX PA2 ` ` Pin Nb PINs FUNCTIONs LABELs 2 PC13 GPIO_EXTI13 B1 [Blue PushButton] 3 PC14-OSC32_IN (PC14) RCC_OSC32_IN 4 PC15-OSC32_OUT (PC15) RCC_OSC32_OUT 5 PH0-OSC_IN (PH0)* RCC_OSC_IN 6 PH1-OSC_OUT (PH1)* RCC_OSC_OUT 16 PA2 USART2_TX USART_TX 17 PA3 USART2_RX USART_RX 21 PA5 GPIO_Output LD2 [green Led] 46 PA13 (JTMS-SWDIO) SYS_JTMS-SWDIO TMS 49 PA14 (JTCK-SWCLK) SYS_JTCK-SWCLK TCK 55 PB3 (JTDO-TRACESWO)* SYS_JTDO-SWO SWO ` ` SOFTWARE PROJECT `` Project Settings : Project Name : chatter Project Folder : /home/hoge1/workspace/chatter Toolchain / IDE : SW4STM32 Firmware Package Name and Version : STM32Cube FW_L4 V1.13.0 ` ` Code Generation Settings : STM32Cube Firmware Library Package : Copy only the necessary library files Generate peripheral initialization as a pair of '.c/.h' files per peripheral : No Backup previously generated files when re-generating : No Delete previously generated files when not re-generated : Yes Set all free pins as analog (to optimize the power consumption) : No ` `Toolchains Settings : Compiler Optimizations :` then,generate code for SW4STM32. At SW4STM32 ,convert C to C++.

Need to Connect uP to ROS/Linux on a new project. Is ROS2 the way to go?

$
0
0
I have a STM32F type microcontroller running a sensor and I'd like it to interface to ROS as a node over a serial (USB, SPI, I2C,..) link. This uP is not an Arduino. It runs a real-time OS. With Effort, I might get ROS Serial to work and then run a ROS Serial server on the Linux side. In fact, I've prototyped this using an Arduino in place of my actual device and messages flow in both directions. But if ROS 2 is the future perhaps I should run a DDS library on my STM32? And then some kind of DDS to ROS 1 bridge on the Linux side? I've not studied ROS 2 enough but I think it uses a "standard" message passing protocol and I should use that, especially if my RTOS supports it. Just looking for general advice at this time. Possibly I've not thought of some good options. My use case is building "smart" controllers that play with ROS well. For example, a base controller that connects with USB to a ROS/Linux system and subscribes to cmd_vel and publishes TF and odometry. Literally a "plug and play" ROS node.
Viewing all 314 articles
Browse latest View live


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