DIY AutoSteer with AgOpenGPS - Page 127 - The Combine Forum
 1214Likes
 
LinkBack Thread Tools
post #1261 of 2024 (permalink) Old 09-19-2018, 07:36 PM
Member
 
Join Date: Mar 2018
Location: Rock Valley, Iowa
Posts: 86
Mentioned: 1 Post(s)
Quoted: 35 Post(s)
Quote:
Originally Posted by BrianTee View Post
Tough day for AutoBeer, time to eat crow. The fixed distance concept is the worst thing ever. But! what i did discover going at certain speeds and tuning for smoothest response is the distance for lookahead is surprisingly linear - and that is around 75% of the speed. IE, if i was going 10 kmh, the lookahead distance worked well at 7.5 meters. If I went 6, around 4.5 meters worked well. At 3, 2 and a bit. But below that there needed to be a mimum distance or it would just oscillate. So not a complete waste of time. Making the distance slightly smaller and smaller at a fixed speed didn't make it follow the line any better, it just gets more and more wild crossing the line (oscillation).

Dairytech. Quick question, did it work with the ENC28J60 ? Or did you go straight to the Wiz?

If you set a breakpoint at line 119 of udpComm.cs "if (data.Length != 10) return;"
and mouse over the "data.", what shows up?

You can also connect a usb and monitor what is being sent, but you have to write a simple 10 byte lprint loop.

Just ran AgraBot today for a film crew - It worked all day without a single miss, Lidar, machine control, autosteer, everything on ethernet.
Not that I wish ill to anyone but it makes me feel a little better about my problems to know that you have your hard days with code and algorithms too :P

I went straight to the Wiz. To be honest, until I started this project I wasn't aware there was a difference. Did you select the ENC for any particular reason? It seems to me the coding is a little simpler for the WIZ. When I get my modifications working I am considering updating the module to support either chip by just setting a #define.

I set the breakpoint and got a 3 instead of 10. The three characters listed match what I see in Wireshark. When I reconfigure to send using Packet Sender I get 10 characters and the display in AOG shows the related values. For some reason it seems that my Arduino code is only getting the first three characters out the ethernet port even though my debug message to the Serial port suggest otherwise. I think it may be time to create an absolutely bare bones Arduino sketch that only sends a UDP message...similar to what Packet Sender does.


Thanks Brian, that is just what I needed to start making progress again. I haven't solved the problem yet but I know now where the problem is and I have an idea about how to get to the bottom of it. I have done soooo much serial port programming and could never get over the initial learning curve to do Ethernet. This project has me almost over this hump.

BrianTee likes this.
dairytech is offline  
Sponsored Links
Advertisement
 
post #1262 of 2024 (permalink) Old 09-19-2018, 08:19 PM Thread Starter
Senior Member
 
Join Date: Aug 2012
Location: Vermilion Alberta Canada
Posts: 5,734
Mentioned: 19 Post(s)
Quoted: 2498 Post(s)
Quote:
Originally Posted by Andreas Ortner View Post
What do you mean with a real pid?

I am currently using the pololu contoller on i2c bus of arduino.
It has a pid controller integrated and was direct connected.

Im send only desired steerangle to controller.

Does it work well?

BrianTee is offline  
post #1263 of 2024 (permalink) Old 09-19-2018, 09:35 PM
Senior Member
 
Join Date: May 2011
Location: Manitoba
Posts: 369
Mentioned: 0 Post(s)
Quoted: 97 Post(s)
Quote:
Originally Posted by dairytech View Post
I have done soooo much serial port programming and could never get over the initial learning curve to do Ethernet. This project has me almost over this hump.
I find that in the Arduino world, Ethernet is much like Serial in how data is sent, recieved and parsed. Just opening & closing connections is much different.
dairytech likes this.
m_elias is offline  
Sponsored Links
Advertisement
 
post #1264 of 2024 (permalink) Old 09-19-2018, 09:45 PM
Member
 
Join Date: Jul 2011
Location: Manitoba
Posts: 58
Mentioned: 1 Post(s)
Quoted: 21 Post(s)
Not sure if it helps, but I put up the W5100 sketch I have working right now. Not sure if it's the most efficient way of doing it. The tricky part for me was initializing two ports (Out: 5577; In: 8888). I just re-used the udpSteerRecv callback function that the ENC library used.

https://github.com/AndyBell54/AutoSt...rEth_W5100.ino
WW and dairytech like this.
rewandy5 is offline  
post #1265 of 2024 (permalink) Old 09-19-2018, 10:13 PM
Member
 
