Lab Assignments
Contents
Hello World
Assignment
- Get the development environment from sourceforge.
- Compile a sample FreeRTOS sample project
- Load it onto the processor
- Add a terminal command to your project, have it do something creative (Like print temperature on the screen)
Reference this article on how to add a terminal command:
http://www.socialledge.com/sjsu/index.php?title=SJ_One_Board
SUBMIT YOUR CODE online (copy/paste to Text Entry box). Or simply provide me a link if you use Gitlab or other online repository for your code submission.
Only submit the relevant code, or just the code you added.
Form Groups
Assignment
Communicate with one of the class ISA to setup your groups @ Canvas. Be sure to have your group name ready and use an appropriate group name.
Failure to do so by the deadline will result in zero points for the assignment. Be sure to do this before leaving the class.
Also, order CAN transceiver hardware for your entire team (1 per person)
Unit Testing
Perform the "Lab 1" exercise here: [1]
Project Setup
Assignment
Setup your Project Report Template:
- Go to your class webpage:
- There should be a "Red Link" that I created for you to edit; Red-link means that "This Wiki article doesn't exist yet"
- Make sure you are logged into the SocialLedge Wiki, and then click to edit this page
- Rename one of these bullet points to your project name (use a wise name for your project):
- Tag your project with "F17" or similar, such as:
- [[F17: Spartan and Furious | F17: Spartan and Furious]]
- Click to save this page
- In a separate window, browse to this page, click "Edit" and COPY the entire Wikipedia markup
- Now click on the red link that belongs to your project
- Paste this template for your project, and work on setting weekly goals in your schedule section.
- Save the template
- Now go back to your project's Wiki page, click "EDIT"
- Add information about the team members
- Add a link to your GITLAB project and add users who can access your project:
- My GITLAB username is simply, "preet"
Wiki Schedule
Assignment
Write a schedule that is a list of your team's milestones. This is a tool for you to assign responsibilities and deadlines for your project's milestones. In general, this should list out when the team as a whole expects a certain functionality to be delivered.
The grading will depend on how well you have assigned your milestones and if the goals are measurable. For example, milestones such as "interface sensor and send sensor data over CAN messages" and "add a filter for the sensor data" are measurable goals, whereas, "interface sensor", and "send data" are too generic and un-measurable goals.
Periodic Scheduler
Assignment
INDIVIDUAL HOMEWORK:
Easy homework, use the periodic tasks to add two functions that they call, run your program, and then do the following:
- Modify main.cpp to configure the periodic scheduler, and leave the terminal task present that you will use later in the assignment
- Design a Software based "filter". The simplest one could be to average a few readings but read and research more on Wikipedia (they even have Psuedocode)
- Add the two new "Sensor" periodic callbacks, one at 1Hz, the other at 10Hz
- In the 10Hz callback, design a Software filter to filter the Light sensor readings
- In the 1Hz callback, print out the filtered sensor reading.
- Do more experiments with the "Logging" capability
- Log some data using LOG_INFO() or similar message from file_logger.h
- Use "info 5000" command to see CPU utilization for 5 seconds.
- Use "cat log.csv" to view the log file data.
Attach your output to Canvas along with your code.
CAN TX / RX using Auto-gen code
Assignment
Work in groups of 2 by assuming one board is the DRIVER while the other board is the MOTOR or SENSOR.
The objective of the assignment is to demonstrate CAN data handling using the auto-generated code. Follow these steps:
- Define a DBC message that your controller sends (TX)
- Define a DBC message that your controller receives (RX)
- Attempt to recover the CAN Bus (from Bus OFF) at 1Hz (both Boards)
- Send the TX message from BoardA at a fixed frequency, such as 10Hz
- Attempt to receive the RX message (on BoardB) at the designated frequency, and light up an LED when the message enters the MIA state
- Prove that the MIA handling is occurring as intended (simple LED test by disconnecting the board that sends you a periodic message).
- Prove that valid data is being received and reacted upon (such as displaying received sensor reading on the LED display)
This is a powerful assignment that demonstrates how to send and receive data using the auto-generated code that is derived from your DBC file. This will be the stepping stone of the overall CAN communication that will occur in your project.
Final Wiki Schedule
DBC File
Assignment
Create your CAN communication format for each controller and link your DBC file to your Project report at your wikipedia page.
Make sure that the auto-generated code is created as intended and that you don't run into a DBC or the auto-generation issue. In other words, the auto-generated code should compile on all controllers.
CAN Communication Demo
Assignment
Demonstrate that each ECU is able to communicate over the CAN Bus
- Code should utilize the auto-generated artifacts from the DBC file
- MIA handling should occur on the messages that are expected to be received
- Upon MIA, an LED indicator should indicate that there is 1 or more message in the MIA state
In person demonstration should be given for this assignment and there is nothing to turn in otherwise.
Producer / Consumer Tasks
Assignment
- Create a task that polls the acceleration sensor, and determines the orientation of the board, such as "up, down, left, right". Create an enumeration such as "typdef enum { invalid, up, down, left, right, }orientation_t;
- Create a queue, and have the first task send orientation values every second to the queue.
- Print something BEFORE and AFTER sending the enumeration value to the queue.
- Create a task that is waiting on the orientation enumeration to be sent by the previous task.
- Print something immediately after the second task receives the data from the queue.
- Use same priority for both tasks and note down the print-outs.
- Alter the priority of second task to use higher priority, and note down the print-outs
- Note down your results, and submit it at the top of your code submission.
Project Prototypes
Assignment
Project prototypes are expected to demonstrate the following:
- Reliable CAN communication between different ECUs
- Basic obstacle avoidance (free-run mode)
- Reliable sensor inputs (PCAN will be used by class mentors to assess)
- Reasonable motor commands (PCAN will be used by class mentors to assess)
- Extra credit if you go above and beyond and show even more progress such as a working Android app
Git
Assignment
Your GIT repositories will be audited to assess how much contribution you have made to your GIT project. At minimum, there should be something checked-into the main branch to demonstrate that you know how to use GIT.
Individual Contribution
You will be grading your group members based on how much or how little they contributed to the project. You must be ethical, and honest, and not go based on your "emotions".
Example:
Name Letter Grade Notes Last1, First1 A This student was involved in all aspects of the project design and was present at all group meetings. Last2, First2 C- This student contributed to writing the report but was absent for many group meetings.