How Can i calculate Neo Max velocity

Hello i am Programmer of team 7536. This year we will use Neo motors but i dont know calculate Neo Max velocity And MaxAccelaration? So do you help me(Sorry For my bad english)

The Max Velocity of the motor is 5676 RPM although you can lower this to limit the speed. The acceleration should really be dependent on what you are doing. What are you using the NEO for?

The elevator And angle subsystem

Can you provide your code and/or images of the subsystem?

angleEncoder.setPosition(Constants.angleStartPos);
angleMaster.restoreFactoryDefaults();
angleMaster.setIdleMode(IdleMode.kCoast);
anglePID.setP(Constants.angleP);
anglePID.setD(Constants.angleD);
anglePID.setOutputRange(-0.7, 0.7);
anglePID.setSmartMotionMaxVelocity(null, 0);
anglePID.setSmartMotionMaxAccel(null, 0);
anglePID.setSmartMotionAllowedClosedLoopError(1, 0);
This code is angle motor code

However, the velocity of the elevator we used last year was defined as 200000. How is this possible (someone else wrote the code last year)

Tamam, açılı motorun kurulum koduna sahipsiniz. Burada birkaç şey var.

  1. SmartMotion’ı kullanmayın. Bu bir hız kontrol cihazıdır ve iyi değildir. Bunun gibi bir şeyi takip edin: https://github.com/REVrobotics/SPARK-MAX-Examples/blob/master/Java/Position%20Closed%20Loop%20Control/src/main/java/frc/robot/Robot.java
  2. Bu bir konum motoru ise, muhtemelen Boşta Modunun frenli olmasını isteyeceksiniz.

İki motorunuz mu yoksa bir motorunuz mu olduğu belli değil. Açı ve asansörün aynı motor olup olmadığını açıklayabilir misiniz?

200000’e cevap vermek için geçen yıla ait kodunuzu görmem ve fiziksel cihazın kendisiyle ilgili bazı bilgilere ihtiyacım olacak. Bu yıl asansörünüz veya açı sisteminiz hakkında bilgi vermeniz de yardımcı olacaktır.

Okay, you have the setup code for the angle motor. There are a few things here.

  1. Do not use SmartMotion. This is a velocity controller and is not good. Follow something like this: SPARK-MAX-Examples/Java/Position Closed Loop Control/src/main/java/frc/robot/Robot.java at master · REVrobotics/SPARK-MAX-Examples · GitHub
  2. You will likely want the IdleMode to be brake if this is a position motor.

It is unclear if you have two motors or one motor. Can you clarify if angle and elevator are the same motor?

To answer about the 200000, I will need to see your code from last year and have some context as to the physical device itself. That would also help if you can provide information on you elevator or angle system this year.

2 Likes

2 motors in angle 1 motor is elevator and its not some motor and we are use copy of this code in last year and angle motor is position
motor

Robotunuzun ne olduğunu ve nasıl çalıştığını bilmiyorum. Alt sistemlerin kodunu kopyalayıp buraya yapıştırabilir misiniz?

200000 sayısıyla ilgili olarak burada birimlerin ne olduğunu belirlememiz gerekiyor.

I do not know what your robot is or how it works. Are you able to copy the code for the subsystems and paste it here?

About the 200000 number, we need to determine what the units here are.

Our 2023 robot code
FRC2023Swerve-main.zip (1.3 MB)
im delete buil class because the maxiumum size 100 mb in chief delphi

Okay, I understand now. getPosition() returns the number of revolutions so to calculate speed and acceleration, determine how fast you want the mechanism to go in revolutions.

Instead of SmartMotion, try implementing this.

Thanks For answer

1 Like

Often, you have to measure max velocity, rather than calculate it. With an arm, this can be hard to do. Some teams use SysId to do this. If you try this way, be sure you have some kind of limits so the arm doesn’t over rotate. Measuring max acceleration can be done the same way, but again, you have to be very careful not to cause damage.

The general idea for max acceleration is to start with the arm at rest, apply maximum power, and measure the acceleration. At some point, the arm should reach max velocity (or the max it can reach in the range of motion it has). This is where things can get risky with an arm – full power can cause damage if the arm goes too far before it is stopped, and the arm might need to have power cut or reversed before it gets to the limit, in order to avoid it crashing into the mechanical stops.

An arm, especially if it is heavy, has to work against the acceleration of gravity. This can complicate things, since max velocity and acceleration can depend on the direction the arm is rotating, and on the angle the arm is relative to the horizon.

These considerations can lead to estimating max velocity and acceleration. If you take this approach, start with small numbers you calculate based on free speed and acceleration, plus the gearing you have. Then, carefully adjust these upwards unti you are happy with the result.

A few more things I noticed:

  1. The internal NEO encoder will reset after power is disconnected. You will want some sort of limit switch/hall effect sensor to set the encoder to a known position.

  2. I am a bit concerned about how there are several components in the superstructure subsystem. You only have 2 commands now so it is not much of an issue, but due to addRequirements() affecting elevator, head and intake, you will not be able to reuse parts of the command that call a single component in other commands as easily. Changing the organization would require restructuring, but I want to save you time.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.