View unanswered posts | View active topics It is currently Wed Dec 11, 2019 8:43 pm






Reply to topic  [ 4 posts ] 
Try... except. 
Author Message
Rookie

Joined: Sat Jun 13, 2015 2:15 am
Posts: 2
Post Try... except.
Code:
Try:
    # Do something
Except:
   print "Error doing something"


This is how it works in python. Most other languages have some variation of this. What is this variation for RobotC, I've heard normal C doesn't have it but has this work around. It doesn't seem to work in RobotC.


Last edited by greenorange on Sun Jun 14, 2015 12:48 am, edited 1 time in total.



Sat Jun 13, 2015 2:34 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Try... except.
There is no support for user based exceptions, sorry.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat Jun 13, 2015 4:44 am
Profile WWW
Rookie

Joined: Sat Jun 13, 2015 2:15 am
Posts: 2
Post Re: Try... except.
Thanks for the response.
Do you know what this error is?
Code:
PgmCnt: 0001A2
Type: 91


I'm guessing it's a maths error, I'm trying to triangulate an IR signal but the IR sensors don't seem very reliable. It may also be something to do with my internal positioning system.

UPDATE:

It's a divide by 0 error coursed by this line of code:
Code:
int sidea = (botdist*sin(angleB))/(sin(angleA));

I made an if statement, only do above if angleA != 0


Sun Jun 14, 2015 12:46 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Try... except.
If you have the debugger attached, it should tell you the exception type.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Jun 14, 2015 1:20 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.