Ethercat communication defect after building c++ program - c++

For my work, I am currently working on a existing system (C++) that communicates with a beckhoff PLC. This PLC reads the current speed of the process and controls a light.
This program needs an update to work with the new thickness measurement. The code for this new measurements works, we tested it on another computer.
The problem is that the communication between the beckhoff and the computer is not working anymore. This problem starts when we rebuild (a part of) the program. To check what went wrong, we used wireshark to check the communication.
In the figure below, you can see the correct communication with the Beckhoff PLC (with Ethercat).
In this figure, you can see the communication after we build the new program.
Of course, we tested a lot of option to elimate this problem but at the moment we cannot think of any other method to get the communication back.
Things we tried:
Compile the old code to see if the communication still works. This doesn't work. Only the originale .exe file works.
Go a few version back to test the communication. This also doesn't work.
We check the hardware configuration and the mac adress of the Beckhoff PLC. This is all correct.
It would be great if someone knows a solution for this problem. Please, don't hesitate to ask question for more information about the problem.

Related

How to iterate through com ports and print to console on Linux & C++?

I feel like this should be rather easy, but it continues to vex me, so here it is. I've been trying to find a simple solution to iterate through the available UART serial ports on linux (I'm running the most recent version of Manjaro Linux) and then printing these to the console. Yet, all of the solutions I've found thus far have been incredibly convoluted or they end up throwing a bunch of errors that I can'at figure out when I test them.
So, I've resorted to coming back here to see if anybody else has any ideas. On Windows, there is a GetPortNames() of Windows' System::IO::Ports, maybe a similar API call would be the most ideal.
Update:
So after receiving an answer and using that information to learn a bit more about interacting with serial ports on linux, I eventually ran across a good way to accomplish this effect of iterating through the available ports. It's not quite as simple as a one-line command, but it works so it's fine with me. I found this method of iteration/sorting through the /sys/class/tty directory as an answer to another question (the author of the code that I used is named Søren Holm), and you can look at that here.
Two simple possibilities:
Serial ports on linux are character device files, you can see them on /dev/ttyS*. Serial ports created by an usb device are in /dev/ttyUSB*. This reduces your problem to a dirent iteration.
There is also a thing named sysfs, it is essentially a runtime, non-persistant, kernel-internal registry which is exported to the user space via a virtual filesystem. Normally it is mounted below /sys. Below /sys/bus/serio/devices you can find the devices.

Native C++ webrtc client on WiFi reduces video quality, but fine on calls from chrome

I have a pet project with webrtc audio-video calls. Currently calls from browser are working exactly as expected.
And I'm trying C++/Qt client based on Native C++ WebRTC (it is just a modified peer_connection_client example with modified signalling).
It works, but I've found an issue: when I make a call from one PC to another, the quality of the video is extremely reducing until bandwidth became around 250-300kbps (or 500kbps total, not sure).
As I told, there is a web version working on same signalling and I tested it out on the same PCs. The result was really surprised for me: no quality reducing and around 2000kbps network load.
Moreover, if I connect PC with cable to my router, the quality is fine and 2000kbps load, as expected.
I suppose that the problem is somewhere around wifi bandwidth estimator or so, but can't realize how can I control it's behavior.
Have someone any ideas how can I improve the quality and make webrtc use 2000kbps not 500kbps?
Thanks in advance,
Br,
Sergey
While going forward, I've found out that I have to call rtc::Thread::ProcessMessages() eventually to prevent being stuck on signalling_threads events.
But after that a new problem occured. It is "UDP send of XXX bytes failed with error 10035" this is described at https://groups.google.com/forum/#!topic/discuss-webrtc/wmYo7AU3evI.

Ideas for programming a robot to be autonomous w/o the use of bluetooth device or computer?

