rc arlo

2

Comments

  • how can i incorporate that into my current project is there anyone out there that could work on my blocky its so difficult lol. im going to keep trying while i have the day off.
  • reinaldoreinaldo Posts: 49
    edited 2020-01-24 - 17:42:46
    no matter what i do i can't incorparate the rc script with my script into arlo it ends up being that the rc script runs first then i can't use the rc script after my script runs.
  • Maybe they aren’t in the same loop.
  • Duane DegnDuane Degn Posts: 10,298
    edited 2020-01-26 - 22:19:14
    How are your Ping sensors oriented on the robot?
    Which Ping pin corresponds to these orientations?

    I think you'll want to start at least two other cogs. In one of these cogs, constantly update the values of "Aileron" and "Throttle". In the other cog constantly update four variables used for Ping distances.

    In your main loop initially calculate a target speed based on the "Aileron" and "Throttle" values. After obtaining a target speed, check the Ping variables (which have been updating continuously) and modify the target speed based on the Ping variable values.
    Only after all input values (RC and Ping) have been used to modify the target speed then send the motor speeds.

    Since you're using Arlo hardware, you should let the "Robot drive speed" control the speed of the motors. You don't want to also use "Pulse-Out."

    Whenever I've added RC to a robot, I use elevator and aileron to steer the robot. I'd suggest using the elevator channel rather than throttle.

    Edit: This code won't work as expected. I'll clarify once I have a chance to test the code.
    PUB ComputeSpeedsFromJoystickRx
      wheelSpeed[_PortWheel] := (channel[_Y] - channel[_X]) + _StopServo
      wheelSpeed[_StarboardWheel] := _StopServo - (channel[_Y] + channel[_X])  
    

    I think this translates to Blocky as seen in the attached image. (I used your variable "Throttle" but in the code above this channel would be from the aileron channel.

    I haven't tested this, but here's where I'd start.
    http://blockly.parallax.com/blockly/projectlink?id=127835&key=fb6d9dd9-1fde-413a-a587-38bf2f769912

    Edit: In the code section above, I failed remember the "channel" array had been modified so center sticks were zero.
    642 x 168 - 20K
  • reinaldoreinaldo Posts: 49
    edited 2020-01-27 - 00:40:24
    ping pin 14 in front... ping pin 16 left... 17 right ping pin.... 15 rear ping pin....
  • I haven't been here for a while, but it's always good to roll back to working code. I assume you still have prior versions, reinaldo?

    Ken Gracey
  • reinaldoreinaldo Posts: 49
    edited 2020-01-27 - 00:15:02
    the pings are not lighting up but the rc works like a charm thanks btw . if you push the throttle top left corner it goes forward bottom right corner goes backwards.
  • Ken Gracey,

    i have been trying out duane degn's code which i get that you have to run a separate function but now i can't get the pings to work i left my link open to the public (#1) being a code combo of yours and mine. and (#2) being a simplified update of yours and mine by duane degn.

    1.

    http://blockly.parallax.com/blockly/editor/blocklyc.jsp?project=127445

    2.

    http://blockly.parallax.com/blockly/projectlink?id=127835&key=fb6d9dd9-1fde-413a-a587-38bf2f769912
  • reinaldoreinaldo Posts: 49
    edited 2020-01-27 - 00:52:31
    run function pingInput is missing in Daune Degn's code i think
  • reinaldoreinaldo Posts: 49
    edited 2020-01-27 - 00:59:17
    i got the pings on now i got to figure out how to avoid obstacles now while thrusting
  • Duane DegnDuane Degn Posts: 10,298
    edited 2020-01-27 - 05:31:45
    reinaldo wrote: »
    i got the pings on now i got to figure out how to avoid obstacles now while thrusting

    I messed up with the earlier code.

    This should be better. (Speed code only. The Ping code will need to be changed.)

    http://blockly.parallax.com/blockly/projectlink?id=127835&key=fb6d9dd9-1fde-413a-a587-38bf2f769912

    You can intuitively drive an Arlo type robot with one joystick. Let X be the aileron input - 1500 and Y be the elevator input - 1500. This makes X and Y zero with a centered stick.
    Assuming Y is positive when the stick is moved forward and X is positive when the stick is moved to the right, then the motor speed can be calculated as:

    leftMotorSpeed = (Y + X) / C
    rightMotorSpeed = (Y - X) / C

    You might need to swap the + and - if X and Y don't behave as assumed above. The value "C" will scale the output to the appropriate range for the "Robot" comand. I don't know what is range is. If speed ranges from -100 to +100 then C should be set to around 5.

    The above lets the robot turn in place when the stick is only moved side to side. I think you'll find it more intuitive than have the controls on two different joysticks.

    I still haven't tested this out myself. I was using different hardware on my robot and need to switch it back to using an Activity Board with HB-25 controllers.
  • reinaldoreinaldo Posts: 49
    edited 2020-01-27 - 22:58:44
    i can't get the pings to correspond with the wheels. its very difficult.
  • im still having trouble writing a code that allows me to run the ping code and the rc code together. im really glad the rc aspect of it works but as far as the pings go i can't get it to work properly with rc.
  • Sorry for not helping sooner.
    I'm a bit out of date with Parallax hardware.
    I just now realized Arlo uses the DHB-10 AND the Activity Board WX.
    I was attempting to use two HB-25 motor controllers. I see these are no longer made.
    Sorry about that. I have a DHB-10 so I'll wire it up and see if I can better test your code.

    Until I get up and running here are some suggestions.
    I suggest you first test if the code works as desired using just the RC input. Use "Save As" to save a copy of your program and delete all Ping statements.

    Once you're satisfied with the RC control, then start adding one Ping at a time. Say you add the Ping sensor on the right side of your robot. What do you want the robot to do when this Ping detects an object? I'd suggest turning away from it by slowing the speed of left wheel. You could either have the left wheel speed limited to a predetermined minimum value or you could scale the left wheel speed based on the right wheel speed and/or the distance detected by the Ping.

    As I mentioned in an earlier reply, I think robots steer more intuitively using the elevator/aileron stick. I use the throttle and rudder channels to control other servos or gadgets.
  • what im trying to do is make the pings do another type of command wether its turn or just stop and go backwards away from an obstacle
  • I haven't added the Ping sensors yet, but I've got my Arlo working with a Propeller Activity Board and a DHB-10 board.

    Here's the code which works with my setup.

    I use the throttle to set the max speed of the robot. I use aileron and elevator to control the robot's direction.

    In order to figure out the pulses corresponding to various inputs, I used this program.

    You might need change the value of some of the constants to get the code to work correctly with your hardware.
    The constants to check are "CENTER_PULSE_1485" which is set to the value of the centered aileron and elevator channels (hopefully these are about the same value).
    The constant "ZERO_THROTTLE_1108" is the throttle value when the throttle is at the lowest position.
    "THROTTLE_RANGE_750" is the difference between the highest throttle setting and the lowest.
    The constant "MAX_RC_MOVEMENT_410" is how far the aileron and elevator inputs can vary from the center position input.

    Scaling the max speed using the throttle channel isn't a very useful feature. I might be better to use the throttle channel for something else.

    I haven't added the Ping sensors yet. I only have two sensors myself but I'll share what I come up with here.

    I worked a lot with some of the earlier Arlo hardware and I wasn't aware Parallax had switched to use the DHB-10 instead of two HB-25 drivers. I have a DHB-10 board so I can experiment with the latest hardware version of the Arlo.

    Once I was able to test code, I could see all the errors in my earlier Blocky attempts.

    Sorry have haven't helped with your Ping question yet but now that I have my hardware switched over, I should have an example to share soon.
  • I think using another processor to monitor all of the pings would work. Your code could be quite simple or a bit more complex depending on how you want things. I could see it detecting something from a distance and as it gets closer the motors ramp down to a stop when it gets too close. Then backing off to a distance that's higher than the set point for stopping. Is this a bot you drive or it drives? That may effect what happens while detecting and correcting in your code and what it does.
  • Incorporating the Pings to the RC code is harder than I thought.

    I'm going to just think of senarios for two Pings for now (since that's how many I have handy).

    Here's what I've thought of so far.

    I figure I'll use two threshold distances. "PING_CAUTION" and "PING_DANGER". These are presently set at 60cm and 10cm but these values will likely change with experimentation. I'll also use "MAX_PING_SPEED" (presently 60) to set an adjusted speed when an obstacle is detected.

    If either sensor detects an object withing the "PING_DANGER" range, the robot will only allow reverse motion.
    If both sensors detect an object withing the "PING_CAUTION" range, the robot will slow to less than "MAX_PING_SPEED". The speed will likely be a function of the distance to the closest obstacle (closer the obstacle the slower the speed).
    If only one sensor detects an object withing the "PING_CAUTION" range, the robot will slow the wheel opposite of the sensor. Hopefully this will allow the robot to turn away from an obstacle.
    Since I don't have a Ping on the rear of my robot, I'm only modifying the speed when the robot is in forward motion.

    Does anyone have other suggestions on what sort of logic to combine the Ping inputs with the RC inputs?
  • graffixgraffix Posts: 388
    edited 2020-01-31 - 15:11:09
    Thats kind of along the lines of what I was thinking. I got the idea from my cnc machine the hard and soft limits operate like that for the limit switches.
  • see heres the thing. i can get the robot to stop using ping but after i can't get it to go using rc.
  • I allow negative speed values to skip the section of code which modifies the motor speed. This should allow the robot to backup. I attached an image showing the logic.

    I'm just about to test my code. I'll share it in case anyone is interested in seeing it but don't expect it to work yet.

    http://blockly.parallax.com/blockly/projectlink?id=128757&key=d7ac6b08-bf4c-486c-bb3e-08bbe34a6471

    I'll update this thread after I test it.
    1642 x 340 - 62K
  • I just tested the code and it works well enough to demonstrate the concept.

    I think rather than using the throttle to set the max speed of the robot, a better use of the channel would be adjust the distance limit where the Ping code is used. Another option would be use the landing gear or other spare channel to turn the Ping portion of the code on or off.

    I'm not sure how much more I'll continue using Blocky with this robot. I find Blocky fun for small programs but when programs start to get large, the weakness of block based code exceeds its benefits. I'll likely switch to Spin for continued development.
  • reinaldoreinaldo Posts: 49
    edited 2020-01-31 - 20:34:54
    does this work with instead of arlo but servo differential drive which is pins 12 and 13 and my rc is on pins 12 13 also on activity board wx
  • I'm not sure I understand your question. Pins 12 and 13 connect with the DHB-10 board. I used different pins for the RC connection.

    I used these instructions to connect the Activity Board with the DHB-10.
    I didn't add a buzzer on P4.
    I used P0 through P2 for the radio input. I powered the radio receiver with 5V from the Activity Board. My radio receiver (Spektrum clone) uses 3.3V logic so I didn't have any resistors between the radio output and the Activity Board's input. If you use a radio with 5V logic, use a 3K to 10K resistor between the radio and the Propeller board on each channel.

    I didn't use any of the three pin headers P14 through P17 since you plan to use these with the Ping sensors.

    You can of course move the radio receiver pins to any unused pins. You'd just change the code shown in attached image as needed.

    As I mentioned in an earlier comment, you might need to change the value of some of the constants based on the output of your radio. I previously linked to some code for checking the radio channels.
    466 x 94 - 14K
  • reinaldoreinaldo Posts: 49
    edited 2020-01-31 - 21:02:18
    oh ok so im using the right stick only on the radio controller interface interface which the receiver only has 2 out pins im using now instead of putting those specific pins on 12 and 13 i put them into pulse-in pin 0 and pulse-in pin 1. why are there 3 pulse-in pin reads just curious i only would use two pulse-in pins probably. thanks btw for helping me with this.
  • I used the throttle to scale the maximum speed.
    It would work with just two channels. I just changed the code and saved it here.

    I haven't tested this version yet. I'll report back once I've made sure it works.
  • Duane DegnDuane Degn Posts: 10,298
    edited 2020-01-31 - 21:27:29
    The two channel version doesn't work correctly yet.
    I'll update when it's fixed.
    Edit: It might just be a wiring error.
  • The code is OK, I just forgot to change the aileron and elevator channel pins.
  • reinaldoreinaldo Posts: 49
    edited 2020-01-31 - 21:39:09
    lol i finally nailed it omg i had the rc pins in the 12 and 13 this whole time omg!!!!! hahahaha sorry you guys but im on it now. Thanks this project is complete for now.
  • im on the two channel code right now working on it little bit
Sign In or Register to comment.