Join Date: Mar 2018
Location: Rock Valley, Iowa
Posts: 86
Mentioned: 1 Post(s)
Quoted: 35 Post(s)
I got it!!!

I am much more comfortable with data types in my PLC work than I am in C/C++/C#. Turns out I was under the mistaken impression that I had to use a char array with the udp.write() function when using the Ethernet2 library and EthernetUDP2 class. I missed the variant of udp.write() where you supply a byte array AND the array's length as separate terms. Once I changed that, things started to work. What I suspect was happening is some data values led the write(char) function to believe it was encountering a null (end of string) character in the middle of the array. I did a lot of experimenting to confirm this was all that was wrong. To be safe, I also defined the toSend array with an explicit length as well. My values are showing up in AOG now too. When I short the analog input I am using for the steering angle feedback pot to 5v, 3.3v, and 0v, the number in AOG changes respectively. Now tomorrow I can start testing with my steering motor and sensor.

m_elias: Now that I have it working, it does seem pretty simple. I find that my ignorance of type and syntax is always my biggest challenge when learning a new programing environment. What I love about AOG is the opportunity to learn Ethernet communication from both the microcontroller and the PC side.

rewandy5: In my early code I missed the fact that I was sending on the same port I was listening on and that AOG cares about both the port it is listening on AND the port the module messages are coming from. I created a separate instance for each connection; UDPrecv and UDPsend. Then used the begin function to set the appropriate port for each. I questioned when I did it whether it was necessary. I am going to look through your code to see what you did. Once I have the code for my module working with my sensor and motor and my testing debris removed, I will post mine as well. I am pretty excited at the prospect of helping expand the code base for this project.
BrianTee and WW like this.
dairytech is offline  
post #1266 of 2024 (permalink) Old 09-19-2018, 10:23 PM
Member
 
Join Date: Jul 2011
Location: Manitoba
Posts: 58
Mentioned: 1 Post(s)
Quoted: 21 Post(s)
Quote:
Originally Posted by dairytech View Post
I got it!!!

I am much more comfortable with data types in my PLC work than I am in C/C++/C#. Turns out I was under the mistaken impression that I had to use a char array with the udp.write() function when using the Ethernet2 library and EthernetUDP2 class. I missed the variant of udp.write() where you supply a byte array AND the array's length as separate terms. Once I changed that, things started to work. What I suspect was happening is some data values led the write(char) function to believe it was encountering a null (end of string) character in the middle of the array. I did a lot of experimenting to confirm this was all that was wrong. To be safe, I also defined the toSend array with an explicit length as well. My values are showing up in AOG now too. When I short the analog input I am using for the steering angle feedback pot to 5v, 3.3v, and 0v, the number in AOG changes respectively. Now tomorrow I can start testing with my steering motor and sensor.

m_elias: Now that I have it working, it does seem pretty simple. I find that my ignorance of type and syntax is always my biggest challenge when learning a new programing environment. What I love about AOG is the opportunity to learn Ethernet communication from both the microcontroller and the PC side.

rewandy5: In my early code I missed the fact that I was sending on the same port I was listening on and that AOG cares about both the port it is listening on AND the port the module messages are coming from. I created a separate instance for each connection; UDPrecv and UDPsend. Then used the begin function to set the appropriate port for each. I questioned when I did it whether it was necessary. I am going to look through your code to see what you did. Once I have the code for my module working with my sensor and motor and my testing debris removed, I will post mine as well. I am pretty excited at the prospect of helping expand the code base for this project.
I did the same thing. It seemed like it was the way to do it from the research I was doing. Funny I much prefer the EtherCard library and the way its structured the functions. Might just be because I'm used to libraries built like that.
dairytech likes this.
rewandy5 is offline  
post #1267 of 2024 (permalink) Old 09-19-2018, 10:51 PM
Junior Member
 
Join Date: Sep 2018
Location: Northern Rivers of New South Wales AUSTRALIA
Posts: 14
Mentioned: 0 Post(s)
Quoted: 6 Post(s)
IUM Sensor

