- Forum
- Roboteq Motor Controllers
- Controller Configuration & Operation
- Communication between SDC2160 Controller's script and an SBC using Roboteq API
Communication between SDC2160 Controller's script and an SBC using Roboteq API
- avinash_sprw
- Topic Author
- Offline
Less
More
- Posts: 15
- Thank you received: 0
4 years 9 months ago #29533809
by avinash_sprw
Communication between SDC2160 Controller's script and an SBC using Roboteq API was created by avinash_sprw
I'm using SDC2160 motor controller and a Raspberry Pi. I have connected them via UART(using TX, RX pins) and able to communicate with the controller using the Roboteq API. I have written a script in the motor controller to guide my AGV on a magnetic tape based path using the magnetic guide sensor. It works fine and moves along the path. At certain times, I want to make my AGV stop based on RFID detection or any other factor that will be decided by the SBC (Raspberry Pi). I'm trying to use one of the user variables to communicate a value (0 or 1) from the C++ script in the SBC to the microbasic script in the controller. However, when I use the setCommand function in the API to set the user variable, I'm getting the error code 16 most of the time and because of that the microbasic script does not get the updated value which is being read continuously. Whenever the microbasic script is being run, I am unable to use the setCommand in the API most of the time. When the microbasic script is made to stop, then I can successfully set the values using the API. How do I make this work properly?
Please Log in or Create an account to join the conversation.
- Gabriel_Isko
4 years 9 months ago - 4 years 9 months ago #29533812
by Gabriel_Isko
Replied by Gabriel_Isko on topic Communication between SDC2160 Controller's script and an SBC using Roboteq API
Are you providing any wait time in your script's control loop?
Please Log in or Create an account to join the conversation.
- avinash_sprw
- Topic Author
- Offline
Less
More
- Posts: 15
- Thank you received: 0
4 years 9 months ago - 4 years 9 months ago #29533818
by avinash_sprw
Replied by avinash_sprw on topic Communication between SDC2160 Controller's script and an SBC using Roboteq API
Yes, I have provided a wait time of 10ms in the loop. I now tried increasing the time 50ms such that it won't affect the line tracing, now I get around 98% success rate in sending the command, Is adjusting the wait time the only way to communicate among them properly, or is there anything else?
Please Log in or Create an account to join the conversation.
- Gabriel_Isko
4 years 9 months ago #29533821
by Gabriel_Isko
Replied by Gabriel_Isko on topic Communication between SDC2160 Controller's script and an SBC using Roboteq API
The main thing is to reduce the amount of data that you are printing over serial. High volumes of data really tie up the UART. You should consider only debugging data if requested by the C++ program, and use one of the user variable bits as a flag to request data.
If you post your script I can make recommendations.
If you post your script I can make recommendations.
Please Log in or Create an account to join the conversation.
- Gabriel_Isko
4 years 9 months ago #29533822
by Gabriel_Isko
Replied by Gabriel_Isko on topic Communication between SDC2160 Controller's script and an SBC using Roboteq API
The main thing is to reduce the amount of data that you are printing over serial. High volumes of data really tie up the UART. You should consider only debugging data if requested by the C++ program, and use one of the user variable bits as a flag to request data.
If you post your script I can make recommendations.
If you post your script I can make recommendations.
Please Log in or Create an account to join the conversation.
Moderators: tonysantoni
- Forum
- Roboteq Motor Controllers
- Controller Configuration & Operation
- Communication between SDC2160 Controller's script and an SBC using Roboteq API
Time to create page: 0.069 seconds