Range Finder Issue

The more technical aspects of Spirit, and carry-over discussion from Kickstarter updates.
Nickw58
Posts: 20
Joined: Sun Oct 15, 2017 11:13 am

Range Finder Issue

Postby Nickw58 » Thu Mar 08, 2018 10:19 am

I'm seeing strange behaviour from the Rangefinder it seems to get into a failed state (output value is fixed) and the only way I can clear it is to shut the Rover down load a very simple Arduino sketch that reads PIC_RangefinderEnable(); and prints to Serial Monitor. At this stage the rangefinder works. Once I have the Range Finder working with the Arduino Sketch if I then Upload the Arduino PicControl sketch and the run the Rangefinder.py module the rangefinder works fine.

If I shutdown the rover and connect an HDMI cable to the Rpi on reboot the Rangefinder.py fails if I then Upload my simple Arduino Sketch the Range finder also fails, (output value is fixed)

In this failed state other .py modules run ok, Volts.py and lightsense_ambient both work so it seem this is not an i2c problem.

Once in a failed state even switching of the rover and disconnecting the batt does not fixe the issue. I have to reboot the Rover load my Arduino rangefinder sketch, then load the PicControl Sketch, at this point the Rangefinder.py module works.

Does anyone have any idea what might be going on ?

Copy of my simple Rangefinder sketch below.



Code: Select all

/*

Spirit Rover Robot
Spirit_BaseSketch_Rev01
Version 1.1 10/2017

Significant portions of this code written by
Dustin Soodak for Plum Geek LLC. Some portions
contributed by Kevin King.
Portions from other open source projects where noted.
This code is licensed under:
Creative Commons Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0)
https://creativecommons.org/licenses/by-sa/2.0/
Visit http://www.plumgeek.com for PiSpirit information.
Visit http://www.arduino.cc to learn about the Arduino.

*/

#include "Hardware.h"


void setup(){

  // ************ THE SETUP ITEMS BELOW SHOULD GENERALLY BE USED FOR ALL SPIRIT SKETCHES **************
 
 hardwareBegin();                    //initialize Spirit's Arduino processor to work with his circuitry
 SPI_Reset();                        //resets and turns on the SPI port  playStartChirp();                   //Play startup chirp and blink eyes
 servoCenters();                     //Place all servos back in default position
 
  // ************ THE SETUP ITEMS BELOW CAN BE CUSTOMIZED FOR YOUR SPECIFIC SPIRIT SKETCH **************


  // add your own setup code here

 

 
}



void loop(){
 
 
 PIC_ReadRangefinder();
 

if (rangeFinder <50){

eyesOn(0,0,50);
delay(200);
eyesOff();
playChirp(1000);
delay(300);
offChirp();
delay(200);
   
  }

Serial.println(rangeFinder);
delay(1000);




  // add your own loop code here

} // end of loop() function

Nickw58
Posts: 20
Joined: Sun Oct 15, 2017 11:13 am

Re: Range Finder Issue

Postby Nickw58 » Thu Mar 08, 2018 12:09 pm

After further investigation it would appear that if I connect or disconnect the HDMI cable to the Rpi with any power on the Rover mother board it locks up the Rangefinder. To avoid this I have to disconnect USB and unplug the battery before connecting/disconnecting the HDMI cable.

My head hurts, going for a coffee ;)

headamage
Posts: 29
Joined: Mon Dec 04, 2017 5:27 pm

Re: Range Finder Issue

Postby headamage » Sun Mar 11, 2018 6:34 pm

same problem here except i don't physically connect any cables to the rover apart from USB to flash sketches.


Who is online

Users browsing this forum: No registered users and 0 guests