-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛[BUG] - Pros::Link Issues #620
Comments
Also would like to add the error values and the code snipet; Code: char* result;
char* expected = "Hello!";
data = test_trans.receive((void*)result, sizeof(*expected) * sizeof(expected));
receiveErrorVal = errno;
lcd::print(6, "Data: %d", data);
lcd::print(7, "Error: %d", receiveErrorVal); Output:
|
The link docs need some changes in the meantime here's an example of receiving data currently
This should work don't have access to testing right now so let me know if there are any problems size_t: https://pvs-studio.com/en/blog/terms/0044/ Fixed typo. |
This should already be possible. Both receivers and transmitters can receive and transmit data. For example you can have a program where a transmitter transmits a value to a receiver where the value is modified and sent back to the transmitter to be displayed. pros::Link transmitter(1, "RobotID", pros::E_LINK_TRANSMITTER, true);
transmitter.transmit(&data, size);
transmitter.receive(&modData, size);
// Display modified data And pros::Link receiver(1, "RobotID", pros::E_LINK_RECIEVER, true);
receiver.receive(&data, size);
// Mod data
receiver.transmit(&modData, size); |
Did some testing and we're looking into this hoping to roll out a fix soon along with a docs update. This method is a temporary solution if you're having problems with dual radios. |
Thank you so much for the response! Good to hear that most of the problems were just outdated docs and nothing major code-wise. Ill keep you posted on anything else that I find. |
Good news, I found the problem with dual radios. When dealing with radios, the brain prioritizes the radio on a higher # port to be the controller radio and disables the other radios that are connected. When I initially posted this issue, I had it so the link radio was on a port number that was lower than the designated controller radio (ex. link lets say is port 5, and the radio is port 21). Since the link radio is disabled (by the flashing red light at the cable connection) the brain doesn't realize the radio existed at the initialization of the link, thus the problem. The solution is to have the link radio on a higher port number than the controller radio (ex. link on 21 and radio on 5). This works since parameter Edit: I would also like to add the fact that when I call the link constructor inside a constructor for a class that I created, the brain black screens and nothing initializes. All ports flash red and there is no response from the program. LinkHelper::LinkHelper()
{
// This doesn't work. Not even the lcd initializes
pros::Link linkTransmit(15, "link_key", E_LINK_TRANSMITTER, true);
}; |
Describe the bug
When experimenting with the vexLink system in pros, I came across two issues:
ov
parameter is set to true, the brain black screens and nothing works at all. However, when I start with one radio connected to the brain (ov
set to true), it initializes correctly and links with the other radio (with the red-green flashing), and then I connect the other radio back which connects to the controller without any problem.transmit
andtransmit_raw
functions and the respective receive functions to no avail. I even used the exact layout from the pros documentation (except the constructor which is incorrect on the docs) to get data to be sent but it doesn't work.To Reproduce
For the first issue:
The way I got it to work:
ov
parameter set to trueExpected behavior
Two radios connected to the robot, one designated as a pros::Link radio should initialize at program start, connect and send data to the other brain.
Desktop (please complete the following information):
Addon Feature
I do not know if this is possible, but is there a way to switch the initializations of the pros::Link devices? The link at the moment only allows sending data in one direction, but in reality it would be better to be able to send in both by switching the job of transmitter and receiver.
The text was updated successfully, but these errors were encountered: