ROBOTC.net forums
http://robotc.net/forums/

Motors Jerkin'
http://robotc.net/forums/viewtopic.php?f=52&t=3739
Page 1 of 1

Author:  prateeksach [ Wed Nov 16, 2011 4:50 pm ]
Post subject:  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

Author:  grajalese [ Wed Nov 16, 2011 5:06 pm ]
Post subject:  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

Author:  prateeksach [ Wed Nov 16, 2011 6:07 pm ]
Post subject:  Re: Motors Jerkin'

Even if I remove that, it's still the same problem. The motors lag/jerk a lot.

Author:  MHTS [ Wed Nov 16, 2011 6:45 pm ]
Post subject:  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.

Author:  prateeksach [ Wed Nov 16, 2011 11:29 pm ]
Post subject:  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?

Author:  grajalese [ Wed Nov 16, 2011 11:51 pm ]
Post subject:  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...

Author:  prateeksach [ Wed Nov 16, 2011 11:56 pm ]
Post subject:  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?

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/