I don’t really know what part you are confused about. But basically, that is an array called “nMotorEncoderOffsets” with a length of 10, in which all values are currently zero, but you can input variables defined as long.
What harrio34 said is correct.
nMotorEncoderOffsets is an array of type long that is initialized to 0.
a long is a 32 bit number on most systems. An int can be 16 or 32 bit (or whatever the native size on a particular platform is). In ROBOTC V3.xx an int was only 16 bit so I used longs.
EncoderSetValue and EncoderGetValue are used in place of nMotorEncoder, if the encoder is abruptly set back to zero the velocity calculation be be (momentarily) incorrect.
ok, I just wasn’t sure what the array was, I haven’t come across one until now.
something else that confused me. I thought return was to make a function call itself, what is doing here?
return causes the function to finish, code resumes from the point the function was called.
As your teams programmer I am sure you must understand what functions do and how they return values but just in case I am wrong here is the robotC page on functions.
I’m going to try to learn and encourage my team to use the Smart Motor Library this year, is v1.06 still the most updated version? I don’t want to start off using the wrong thing!
Yes, still the latest. I may do a shooter specific version as it may not be suitable for that application.
Thanks James.
Will you implement backpowering? for example if you have two motors on a gear system
both are connected to different circuits, if one motor’s power is reduced so that the other motor starts backpowering the circuit it is on, what will happen
I have no plans for any changes to the library. I may create a special flywheel shooter specific version on the core algorithm that understands a little more about that use case.
Thanks! The files got configured properly.
Just one more question-- upon opening the SmartMotorLib.c file, is it normal for there to be the error “no main task”?
Yes, anytime you open a file in ROBOTC it tries to compile it. As SmartMotorLib.c is intended to be included by another program it does not include a main task. You may also see bunch of warnings, ROBOTC changed the name of some system functions between V3.XX and V4.XX (for example StartTask became startTask ). Which version of ROBOTC are you using?
So I install the library successfully, everything works such fine when is connected to a computer . I am able to control the robot with vex joystick. However when I power cycle to use the robot with a vex joystick without a pc it does not respond to anything. please can anyone give me a hand.
Probably not an issue with the smart motor library, are you downloading with VEXnet enabled? (ie. not USB only mode under robot menu) Does a simple program that does not use the smart motor library work?
Communication mode is set to competion(VEXnet) and yes simple programs without the smart motor library do work.
Start a private conversation and send me the code.
I’m new to VEX Forums, how do I start a private chat here?
Let me start one for you.
I’m new to vex with a first year team. I been researching solutions to some of the issues they experienced at their first competition. The biggest was motor stalls/overheat. This project is very exciting but as a young team 6-8th grade there are starting with easyC. Does this code assume temp by monitoring velocity and command power? In the simplest answer at lease. I thought maybe test some simple conditional statements to limit power. Has others done simple ptc software limits in easyC?
This library was the result of lots of work done by myself and @vamfun during the summer of 2012. Here is a link to a thread with lots more information.
Basic idea is
Measure velocity of motor
Estimate current for motor based on command value and measured velocity.
Estimate PTC temperature using using the current estimate and time.
I initially implemented in ROBOTC and later ported to ConVEX. For various reasons an EasyC implementation did (and will) not happen (unless someone else tries I guess).
The code works well for some things, mostly drive systems where the robot can get into a pushing match. It does not work well for things like flywheels and to some extent arm/lift systems. Actually, it is ok for monitoring flywheels, I do that, but turn off the automatic limit features.