View unanswered posts | View active topics It is currently Sun Dec 28, 2014 11:16 pm






Reply to topic  [ 7 posts ] 
Motors Jerkin' 
Author Message
Rookie

Joined: Wed Nov 16, 2011 4:42 pm
Posts: 4
Post Motors Jerkin'
Hey guys, I am having a tiny problem with a basic tank drive system. its basically two motors connected into one motor1 of controller 1 and the other two dc motors into motor2 of controller 2. There were encoders but I am disregarding them at the moment so I can get rid of the problem. Here's the program I made for a basic tank drive system:

Code:
#pragma config(Hubs,  S1, HTMotor,  none,     none,     none)
#pragma config(Sensor, S1,     ,                    sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     motorsLeft,    tmotorNormal, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,     motorsRight,   tmotorNormal, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c"

task main()
{
  nMotorEncoder[motorsLeft] = 0;
  nMotorEncoder[motorsRight] = 0;

  int threshold = 30;
  int motorSpeed = 50;

  while(true)
  {
    getJoystickSettings(joystick);

    if(abs(joystick.joy1_y1) > threshold)
      motor[motorsLeft] = joystick.joy1_y1;
    else
      motor[motorsLeft] = 0;

  }
}


But every time I run the program, it lags. the motors jerk. This only happens because of the motor[motorsLeft] = 0; line. If i remove that allow the robot to go forever without stopping, it doesnt jerk at all. I have tried various versions of the same thing but the only line that makes it jerk is making the speed 0. A previous programmer suggested adding wait1Msec(1000/30); line in the while loop to let the motors catch up but that decreased the lagging yet still left it there. any suggestions to fix this? btw, i had this program last year as well and it worked perfectly. dont know what has changed this year.

Thanks!
Team 348


Wed Nov 16, 2011 4:50 pm
Profile
Rookie

Joined: Thu Jul 10, 2008 12:30 pm
Posts: 14
Post Re: Motors Jerkin'
The first thing I noticed was that it looks like you have a motor controller and
MUX controller attached to the same port?

Code:
#pragma config(Hubs,  S1, HTMotor,  none,     none,     none)
#pragma config(Sensor, S1,     ,                    sensorI2CMuxController)


However, I don't know if that is causing the problem.

Eric


Wed Nov 16, 2011 5:06 pm
Profile
Rookie

Joined: Wed Nov 16, 2011 4:42 pm
Posts: 4
Post Re: Motors Jerkin'
Even if I remove that, it's still the same problem. The motors lag/jerk a lot.


Wed Nov 16, 2011 6:07 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1377
Post Re: Motors Jerkin'
According to the code, it should not execute the "motor[motorsLeft] = 0" line if you keep pushing the joystick unless your laptop is losing communication with the robot, in which case the RobotC 3.x will send a joystick packet with 0 values. That would trigger that line and caused the jerk. Are you using Bluetooth or WiFi? Try using a USB cable instead (with the robot off the ground so it doesn't run away), I'd bet you won't have the jerk. If that's the case, you may have communication issue.


Wed Nov 16, 2011 6:45 pm
Profile
Rookie

Joined: Wed Nov 16, 2011 4:42 pm
Posts: 4
Post Re: Motors Jerkin'
I have only been using a USB so far. I haven't set up any Bluetooth or Wifi communication modules until I finish all the programming aspects.. any new input?


Wed Nov 16, 2011 11:29 pm
Profile
Rookie

Joined: Thu Jul 10, 2008 12:30 pm
Posts: 14
Post Re: Motors Jerkin'
1. What version of RobotC are you using?
2. Did you replace the motor?
3. Did you replace the motor Controller?
4. Did you replace the motor power cable?
5. Did you replace the NXT cable from the NXT to the motor controller?
6. Re-download the firmware to the NXT.

Also I would change the deadband from 30 down to 10.

Hope the above helps...

_________________
Eric Grajales


Wed Nov 16, 2011 11:51 pm
Profile
Rookie

Joined: Wed Nov 16, 2011 4:42 pm
Posts: 4
Post Re: Motors Jerkin'
I have RobotC 3.03 and I will do all those replacements on Friday and let you know. I'll see what happens. and by deadband, im assuming you mean threshold?


Wed Nov 16, 2011 11:56 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.