|
|
|
| Our software is compatible, baby. |
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
General Q's
Can I hook up PWM cables to digital output to a victor?
Is relayx_fwd mean that the value will be 1 (On)? Likewise is relayx_rev make the value if the button on a stick is pushed =-1(Inverted On)? What is the point of digital input? Is there any way to fry the bot using programming? If you want to know what I am doing, I have 2 joysticks. I want the left trigger to make the motor go down, and I want the right trigger to make the motor go up. In the program, I made all digital relays set to output(Default is only #17(which is crazy in my opinion)) and said p1_sw_trigger=relay1_rev and p2_sw_trigger=relay1_fwd(Or something along those lines). I also added in some clever code to make the motor continue what it is doing if the opposite trigger is already down. I haven't hooked up the motor yet, but I am going to hook the pwm cable from Digital I/O 1 to my victor 884. Then go from the victor to the motor. Will my plan work? The robot is shipped, so I can't physically test it for a month. I ask if you can programically fry a bot, because I have been considering doing some pretty crazy stuff in the code. However, it appears that there is a load of build in safeguards to prevent the self-destruction of the robot. That doesn't say anything about the morons who want to 'physically' hook up five 12-volt batteries to a motor. |
|
#2
|
|||
|
|||
|
Re: General Q's
Since a digital output will either return 1 or 0, I don't think it's a good idea to hook it up to a Victor - that'll send the Victor in question into full reverse. If the motor is small enough that you can hook it to a Spike, then your plan might work a bit better.
Also, wouldn't you want to hook the PWM in question to a relay output rather than a digital I/O? That's what it seems that you're doing in the code. (Disclaimer, worn-out programmer who doesn't necessarily know what he's talking about.) |
|
#3
|
||||
|
||||
|
Re: General Q's
A relay is a digital output. Can anyone give me an example of when digital in would be used? Can a victor be used as a substitute for a spike(I don't need variable speeede)? I think that a realy has to give 2 1/2 values: 0, 1, and -1. The negative 1 come in when you want the motor to go reverse. The trigger on ly returns 0 or 1, but when it is processed through relay1_rev, it must somehow be inverted to allow the motor to go backwards. Is a PWM cable legal for digital i/o? Shouldn't it just be called a data cable then?
|
|
#4
|
|||||
|
|||||
|
Re: General Q's
The Digital Ins can be used for any number of things. Most commonly, they are used for two things, limit switches and shaft encoders.
A limit switch is a microswitch attached to some part of the robot such that it closes or opens whenever the part reaches some point in its travel where you want it to stop. for instance, when a telescoping arm reaches maximum extension. Then you watch the value of the digital in and disable the motor in one direction when it changes. Shaft encoders are small opto-electric devices that send n pulses everytime its shaft turns one revolution. This is useful for determining the distance your robot has traveled or its speed. There's tons of other uses out there as well. Also, you can easily use a victor like a spike. Write your program to set the particular PWM to 0, 128, or 255 for reverse, off, and forward, respectively. Edit: also, also, you could use a digital out as a sort of PWM by pulsing it in the program. however, the current PWMs already have all that code taken care of for you, so you might as well use them. Finally, the PWM cable is just a name. It could also be called a servo cable, etc. Most all the I/Os on the robot have +5(?)V, Ground, and Data pins of various sorts. The only thing that changes is the use of the data pin, so it's convenient to make them all standardized to the 3-pin PWM cable connectors. Last edited by Kevin Sevcik : 22-02-2005 at 21:12. |
|
#5
|
||||
|
||||
|
Re: General Q's
In order to be able to use a victor to control my motor, wouldn't I have to recallibrate it so it can go negative and be on a -1->1 scale as compared to 0->255?
If I decide to hook up a spike, I am assuming that it will be hooked up in a similar fashion to the victor. |
|
#6
|
|||||
|
|||||
|
Re: General Q's
as I said, vics can already go in reverse. the mapping is approximately: 0,64,128,192,255 = -100%,-50%,0%,50%,100% this is ignoring a deadband in there.
recalibrating is faaaaar from necessary. you just need to ad the code in the program to set a PWM to 255 when you want full forward, or 0 when you want full reverse. or 128 when you want stop. |
|
#7
|
||||
|
||||
|
Re: General Q's
Quote:
You were talking about digital inputs before, a digital input is just anything tht return 0 or 1 (not -1). I know the relays has three states tht because u can actually have 3 states by having no signal, positive signal and negative signal. However, for you purpose lets think about the joystick button as a digital input since its 1 when its pressed and 0 when its reverse. Your code should be something like this: Code:
If p1_sw_aux1==1
{
pwmX=255;
}
else if p1_sw_aux2==1
{
pwmX=0;
}
else
{
}
|
|
#8
|
||||
|
||||
|
Re: General Q's
Quote:
|
|
#9
|
||||
|
||||
|
Re: General Q's
I am going to be non-secretive(As most teams are) and share my code in the UserRoutines.c . I am going to just hook up a spike instead of a speed controller. I figure hardware editing is quicker than software editing in this case. This snippet comes from the Buttons to Relay mapping part. Enjoy!
/*---------- Buttons to Relays---------------------------------------------- *-------------------------------------------------------------------------- * This default code maps the joystick buttons to specific relay outputs. * Relays 1 and 2 use lim it switches to stop the movement in one direction. * The & used below is the C symbol for AND */ if (p2_sw_trig<>0) /*If the opposites trigger is down. */ { } /*Do nothing.*/ else { relay1_rev = p1_sw_trig & rc_dig_in01; /* REV only if switch1 is not closed. */ } relay1_rev = p1_sw_top & rc_dig_in02; /* REV only if switch2 is not closed. */ if (p1_sw_trig<>0) /*Same as above. */ { } else { relay1_fwd = p2_sw_trig & rc_dig_in03; /* FWD only if switch3 is not closed. */ } relay2_rev = p2_sw_top & rc_dig_in04; /* REV only if switch4 is not closed. */ relay3_fwd = p3_sw_trig; relay3_rev = p3_sw_top; relay4_fwd = p4_sw_trig; relay4_rev = p4_sw_top; relay5_fwd = p1_sw_aux1; relay5_rev = p1_sw_aux2; relay6_fwd = p3_sw_aux1; relay6_rev = p3_sw_aux2; relay7_fwd = p4_sw_aux1; relay7_rev = p4_sw_aux2; relay8_fwd = !rc_dig_in18; /* Power pump only if pressure switch is off. */ relay8_rev = 0; All it does is wire Port 1 joystick trigger to reverse on our arm and port 2 trigger to forward. If a trigger is already down then ingnore the new command. I have very little C experience, so I hope this code is valid. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| General Dynamics? | Mike Rush | General Forum | 1 | 31-01-2003 17:04 |
| General Forum congestion | archiver | 2001 | 7 | 24-06-2002 03:32 |
| general forum threads | archiver | 2001 | 8 | 23-06-2002 22:47 |
| 2 Useful Websites - And general tips and Ideas | Robby O | 3D Animation and Competition | 0 | 13-01-2002 02:03 |