The robot IS responding to all the commands. The problem here is that your code does nothing to wait for a response. Your overwriting commands faster than the robot can respond to them. The only reason why the last command appears to work is because you're not overwriting it after it's submitted.
To verify this, add a time delay in the loop of a few seconds. This should be plenty of time for the robot to respond to each command.
Ideally you'd establish a callback or a response handler so that each command wouldn't trigger until the previous command is complete.
The robot IS responding to all the commands. The problem here is that your code does nothing to wait for a response. Your overwriting commands faster than the robot can respond to them. The only reason why the last command appears to work is because you're not overwriting it after it's submitted.
To verify this, add a time delay in the loop of a few seconds. This should be plenty of time for the robot to respond to each command.
Ideally you'd establish a callback or a response handler so that each command wouldn't trigger until the previous command is complete.
it depends on how did you format the data in the text file, I suggest you to try printing "val" instead of pushing it back. if it's printing the same value (last value) every time means (>>) operation may not read your data format. Moreover, data which come thru TXT file would be strings, so you will need to convert it as doubles before assign it to double variable or pushing it back in a double vector.
The operator>> will do the conversion to double as expected. However, should something be wrong with your input, the tests in your loops will simply fail and fall through to the next line. So, you may not actually read the whole vector if there is something wrong with the input file.
But, you are not using the vector. By using the dereferenced iterator *i, you are actually just sending the component doubles one at a time to the function. Without seeing the "robot" functions you are calling it is not clear why you are only seeing the last value, but, if you are able to change their prototype, you probably want to pass the vector<double> instead of the individual doubles. Something like
I think you should set a delay in the for loop after .setvel method to give the robot the chance to change its velocity. Otherwise the .setvel function it self should have a feedback teeling you that the commanded velocity is sent successfuly
The robot IS responding to all the commands. The problem here is that your code does nothing to wait for a response. Your overwriting commands faster than the robot can respond to them. The only reason why the last command appears to work is because you're not overwriting it after it's submitted.
To verify this, add a time delay in the loop of a few seconds. This should be plenty of time for the robot to respond to each command.
Ideally you'd establish a callback or a response handler so that each command wouldn't trigger until the previous command is complete.
• Rodriguez, A., Zhang, H., Klaminder, J., Brodin, T., Andersson, P. L. and Andersson, M. (2018). ToxTrac: a fast and robust software for tracking organisms. Methods in Ecology and Evolution. 9(3):460–464.
• Rodriguez, A., Zhang, H., Klaminder, J., Brodin, T., and Andersson, M. (2017). ToxId: an algorithm to track the identity of multiple animals. Scientific Reports. 7(1):14774.
ToxTrac is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
The efficiency of object-oriented programs has become a point of great interest. One necessary factor for program efficiency is the optimization techniques involved. This paper presents the performance of several variations of a given C++ program and compares them with a version that uses no object-oriented features. Our result indicates that some...
In the five previous chapters, you learned how to code functions that exploited the computational capabilities of AVX and AVX2 using C++ SIMD intrinsic functions. The chapter you are about to read introduces AVX-512 SIMD programming. It begins with a brief overview of AVX-512 and its various instruction set extensions. This is followed by a section...