08-14-2015 11:42 PM
Hello Everyone,
I'm working on a senior project in a university and i am having some trouble trying to make a certain command in labview.
I'm using an Ardupilot 2.6.1 based on (Arduino Mega 2560) and attached to it is an XBee Pro for wireless communication with LabView 2014 through LIFA to control brushless motors. Sometimes the XBee gets disconnected and i get an error 5003 or 5002, usually 5003 when wireless communication being disconnected and i want help to know where can i find the XBee system in the LIFA sub.vi?
In other words when the motor is spinning then suddenly i get an error in labview because XBee got disconnected, i want the motor to stop spinning by decreasing the speed gradually unti it stops when the xbee disconnects.
I looked into the LIFA INIT block diagram and i found the case structure of the 5003 error but i still don't understand how i'm gonna make use of this or how this helps when the 'simple error handler' takes care of that or if it will actually execute the command put when XBee disconnects. below is the block diagram of the LIFA INIT sub.vi.
I also thought of this as a speculation that even if i made some adjustment to the error command, it won't work since the connection has been cutoff which makes sense but how to implement the command is what i'm trying to do.
Any help would be appreciated. Thank you.
08-16-2015 05:07 PM
Correct, if you have lost the connection to the Arduino, you can no longer send commands to it so anything you do in LabVIEW would not have any affect on the Arduino.
You would need to implement a watchdog on the Arduino (in the LIFA firmware) to see if there has not been communication in the last X seconds. If there has not been some kind of communication in the last X seconds, you can perform an action.
The question now is, is that possible while using LIFA? Probably but I'm not sure how difficult such a task would be. You would need to implement the watchdog and then implement the functions required to do your safe shutdown procedure.
08-17-2015 05:13 AM
might give it a try, just for calrification, if i'm going to implement my custom code, should i place it in the LIFA Base void loop where it says add custom code or in the Labviewinterface.h since the code will be related to serial communication?
thanks for the comment.
08-17-2015 05:45 PM
Header files (*.h files) don't contain code that executes when the file is executed. It is for defining functions and variables. Only code inside of the loop() function actually runs.