Skip to content

Suggestions for Arm code #1

@TheThirdOne

Description

@TheThirdOne

I took a look at d5826a9 and have a few concerns and suggestions.

For Potentiometer code which is not currently in use:

Both Line 55 and Line 77 essentially scale a voltage (0-5V) to an arbitrary range. There is no reason to do this in two steps; that needlessly adds complexity and a possibility for bugs. Either setup AnalogPotentiometer with appropriate values or scale on your own an leave AnalogPotentiometer with scale=1 and offset=0 as in Line 54.

Line 78 is either incorrect or the description of RobotMap.MIN_MOTOR_POWER is. A value of u close to 0 does not mean the motor isn't moving, it means it is close to moving negatively at max speed. See line Line 86

About adjust motor:

Line 145 can just be if (direction > 0). Math.signum isn't changing anything.

Is there a reason Line 147 and Line 161 are different?

If not I would suggest putting that if outside the other.

In arm(OI):

Line 217 - Line 225 could be written as:

double h = oi.leftJoystick.getRawButton(3)?0.3:(oi.rightJoystick.getRawButton(3)?-1:0); 

This uses the Java's only ternary operator. Its a significantly more concise way of writing it, but that is a stylistic concern.

General comments:

There is a lot of commenting out. When changes are drastic enough that you need to comment that much, it makes sense to utilize git as a backup so you can delete with confidence. This can be done using a new branch or just with commits if you feel confident enough in your git skills.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions