Switching from Cartesian Coords to PID

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: imaqine, 99jonathan, roger

New User
Posts: 1
Joined: Tue Jun 17, 2014 9:41 am

Switching from Cartesian Coords to PID

Postby fireburn6 » Tue Jun 17, 2014 10:00 am

Hi there!

Im currently working on a project where i have to make a robot move to a location using cartesian coordinates. When it arrives at the coordinate it's standing on a line, that it has to follow using a PID expresssion. For some reason the robot just stands still, when it's supposed to follow the line, and make a weird noise (sort of like radio static).

The code I've been using is:
http://cs.au.dk/~lefevre/LEGO/LEGO%20En ... tCart.java
http://cs.au.dk/~lefevre/LEGO/LEGO%20En ... PIDLF.java
http://cs.au.dk/~lefevre/LEGO/LEGO%20En ... rdCar.java

GuardbotCart's navigation using the cartesian coordinates works fine and GuardBotPIDLF makes the robot follow the line as planned, but when GuardBotPIDLF is instantiated within the GuardbotCart class, the isssue arises. It seems that the to programs are fighting for control of the motors, bur I've no idea how to avoid this.

Hope you guys can help :)

User avatar
leJOS Team Member
Posts: 5609
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Switching from Cartesian Coords to PID

Postby gloomyandy » Tue Jun 17, 2014 6:49 pm

Your line following code is using low level motor control operations (just setting the power levels), you other code is using regulated motor control. When you try and use both they are fighting against each other. You must disable the motor regulation before you try and use the low level control. Take a look at the suspendRegulation method:
http://www.lejos.org/nxt/nxj/api/lejos/ ... egulation()

Return to “NXJ Software”

Who is online

Users browsing this forum: No registered users and 2 guests