idx
int64
0
63k
question
stringlengths
61
4.03k
target
stringlengths
6
1.23k
41,000
def configure_containers ( self , current_options ) : containers = [ ( "default" , "Default container. For Bash and Python 2 tasks" ) , ( "cpp" , "Contains gcc and g++ for compiling C++" ) , ( "java7" , "Contains Java 7" ) , ( "java8scala" , "Contains Java 8 and Scala" ) , ( "mono" , "Contains Mono, which allows to run...
Configures the container dict
41,001
def configure_backup_directory ( self ) : self . _display_question ( "Please choose a directory in which to store the backup files. By default, the tool will them in the current " "directory" ) backup_directory = None while backup_directory is None : backup_directory = self . _ask_with_default ( "Backup directory" , "....
Configure backup directory
41,002
def ldap_plugin ( self ) : name = self . _ask_with_default ( "Authentication method name (will be displayed on the login page)" , "LDAP" ) prefix = self . _ask_with_default ( "Prefix to append to the username before db storage. Usefull when you have more than one auth method with " "common usernames." , "" ) ldap_host ...
Configures the LDAP plugin
41,003
def configure_authentication ( self , database ) : options = { "plugins" : [ ] , "superadmins" : [ ] } self . _display_info ( "We will now create the first user." ) username = self . _ask_with_default ( "Enter the login of the superadmin" , "superadmin" ) realname = self . _ask_with_default ( "Enter the name of the sup...
Configure the authentication
41,004
def _close_app ( app , mongo_client , client ) : app . stop ( ) client . close ( ) mongo_client . close ( )
Ensures that the app is properly closed
41,005
async def _init_clean ( self ) : self . _containers_running = { } self . _container_for_job = { } self . _student_containers_running = { } self . _student_containers_for_job = { } self . _containers_killed = dict ( ) try : await self . _ashutil . rmtree ( self . _tmp_dir ) except OSError : pass try : await self . _aos ...
Must be called when the agent is starting
41,006
async def _end_clean ( self ) : await self . _timeout_watcher . clean ( ) async def close_and_delete ( container_id ) : try : await self . _docker . remove_container ( container_id ) except : pass for container_id in self . _containers_running : await close_and_delete ( container_id ) for container_id in self . _studen...
Must be called when the agent is closing
41,007
async def _watch_docker_events ( self ) : try : source = AsyncIteratorWrapper ( self . _docker . sync . event_stream ( filters = { "event" : [ "die" , "oom" ] } ) ) async for i in source : if i [ "Type" ] == "container" and i [ "status" ] == "die" : container_id = i [ "id" ] try : retval = int ( i [ "Actor" ] [ "Attrib...
Get raw docker events and convert them to more readable objects and then give them to self . _docker_events_subscriber
41,008
async def handle_student_job_closing ( self , container_id , retval ) : try : self . _logger . debug ( "Closing student %s" , container_id ) try : job_id , parent_container_id , socket_id , write_stream = self . _student_containers_running [ container_id ] del self . _student_containers_running [ container_id ] except ...
Handle a closing student container . Do some cleaning verify memory limits timeouts ... and returns data to the associated grading container
41,009
async def kill_job ( self , message : BackendKillJob ) : try : if message . job_id in self . _container_for_job : self . _containers_killed [ self . _container_for_job [ message . job_id ] ] = "killed" await self . _docker . kill_container ( self . _container_for_job [ message . job_id ] ) else : self . _logger . warni...
Handles kill messages . Kill things .
41,010
def get_user_lists ( self , course , aggregationid = '' ) : tutor_list = course . get_staff ( ) student_list = list ( self . database . aggregations . aggregate ( [ { "$match" : { "courseid" : course . get_id ( ) } } , { "$unwind" : "$students" } , { "$project" : { "classroom" : "$_id" , "students" : 1 , "grouped" : { ...
Get the available student and tutor lists for aggregation edition
41,011
def update_aggregation ( self , course , aggregationid , new_data ) : student_list = self . user_manager . get_course_registered_users ( course , False ) if aggregationid == 'None' : del new_data [ '_id' ] new_data [ "courseid" ] = course . get_id ( ) result = self . database . aggregations . insert_one ( new_data ) ag...
Update aggregation and returns a list of errored students
41,012
def POST_AUTH ( self ) : username = self . user_manager . session_username ( ) user_info = self . database . users . find_one ( { "username" : username } ) user_input = web . input ( ) success = None if "register_courseid" in user_input and user_input [ "register_courseid" ] != "" : try : course = self . course_factory...
Parse course registration or course creation and display the course list page
41,013
async def _restart_on_cancel ( logger , agent ) : while True : try : await agent . run ( ) except asyncio . CancelledError : logger . exception ( "Restarting agent" ) pass
Restarts an agent when it is cancelled
41,014
def GET ( self , * args , ** kwargs ) : if self . user_manager . session_logged_in ( ) : if not self . user_manager . session_username ( ) and not self . __class__ . __name__ == "ProfilePage" : raise web . seeother ( "/preferences/profile" ) if not self . is_lti_page and self . user_manager . session_lti_info ( ) is no...
Checks if user is authenticated and calls GET_AUTH or performs logout . Otherwise returns the login template .
41,015
def normpath ( self , path ) : path2 = posixpath . normpath ( urllib . parse . unquote ( path ) ) if path . endswith ( "/" ) : path2 += "/" return path2
Normalize the path
41,016
def _get_submissions ( course_factory , submission_manager , user_manager , translations , courseid , taskid , with_input , submissionid = None ) : try : course = course_factory . get_course ( courseid ) except : raise APINotFound ( "Course not found" ) if not user_manager . course_is_open_to_user ( course , lti = Fals...
Helper for the GET methods of the two following classes
41,017
def API_GET ( self , courseid , taskid , submissionid ) : with_input = "input" in web . input ( ) return _get_submissions ( self . course_factory , self . submission_manager , self . user_manager , self . app . _translations , courseid , taskid , with_input , submissionid )
List all the submissions that the connected user made . Returns list of the form
41,018
def is_registration_possible ( self , user_info ) : return self . get_accessibility ( ) . is_open ( ) and self . _registration . is_open ( ) and self . is_user_accepted_by_access_control ( user_info )
Returns true if users can register for this course
41,019
def get_accessibility ( self , plugin_override = True ) : vals = self . _hook_manager . call_hook ( 'course_accessibility' , course = self , default = self . _accessible ) return vals [ 0 ] if len ( vals ) and plugin_override else self . _accessible
Return the AccessibleTime object associated with the accessibility of this course
41,020
def is_user_accepted_by_access_control ( self , user_info ) : if self . get_access_control_method ( ) is None : return True elif not user_info : return False elif self . get_access_control_method ( ) == "username" : return user_info [ "username" ] in self . get_access_control_list ( ) elif self . get_access_control_met...
Returns True if the user is allowed by the ACL
41,021
def allow_unregister ( self , plugin_override = True ) : vals = self . _hook_manager . call_hook ( 'course_allow_unregister' , course = self , default = self . _allow_unregister ) return vals [ 0 ] if len ( vals ) and plugin_override else self . _allow_unregister
Returns True if students can unregister from course
41,022
def get_name ( self , language ) : return self . gettext ( language , self . _name ) if self . _name else ""
Return the name of this course
41,023
def get_description ( self , language ) : description = self . gettext ( language , self . _description ) if self . _description else '' return ParsableText ( description , "rst" , self . _translations . get ( language , gettext . NullTranslations ( ) ) )
Returns the course description
41,024
def get_all_tags_names_as_list ( self , admin = False , language = "en" ) : if admin : if self . _all_tags_cache_list_admin != { } and language in self . _all_tags_cache_list_admin : return self . _all_tags_cache_list_admin [ language ] else : if self . _all_tags_cache_list != { } and language in self . _all_tags_cache...
Computes and cache two list containing all tags name sorted by natural order on name
41,025
def update_all_tags_cache ( self ) : self . _all_tags_cache = None self . _all_tags_cache_list = { } self . _all_tags_cache_list_admin = { } self . _organisational_tags_to_task = { } self . get_all_tags ( ) self . get_all_tags_names_as_list ( ) self . get_organisational_tags_to_task ( )
Force the cache refreshing
41,026
def get_app ( config ) : mongo_client = MongoClient ( host = config . get ( 'mongo_opt' , { } ) . get ( 'host' , 'localhost' ) ) database = mongo_client [ config . get ( 'mongo_opt' , { } ) . get ( 'database' , 'INGInious' ) ] if "tasks_directory" not in config : raise RuntimeError ( "WebDav access is only supported if...
Init the webdav app
41,027
def getDomainRealm ( self , inputURL , environ ) : if inputURL . startswith ( "/" ) : inputURL = inputURL [ 1 : ] parts = inputURL . split ( "/" ) return parts [ 0 ]
Resolve a relative url to the appropriate realm name .
41,028
def isRealmUser ( self , realmname , username , environ ) : try : course = self . course_factory . get_course ( realmname ) ok = self . user_manager . has_admin_rights_on_course ( course , username = username ) return ok except : return False
Returns True if this username is valid for the realm False otherwise .
41,029
def getRealmUserPassword ( self , realmname , username , environ ) : return self . user_manager . get_user_api_key ( username , create = True )
Return the password for the given username for the realm .
41,030
def getResourceInst ( self , path , environ ) : self . _count_getResourceInst += 1 fp = self . _locToFilePath ( path ) if not os . path . exists ( fp ) : return None if os . path . isdir ( fp ) : return FolderResource ( path , environ , fp ) return FileResource ( path , environ , fp )
Return info dictionary for path .
41,031
def contains_is_html ( cls , data ) : for key , val in data . items ( ) : if isinstance ( key , str ) and key . endswith ( "IsHTML" ) : return True if isinstance ( val , ( OrderedDict , dict ) ) and cls . contains_is_html ( val ) : return True return False
Detect if the problem has at least one xyzIsHTML key
41,032
def parse_problem ( self , problem_content ) : del problem_content [ "@order" ] return self . task_factory . get_problem_types ( ) . get ( problem_content [ "type" ] ) . parse_problem ( problem_content )
Parses a problem modifying some data
41,033
def wipe_task ( self , courseid , taskid ) : submissions = self . database . submissions . find ( { "courseid" : courseid , "taskid" : taskid } ) for submission in submissions : for key in [ "input" , "archive" ] : if key in submission and type ( submission [ key ] ) == bson . objectid . ObjectId : self . submission_ma...
Wipe the data associated to the taskid from DB
41,034
def _exception_free_callback ( self , callback , * args , ** kwargs ) : try : return callback ( * args , ** kwargs ) except Exception : self . _logger . exception ( "An exception occurred while calling a hook! " , exc_info = True ) return None
A wrapper that remove all exceptions raised from hooks
41,035
def add_hook ( self , name , callback , prio = 0 ) : hook_list = self . _hooks . get ( name , [ ] ) add = ( lambda * args , ** kwargs : self . _exception_free_callback ( callback , * args , ** kwargs ) ) , - prio pos = bisect . bisect_right ( list ( x [ 1 ] for x in hook_list ) , - prio ) hook_list [ pos : pos ] = [ ad...
Add a new hook that can be called with the call_hook function . prio is the priority . Higher priority hooks are called before lower priority ones . This function does not enforce a particular order between hooks with the same priorities .
41,036
def input_is_consistent ( self , task_input , default_allowed_extension , default_max_size ) : for problem in self . _problems : if not problem . input_is_consistent ( task_input , default_allowed_extension , default_max_size ) : return False return True
Check if an input for a task is consistent . Return true if this is case false else
41,037
def get_limits ( self ) : vals = self . _hook_manager . call_hook ( 'task_limits' , course = self . get_course ( ) , task = self , default = self . _limits ) return vals [ 0 ] if len ( vals ) else self . _limits
Return the limits of this task
41,038
def allow_network_access_grading ( self ) : vals = self . _hook_manager . call_hook ( 'task_network_grading' , course = self . get_course ( ) , task = self , default = self . _network_grading ) return vals [ 0 ] if len ( vals ) else self . _network_grading
Return True if the grading container should have access to the network
41,039
def _create_task_problem ( self , problemid , problem_content , task_problem_types ) : if not id_checker ( problemid ) : raise Exception ( "Invalid problem _id: " + problemid ) if problem_content . get ( 'type' , "" ) not in task_problem_types : raise Exception ( "Invalid type for problem " + problemid ) return task_pr...
Creates a new instance of the right class for a given problem .
41,040
def course_menu ( course , template_helper ) : scoreboards = course . get_descriptor ( ) . get ( 'scoreboard' , [ ] ) if scoreboards != [ ] : return str ( template_helper . get_custom_renderer ( 'frontend/plugins/scoreboard' , layout = False ) . course_menu ( course ) ) else : return None
Displays the link to the scoreboards on the course page if the plugin is activated for this course
41,041
def task_menu ( course , task , template_helper ) : scoreboards = course . get_descriptor ( ) . get ( 'scoreboard' , [ ] ) try : tolink = [ ] for sid , scoreboard in enumerate ( scoreboards ) : if task . get_id ( ) in scoreboard [ "content" ] : tolink . append ( ( sid , scoreboard [ "name" ] ) ) if tolink : return str ...
Displays the link to the scoreboards on the task page if the plugin is activated for this course and the task is used in scoreboards
41,042
def get_user_lists ( self , course , classroomid ) : tutor_list = course . get_staff ( ) student_list = list ( self . database . classrooms . aggregate ( [ { "$match" : { "_id" : ObjectId ( classroomid ) } } , { "$unwind" : "$students" } , { "$project" : { "students" : 1 , "grouped" : { "$anyElementTrue" : { "$map" : {...
Get the available student and tutor lists for classroom edition
41,043
def update_classroom ( self , course , classroomid , new_data ) : student_list , tutor_list , other_students , _ = self . get_user_lists ( course , classroomid ) new_data [ "tutors" ] = [ tutor for tutor in map ( str . strip , new_data [ "tutors" ] ) if tutor in tutor_list ] students , groups , errored_students = [ ] ,...
Update classroom and returns a list of errored students
41,044
def parse ( self , debug = False ) : if self . _parsed is None : try : if self . _mode == "html" : self . _parsed = self . html ( self . _content , self . _show_everything , self . _translation ) else : self . _parsed = self . rst ( self . _content , self . _show_everything , self . _translation , debug = debug ) excep...
Returns parsed text
41,045
def POST_AUTH ( self , courseid , taskid ) : if not id_checker ( taskid ) : raise Exception ( "Invalid task id" ) self . get_course_and_check_rights ( courseid , allow_all_staff = False ) request = web . input ( file = { } ) if request . get ( "action" ) == "upload" and request . get ( 'path' ) is not None and request ...
Upload or modify a file
41,046
def show_tab_file ( self , courseid , taskid , error = None ) : return self . template_helper . get_renderer ( False ) . course_admin . edit_tabs . files ( self . course_factory . get_course ( courseid ) , taskid , self . get_task_filelist ( self . task_factory , courseid , taskid ) , error )
Return the file tab
41,047
def action_edit ( self , courseid , taskid , path ) : wanted_path = self . verify_path ( courseid , taskid , path ) if wanted_path is None : return "Internal error" try : content = self . task_factory . get_task_fs ( courseid , taskid ) . get ( wanted_path ) . decode ( "utf-8" ) return json . dumps ( { "content" : cont...
Edit a file
41,048
def action_edit_save ( self , courseid , taskid , path , content ) : wanted_path = self . verify_path ( courseid , taskid , path ) if wanted_path is None : return json . dumps ( { "error" : True } ) try : self . task_factory . get_task_fs ( courseid , taskid ) . put ( wanted_path , content . encode ( "utf-8" ) ) return...
Save an edited file
41,049
def action_download ( self , courseid , taskid , path ) : wanted_path = self . verify_path ( courseid , taskid , path ) if wanted_path is None : raise web . notfound ( ) task_fs = self . task_factory . get_task_fs ( courseid , taskid ) ( method , mimetype_or_none , file_or_url ) = task_fs . distribute ( wanted_path ) i...
Download a file or a directory
41,050
def write_json_or_yaml ( file_path , content ) : with codecs . open ( file_path , "w" , "utf-8" ) as f : f . write ( get_json_or_yaml ( file_path , content ) )
Write JSON or YAML depending on the file extension .
41,051
def get_json_or_yaml ( file_path , content ) : if os . path . splitext ( file_path ) [ 1 ] == ".json" : return json . dumps ( content , sort_keys = False , indent = 4 , separators = ( ',' , ': ' ) ) else : return inginious . common . custom_yaml . dump ( content )
Generate JSON or YAML depending on the file extension .
41,052
def _set_session ( self , username , realname , email , language ) : self . _session . loggedin = True self . _session . email = email self . _session . username = username self . _session . realname = realname self . _session . language = language self . _session . token = None if "lti" not in self . _session : self ....
Init the session . Preserves potential LTI information .
41,053
def _destroy_session ( self ) : self . _session . loggedin = False self . _session . email = None self . _session . username = None self . _session . realname = None self . _session . token = None self . _session . lti = None
Destroy the session
41,054
def create_lti_session ( self , user_id , roles , realname , email , course_id , task_id , consumer_key , outcome_service_url , outcome_result_id , tool_name , tool_desc , tool_url , context_title , context_label ) : self . _destroy_session ( ) self . _session . load ( '' ) session_id = self . _session . session_id sel...
Creates an LTI cookieless session . Returns the new session id
41,055
def user_saw_task ( self , username , courseid , taskid ) : self . _database . user_tasks . update ( { "username" : username , "courseid" : courseid , "taskid" : taskid } , { "$setOnInsert" : { "username" : username , "courseid" : courseid , "taskid" : taskid , "tried" : 0 , "succeeded" : False , "grade" : 0.0 , "submi...
Set in the database that the user has viewed this task
41,056
def update_user_stats ( self , username , task , submission , result_str , grade , state , newsub ) : self . user_saw_task ( username , submission [ "courseid" ] , submission [ "taskid" ] ) if newsub : old_submission = self . _database . user_tasks . find_one_and_update ( { "username" : username , "courseid" : submissi...
Update stats with a new submission
41,057
def get_course_aggregations ( self , course ) : return natsorted ( list ( self . _database . aggregations . find ( { "courseid" : course . get_id ( ) } ) ) , key = lambda x : x [ "description" ] )
Returns a list of the course aggregations
41,058
def get_accessible_time ( self , plugin_override = True ) : vals = self . _hook_manager . call_hook ( 'task_accessibility' , course = self . get_course ( ) , task = self , default = self . _accessible ) return vals [ 0 ] if len ( vals ) and plugin_override else self . _accessible
Get the accessible time of this task
41,059
def get_deadline ( self ) : if self . get_accessible_time ( ) . is_always_accessible ( ) : return _ ( "No deadline" ) elif self . get_accessible_time ( ) . is_never_accessible ( ) : return _ ( "It's too late" ) else : return self . get_accessible_time ( ) . get_soft_end_date ( ) . strftime ( "%d/%m/%Y %H:%M:%S" )
Returns a string containing the deadline for this task
41,060
def get_authors ( self , language ) : return self . gettext ( language , self . _author ) if self . _author else ""
Return the list of this task s authors
41,061
def adapt_input_for_backend ( self , input_data ) : for problem in self . _problems : input_data = problem . adapt_input_for_backend ( input_data ) return input_data
Adapt the input from web . py for the inginious . backend
41,062
def get_users ( self , course ) : users = OrderedDict ( sorted ( list ( self . user_manager . get_users_info ( self . user_manager . get_course_registered_users ( course ) ) . items ( ) ) , key = lambda k : k [ 1 ] [ 0 ] if k [ 1 ] is not None else "" ) ) return users
Returns a sorted list of users
41,063
def get_course ( self , courseid ) : try : course = self . course_factory . get_course ( courseid ) except : raise web . notfound ( ) return course
Return the course
41,064
def show_page ( self , course ) : username = self . user_manager . session_username ( ) if not self . user_manager . course_is_open_to_user ( course , lti = False ) : return self . template_helper . get_renderer ( ) . course_unavailable ( ) else : tasks = course . get_tasks ( ) last_submissions = self . submission_mana...
Prepares and shows the course page
41,065
def mavparms ( logfile ) : mlog = mavutil . mavlink_connection ( filename ) while True : try : m = mlog . recv_match ( type = [ 'PARAM_VALUE' , 'PARM' ] ) if m is None : return except Exception : return if m . get_type ( ) == 'PARAM_VALUE' : pname = str ( m . param_id ) . strip ( ) value = m . param_value else : pname ...
extract mavlink parameters
41,066
def send ( self , mavmsg , force_mavlink1 = False ) : buf = mavmsg . pack ( self , force_mavlink1 = force_mavlink1 ) self . file . write ( buf ) self . seq = ( self . seq + 1 ) % 256 self . total_packets_sent += 1 self . total_bytes_sent += len ( buf ) if self . send_callback : self . send_callback ( mavmsg , * self . ...
send a MAVLink message
41,067
def bytes_needed ( self ) : if self . native : ret = self . native . expected_length - self . buf_len ( ) else : ret = self . expected_length - self . buf_len ( ) if ret <= 0 : return 1 return ret
return number of bytes needed for next parsing stage
41,068
def __callbacks ( self , msg ) : if self . callback : self . callback ( msg , * self . callback_args , ** self . callback_kwargs )
this method exists only to make profiling results easier to read
41,069
def parse_char ( self , c ) : self . buf . extend ( c ) self . total_bytes_received += len ( c ) if self . native : if native_testing : self . test_buf . extend ( c ) m = self . __parse_char_native ( self . test_buf ) m2 = self . __parse_char_legacy ( ) if m2 != m : print ( "Native: %s\nLegacy: %s\n" % ( m , m2 ) ) rai...
input some data bytes possibly returning a new message
41,070
def parse_buffer ( self , s ) : m = self . parse_char ( s ) if m is None : return None ret = [ m ] while True : m = self . parse_char ( "" ) if m is None : return ret ret . append ( m ) return ret
input some data bytes possibly returning a list of new messages
41,071
def check_signature ( self , msgbuf , srcSystem , srcComponent ) : if isinstance ( msgbuf , array . array ) : msgbuf = msgbuf . tostring ( ) timestamp_buf = msgbuf [ - 12 : - 6 ] link_id = msgbuf [ - 13 ] ( tlow , thigh ) = struct . unpack ( '<IH' , timestamp_buf ) timestamp = tlow + ( thigh << 32 ) stream_key = ( link...
check signature on incoming message
41,072
def flexifunction_set_send ( self , target_system , target_component , force_mavlink1 = False ) : return self . send ( self . flexifunction_set_encode ( target_system , target_component ) , force_mavlink1 = force_mavlink1 )
Depreciated but used as a compiler flag . Do not remove
41,073
def system_time_send ( self , time_unix_usec , time_boot_ms , force_mavlink1 = False ) : return self . send ( self . system_time_encode ( time_unix_usec , time_boot_ms ) , force_mavlink1 = force_mavlink1 )
The system time is the time of the master clock typically the computer clock of the main onboard computer .
41,074
def set_mode_send ( self , target_system , base_mode , custom_mode , force_mavlink1 = False ) : return self . send ( self . set_mode_encode ( target_system , base_mode , custom_mode ) , force_mavlink1 = force_mavlink1 )
THIS INTERFACE IS DEPRECATED . USE COMMAND_LONG with MAV_CMD_DO_SET_MODE INSTEAD . Set the system mode as defined by enum MAV_MODE . There is no target component id as the mode is by definition for the overall aircraft not only for one component .
41,075
def param_request_list_send ( self , target_system , target_component , force_mavlink1 = False ) : return self . send ( self . param_request_list_encode ( target_system , target_component ) , force_mavlink1 = force_mavlink1 )
Request all parameters of this component . After this request all parameters are emitted .
41,076
def mission_current_send ( self , seq , force_mavlink1 = False ) : return self . send ( self . mission_current_encode ( seq ) , force_mavlink1 = force_mavlink1 )
Message that announces the sequence number of the current active mission item . The MAV will fly towards this mission item .
41,077
def mission_count_send ( self , target_system , target_component , count , force_mavlink1 = False ) : return self . send ( self . mission_count_encode ( target_system , target_component , count ) , force_mavlink1 = force_mavlink1 )
This message is emitted as response to MISSION_REQUEST_LIST by the MAV and to initiate a write transaction . The GCS can then request the individual mission item based on the knowledge of the total number of MISSIONs .
41,078
def mission_clear_all_send ( self , target_system , target_component , force_mavlink1 = False ) : return self . send ( self . mission_clear_all_encode ( target_system , target_component ) , force_mavlink1 = force_mavlink1 )
Delete all mission items at once .
41,079
def data_stream_send ( self , stream_id , message_rate , on_off , force_mavlink1 = False ) : return self . send ( self . data_stream_encode ( stream_id , message_rate , on_off ) , force_mavlink1 = force_mavlink1 )
THIS INTERFACE IS DEPRECATED . USE MESSAGE_INTERVAL INSTEAD .
41,080
def command_ack_send ( self , command , result , force_mavlink1 = False ) : return self . send ( self . command_ack_encode ( command , result ) , force_mavlink1 = force_mavlink1 )
Report status of a command . Includes feedback wether the command was executed .
41,081
def timesync_send ( self , tc1 , ts1 , force_mavlink1 = False ) : return self . send ( self . timesync_encode ( tc1 , ts1 ) , force_mavlink1 = force_mavlink1 )
Time synchronization message .
41,082
def camera_trigger_send ( self , time_usec , seq , force_mavlink1 = False ) : return self . send ( self . camera_trigger_encode ( time_usec , seq ) , force_mavlink1 = force_mavlink1 )
Camera - IMU triggering and synchronisation message .
41,083
def log_erase_send ( self , target_system , target_component , force_mavlink1 = False ) : return self . send ( self . log_erase_encode ( target_system , target_component ) , force_mavlink1 = force_mavlink1 )
Erase all logs
41,084
def log_request_end_send ( self , target_system , target_component , force_mavlink1 = False ) : return self . send ( self . log_request_end_encode ( target_system , target_component ) , force_mavlink1 = force_mavlink1 )
Stop log transfer and resume normal logging
41,085
def power_status_send ( self , Vcc , Vservo , flags , force_mavlink1 = False ) : return self . send ( self . power_status_encode ( Vcc , Vservo , flags ) , force_mavlink1 = force_mavlink1 )
Power supply status
41,086
def terrain_check_send ( self , lat , lon , force_mavlink1 = False ) : return self . send ( self . terrain_check_encode ( lat , lon ) , force_mavlink1 = force_mavlink1 )
Request that the vehicle report terrain height at the given location . Used by GCS to check if vehicle has all terrain data needed for a mission .
41,087
def gps_input_encode ( self , time_usec , gps_id , ignore_flags , time_week_ms , time_week , fix_type , lat , lon , alt , hdop , vdop , vn , ve , vd , speed_accuracy , horiz_accuracy , vert_accuracy , satellites_visible ) : return MAVLink_gps_input_message ( time_usec , gps_id , ignore_flags , time_week_ms , time_week ...
GPS sensor input message . This is a raw sensor value sent by the GPS . This is NOT the global position estimate of the sytem .
41,088
def message_interval_send ( self , message_id , interval_us , force_mavlink1 = False ) : return self . send ( self . message_interval_encode ( message_id , interval_us ) , force_mavlink1 = force_mavlink1 )
This interface replaces DATA_STREAM
41,089
def extended_sys_state_send ( self , vtol_state , landed_state , force_mavlink1 = False ) : return self . send ( self . extended_sys_state_encode ( vtol_state , landed_state ) , force_mavlink1 = force_mavlink1 )
Provides state for additional features
41,090
def named_value_float_send ( self , time_boot_ms , name , value , force_mavlink1 = False ) : return self . send ( self . named_value_float_encode ( time_boot_ms , name , value ) , force_mavlink1 = force_mavlink1 )
Send a key - value pair as float . The use of this message is discouraged for normal packets but a quite efficient way for testing new messages and getting experimental debug output .
41,091
def named_value_int_send ( self , time_boot_ms , name , value , force_mavlink1 = False ) : return self . send ( self . named_value_int_encode ( time_boot_ms , name , value ) , force_mavlink1 = force_mavlink1 )
Send a key - value pair as integer . The use of this message is discouraged for normal packets but a quite efficient way for testing new messages and getting experimental debug output .
41,092
def debug_send ( self , time_boot_ms , ind , value , force_mavlink1 = False ) : return self . send ( self . debug_encode ( time_boot_ms , ind , value ) , force_mavlink1 = force_mavlink1 )
Send a debug value . The index is used to discriminate between values . These values show up in the plot of QGroundControl as DEBUG N .
41,093
def sendVX ( self , vx ) : self . lock . acquire ( ) self . data . vx = vx self . lock . release ( )
Sends VX velocity .
41,094
def sendVY ( self , vy ) : self . lock . acquire ( ) self . data . vy = vy self . lock . release ( )
Sends VY velocity .
41,095
def sendAZ ( self , az ) : self . lock . acquire ( ) self . data . az = az self . lock . release ( )
Sends AZ velocity .
41,096
def bumperEvent2BumperData ( event ) : bump = BumperData ( ) bump . state = event . state bump . bumper = event . bumper return bump
Translates from ROS BumperScan to JderobotTypes BumperData .
41,097
def __callback ( self , event ) : bump = bumperEvent2BumperData ( event ) if bump . state == 1 : self . lock . acquire ( ) self . time = current_milli_time ( ) self . data = bump self . lock . release ( )
Callback function to receive and save Bumper Scans .
41,098
def getBumperData ( self ) : self . lock . acquire ( ) t = current_milli_time ( ) if ( t - self . time ) > 500 : self . data . state = 0 bump = self . data self . lock . release ( ) return bump
Returns last BumperData .
41,099
def cmd_bat ( self , args ) : print ( "Flight battery: %u%%" % self . battery_level ) if self . settings . numcells != 0 : print ( "%.2f V/cell for %u cells - approx %u%%" % ( self . per_cell , self . settings . numcells , self . vcell_to_battery_percent ( self . per_cell ) ) )
show battery levels