[PROS] Sending/receiving messages via the joystick partner port

This post by Jabibi opens up a lot of possibilities for VEX U teams.

I was wondering if anyone has been able to implement robot to joystick communication via the partner port and would be willing to share any suggestions or technical documentation with a VEX U team that is just getting started.

Additionally if there is any information on how messages are sent from the joystick to the robot would save us a lot of time attempting to reverse engineering the output from the ports using an o-scope.

Has anyone managed to build a partner joystick emulator API for the raspberry pi?

I haven’t been able to find any other form posts on this topic and it doesn’t seem like its documented in the PROS guides either. Any information would be helpful!

Thanks!

You may want to review these threads.

Partner joystick communications protocol

Interfacing a PS3 controller to the joystick partner port

Interfacing a multi-axis controller to the joystick partner port

The partner port can receive control information, it has no useful status replies from the robot. If you want bi-directional communications then use the programming port ( but not with VEXnet 2.0 :frowning: )

Ah! I guess that it would be much easier to use the programing port.
I think I just misread Jabibi’s post and though he was talking about using the partner joystick port for input/output.
So using the programing port would simplify things considerably by allowing us to get the data much easier…
I guess I should really be asking is if there is any documentation on how to get data from the programing port that can be used by 3rd party applications or programers preferably in a unix environment.

In the PROS code you write to standard output to send data to the programming port, same for input, use standard in.

I created some code that implemented one of my pet protocols here.

https://vexforum.com/t/communicating-between-two-cortex-dual-cortex-robot/24236/1

That code is on github and is open source.

There are some problems with high data rate communications, you can read about some of that in the ConVEX thread, I had to do some tricky throttling of data going to the programming port to avoid data loss.

Read post #110 and a few earlier ones.
https://vexforum.com/showpost.php?p=342675&postcount=110

I’ve used the nrjavaserial library in Ubuntu Linux successfully. Here’s part of a proof of concept I wrote a while ago, you should be able to put something together based on it. This won’t work out of the box; read some stuff and see if you can figure it out on your own. It’s a good learning opportunity.

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

public class Main
{

	private static DataOutputStream outs = null;

	public static void main(String args]) throws IOException
	{
		// sudo interceptty -s 'ispeed 115200 ospeed 115200' /dev/ttyACM0 /dev/test
		NRSerialPort2 serial = new NRSerialPort2("/dev/ttyACM0", 115200);

		serial.connect();

		final DataInputStream ins = new DataInputStream(serial.getInputStream());

		outs = new DataOutputStream(serial.getOutputStream());

		final Gui g = new Gui();
		g.setVisible(true);

		new Thread()
		{
			public void run()
			{
				byte] buffer = new byte[1024];
				int len = -1;
				try
				{
					while ((len = ins.read(buffer)) > -1)
					{
						String s = new String(buffer, 0, len);

						if (s.length() > 0)
						{
//							g.getjTextArea1().append(s);
							System.out.print(s);
							g.getjTextArea1().setCaretPosition(g.getjTextArea1().getText().length());
						}
					}
				} catch (IOException e)
				{
					e.printStackTrace();
				}
			}
		}.start();

	}

	public static void write(String s)
	{
		try
		{
			outs.writeUTF(s + "\r");
		} catch (IOException e)
		{
			e.printStackTrace();
		}
	}
}