Hello Brian,
I am a Sugar Cane Farmer in Northern New South Wales, Australia.
Few a few weeks now I have been looking at and reading about AgOpen GPS. It is a very exciting development and I am keen to develop an Auto Steer system on the tractors.
I am wondering if it is possible to run with a UM7 Orientation Sensor or a Bosch Sensortec BNO055 Intelligent 9-Axis Absolute Orientation Sensor to provide Heading, Pitch / Roll.
I would then need to use an Arduino Mega2560.
The question is, how to configure the sensor outputs through the Arduino Mega to AgOpen GPS so AgOpen GPS can then control the Auto Steering?
I have attached a very basic (e.g not all wiring connections shown) schematic of the hardware I have envisaged from reading the wiki.
I would be very grateful to hear your thoughts on this.
Regards
Steve Price
Attached Files
File Type: doc GPS Auto steer Schematic.doc (30.0 KB, 56 views)
Steve Price is offline  
post #1268 of 2024 (permalink) Old 09-20-2018, 01:09 AM
Junior Member
 
Join Date: Feb 2018
Posts: 29
Mentioned: 0 Post(s)
Quoted: 17 Post(s)
Quote:
Originally Posted by BrianTee View Post
Do you get the feeling that using only pure pursuit will only ever be just ok, and that once close to the line it needs a real PID? Especially when going faster?

That interesting
But how can this look like
What is the desired value for the PID in this case ?
AlexS is offline  
post #1269 of 2024 (permalink) Old 09-20-2018, 10:33 AM
Senior Member
 
Join Date: Jun 2018
Location: Denmark
Posts: 107
Mentioned: 5 Post(s)
Quoted: 58 Post(s)
Quote:
Originally Posted by Steve Price View Post
Hello Brian,
I am a Sugar Cane Farmer in Northern New South Wales, Australia.
Few a few weeks now I have been looking at and reading about AgOpen GPS. It is a very exciting development and I am keen to develop an Auto Steer system on the tractors.
I am wondering if it is possible to run with a UM7 Orientation Sensor or a Bosch Sensortec BNO055 Intelligent 9-Axis Absolute Orientation Sensor to provide Heading, Pitch / Roll.
I would then need to use an Arduino Mega2560.
The question is, how to configure the sensor outputs through the Arduino Mega to AgOpen GPS so AgOpen GPS can then control the Auto Steering?
I have attached a very basic (e.g not all wiring connections shown) schematic of the hardware I have envisaged from reading the wiki.
I would be very grateful to hear your thoughts on this.
Regards
Steve Price
I am working on a similar project, but not as far as you. To minimize noise from magnetic fields around wires drawing many Amps, I would prefer to place the motor driver close to the hydraulic valve and with its own 12 v supply from battery. Then only low current 5V wires goes from arduino to motor driver.
Steve Price likes this.
LarsVest is offline  
post #1270 of 2024 (permalink) Old 09-20-2018, 05:09 PM Thread Starter
Senior Member
 
Join Date: Aug 2012
Location: Vermilion Alberta Canada
Posts: 5,734
Mentioned: 19 Post(s)
Quoted: 2498 Post(s)
Lars, Steve, the Wiki is invaluable with all the schematics and ideas that have been tested and tried - and importantly the ones that don't such as the UM7 or using the BNO for anything but heading. The Brick v2 is the answer if you want to use heading. Andreas has done an incredible job of collecting the knowledge in 1 place.



The mega is the same as an uno or a nano just has more extra pins, so all the wiki examples apply. Many people have built the autosteer with the DOGS2, arduino, and motor control board all together and it works just fine. To start out, all you need is the arduino, steer sensor, motor driver board and a steer angle sensor. And even at that it works quite well if you don't have too many hills or very bumpy ground. Definitely don't use the UM7, it drifts really bad.



Dairytech, I for the life of me can't remember why i used 2 sockets, but it had something to do with threading all the networking so send and receive could independently work in their own thread. What you may notice is you can connect and disconnect any module at any time and it just starts working again. That is also the advantage of having separate sockets. Good you got it working and yes, its all bytes all the time


The real bonus for learning ethernet and micro and C# this way - its also a useful project. HAving this in both 5100 and ENC28 is awesome. Anyone know if the 5500 is compatible code wise with the 5100?



I was thinking to day I should make an ethernet Steer AngleSensor just like the Lidar.

dairytech and Steve Price like this.
BrianTee is offline  
Sponsored Links
Advertisement
 
Reply

Quick Reply
Message:
Options

Register Now



In order to be able to post messages on the The Combine Forum forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.

User Name:
Password
Please enter a password for your user account. Note that passwords are case-sensitive.

Password:


Confirm Password:
Email Address
Please enter a valid email address for yourself.

Email Address:
OR

Log-in










Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page



Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

 
For the best viewing experience please update your browser to Google Chrome