- May 27, 2019 at 9:14 am #7041
I have a new question… I would command my TP-600-165 avoiding the joysitck and using my own “software”… I would like to implement an interface (e.g. in python) for commanding my robot… I was thinking to start from WifiATR… I mean using the way of WifiATR for sending commands to the robot… Has anyone idea where and how the WifiATR creates the packet containg the commands received from the joystick? in other words…I would like to know how WifiATR “translate” the commands received from the joystick and send it to the robot through wifi…
Thanks a lot in advance.
Francesco.May 28, 2019 at 9:28 am #7042
I assume that you have the WifiATR source code since we include that with all of our WifiATR robots. The code was built in Visual Studio 2013 so you should have the smoothest experience working with it in that environment, but it may work in newer versions as well.
Joystick values are read in the function InputTimer_Tick() and the command packet is built and sent to the robot in the networkTransmit() function. While the WifiATR program is running and connected to the robot, you can click Tools->Show Debug Window to display the bytes that are being sent to and received from the robot in real time.May 30, 2019 at 11:59 am #7049
Thanks a lot for your reply… I’m able to communicate with the robots using a simple tcp client implemented in python… sending the bytes showed in the wifiATR Debug Window when the “Data COM” option is checked, i can see the lights blinking and I obtain a reply from the robot (in the TCP client)… but when i try to send the bytes for moving forward (i.e., [FE][7F][7E][FA]) nothing happens… I’m thinking that is because i have to enable the driving as is done in the wifiATR when the “drive enable” button is checked… how i can do that? If i look the wifi atr debug window when the “enable drive” action is checked i can’t see any changes in the transmitted bytes… Any ideas?
Thanks a lot.
FrancescoMay 30, 2019 at 4:39 pm #7051
The Enable Drive is only used by the WifiATR program and just allows/blocks whether it sets the drive and turn values in the packet.
If you have an older version of the code, there was a previous bug that caused an incorrect checksum value (last 2 bytes) to be shown in the Debug Window. Are the robot’s lights still blinking when you are sending a move forward command?
The checksum is calculated as the sum of all the non-header bytes (bytes 4-11), so it should be 0xFE + 0x7F + 0x80 + 0x7E = 0x027B
Try making this change in your code to calculate the checksum based on the other bytes in the packet.
Also try sending the packet again with what I think is the correct checksum: [FE][7F][7E][7B]June 3, 2019 at 10:52 am #7052
Thanks a lot for your reply… you were right…the checksum was wrong… I calculated again the checksum and now it ‘is working… a couple of other questions… the first one is: “What the markable options in the bottom of the wifi ATR GUI (i.e. N/A, Relay 1, Relay 2, Relay 3, Relay 4) are for?
The seond one is… how i can use the sensor? i mean how I can tell to the robot to stop accordingly to the sensor value? If I am not wrong the arduino code already enables the sensor… which is the values transmitted by the rover if an obstacle is present?June 3, 2019 at 3:51 pm #7053
The checkboxes at the bottom are digital (high/low or true/false) inputs and outputs. The top row of checkboxes are inputs (values coming back from the robot) and outputs (values going to the robot). The inputs will be checked when the robot sets the values high in the return packet, and you can set the output values in the Tx packet by checking the output boxes. There are also Analog inputs, and you can have up to 3 coming back from the robot. You could store sensor values or battery voltage readings in the Analog bytes for example.
(Edit: You can change the display name of these checkboxes through Tools->Change Settings on the Inputs/Outputs tab)
I’m not sure what robot you are using or if it was programmed to interface with any sensors — what is your order number?June 4, 2019 at 4:00 am #7056
Thanks a lot for your reply!!
My order number is 54229… btw I’m working with a “Programmable WiFi Mobile 4WD Robot Development Platform – IG32 DM” (TP-600-165) equipped with a MaxSonar EZ1 Ultrasonic Range Finder…
Thanks a lot.
Francesco.June 4, 2019 at 9:09 am #7057
I’m looking at the Arduino code now. It is set up to the read the ultrasonic sensor values and report the raw values on the Analog2 byte of the return packet. The sensor should be connected to digital pin 8 on the Arduino. Try moving your hand in front of the sensor and see if the Analog2 value changes. There is no obstacle detection or stopping configured on the robot; it only reads and reports the sensor value. You will have to stop the robot yourself by determining if an obstacle is present from the sensor readings.
Do you have the Arduino source code? If you need it, send an email to email@example.com and we will get it to you.
You must be logged in to reply to this topic.