In a freshman level course, I am in a group that must program a robot to be autonomous. As of now, the machine will connect to my laptop and run a code I have created which is sufficient autonomously.
However, we want to find a way to get my code (which is in C) onto some sort of chip or something similar, that way the robot can run without needing a laptop or other device connected to it. The robot NEEDS bluetooth connecting to it, so I figure that I need to program some sort of microchip to connect to an arduino to connect to a bluetooth to connect to the robot. Below is exactly what our robot is going to do, in case you need some more information.
Any ideas? If I have to re-code in a different language, that should not be a problem. Money is not an issue, our Engineering department is paying for it. Any help is appreciated!
WHAT IT DOES:
Our robot will autonomously sweep through rooms, doing a job we deem necessary, which will not be disclosed because it is a competition for our class and my classmates know I am posting here. The robot only can be connected to via bluetooth, which makes it a little more challenging to find a way to NOT use a laptop / phone / other device. We want you to be able to "take it out of the package, press a button, and go".
Thank you so much for any help!
I would give Raspberry PI a try, you can run Linux on it, connect keyboard, HDMI screen. You may could use your existing C code. Examples
A more simple hardware is based on arduino but in that case you need to rewrite your code and probably also more hardware work, here some examples
You can connect on both hardware a bluetooth or wifi interface or anything else you wish.
If the program is small enough and you have a good interface, a Lego Mindstorms NXT might work. This has bluetooth built in, and runs RobotC (which is highly similar to C, and should be easy to translate if needed) quite well. Ultimately, though, it depends on what hardware you have, and how hard it is to connect to the NXT.

Program shuts down silently

There is a multithreaded program that operates simultaneously with a device via COM port based communication and remote (IP) video stream. The program also uses OpenCV library to process the data.
The trouble is that it shuts down without any signals (neither run-time, nor any other errors are caught; log file has no anything useful as well). The most top level application error event handler is set and still there are no any signs of the program crash. It just closes after awhile.
The biggest difficulty is that it works fine on all our PCs for days non-stop. But fails on customers PCs so that testing process is very slow. Customer is in a different country (Asian localization, whilst ours is European), but the program is built with Unicode support.
So far we have got some assumptions about localization issues and antivirus activity... but it gives nothing in result.
The program is written with MinGW 4.4.x C++ and wxWidgets 2.9.3
Any suggestions of the probable origin would be appreciate.
Solved.
The problem was inside OpenCV build 2.3.1, that we use. The function cv::imdecode(...) uses stdio.h`s tempnam() function to generate temporary file during decoding. Under x86 Windows systems this function fails after 32767 new names for temporary file. Under x64 Windows systems it returns some nonsense string, but it still works.
So the solution I came with was to change the way of receiving-decoding images from our device.
Thanks everybody for comments.

RDP protocol for c++

Im looking for code that connects to another computer via remote desktop connection and checks if the connection was successful or not.
I packet logged and found out there was a galaxy worth of packets so i was wondering if there was some easy code out there.
There really isn't anything easy about RDP, that protocol stack is huge and builds on the ITU OSI protocols, which includes a fair amount of ASN.1/BER.
Your best bet is the code that's in FreeRDP.
A bit of terminology: you want a "RDP client library for C++".
As others have mentioned, look into the "FreeRDP" and "rdesktop" projects.
With FreeRDP, you're going to get a suite of libraries (each one doing it's thing). With rdesktop, you're going to get a client app (which you have to break the C code out of, and "build" your C++ api around).
If this is a new project, I'd pick FreeRDP over rdesktop, as they have libraries available with your C++ interface already in place.
Do you need to check if an RDP server is present, but not authenticate? In this case all you'd need are the first couple of packets used to negotiate protocol security. You can find the code in FreeRDP in libfreerdp-core/nego.c.
#Blanker1231 : You should have look on rdesktop code , its in c but can be very easily modified to be used in a C++ code , all you have to do is bridge their Struct Stream effectively .
moreover I have worked on a Rdp 7+ implementation ages ago in qt/c++ for a , so recently just for fun of it i used all of my experience and wrote a RDP parser and code generator and open sourced it on https://github.com/shashanksingh/Code-Generator-for-RDP
Right now it dead simple and i am still working on it more intelligent . Word of caution it doesn't generate everything . Examples includes demo.def which on compilation will generate all the class os ms-fscc used in ms-rdp
#Blanker1231 if you ever feel like , just fork the implementation and start pushing stuff in