Skip to content

Commit ece9d0c

Browse files
authored
[RSDK-11250, RSDK-11251, RSDK-11784, RSDK-11807] - Cpp improvements (#27)
* Use cpp sdk logger * Remove namespace log * Throw instead of exit * Update readme * Implement get properties * Remove extra err log * Downgrade unimplemented to warns * Wrap serve in try catch for better logging * More exception cleanup * Remove exception log dups in init_csi * Cleaner resource management in stop_pipeline * Add linter * Add lint workflow * Lint
1 parent ee4086a commit ece9d0c

File tree

13 files changed

+224
-193
lines changed

13 files changed

+224
-193
lines changed

.clang-format

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
AllowShortFunctionsOnASingleLine: Empty
2+
AllowShortIfStatementsOnASingleLine: false
3+
AllowShortLoopsOnASingleLine: false
4+
BasedOnStyle: Google
5+
BinPackArguments: false
6+
BinPackParameters: false
7+
ColumnLimit: 140
8+
Cpp11BracedListStyle: true
9+
DerivePointerAlignment: false
10+
IncludeBlocks: Preserve
11+
IndentWidth: 4
12+
MaxEmptyLinesToKeep: 1
13+
NamespaceIndentation: None
14+
SortIncludes: true
15+
SpaceBeforeAssignmentOperators: true
16+
Standard: c++17
17+
UseTab: Never
18+

.github/workflows/lint.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
lint-check:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v4
12+
13+
- name: Get clang-format
14+
run: |
15+
sudo apt-get update -y
16+
sudo apt-get install -y clang-format-19
17+
18+
- name: Verify no uncommitted changes from "make lint"
19+
run: |
20+
git init && git add . && make lint
21+
GEN_DIFF=$(git status -s)
22+
if [ -n "$GEN_DIFF" ]; then
23+
echo '"make lint" resulted in the following untracked changes:' 1>&2
24+
git diff
25+
echo '"make lint" resulted in changes not in git' 1>&2
26+
git status
27+
exit 1
28+
fi

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ package:
4141
PACK_TAG=$(PACK_TAG) \
4242
appimage-builder --recipe $(RECIPE)
4343

44+
lint:
45+
./etc/run-clang-format.sh
46+
4447
# Removes all build and bin artifacts.
4548
clean:
4649
rm -rf $(BUILD_DIR) | true && \

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ Once configured, check the [Logs tab](https://docs.viam.com/program/debug/) of y
8181
"attributes": {
8282
"width_px": 1920,
8383
"height_px": 1080,
84-
"frame_rate": 30,
85-
"debug": true
84+
"frame_rate": 30
8685
},
8786
"depends_on": [],
8887
"name": "csicam_test",
@@ -137,8 +136,7 @@ On the new component panel, copy and paste the following attribute template into
137136
{
138137
"width_px": <int>,
139138
"height_px": <int>,
140-
"frame_rate": <int>,
141-
"debug": <bool>
139+
"frame_rate": <int>
142140
}
143141
```
144142

@@ -158,7 +156,6 @@ The following attributes are available for `viam:camera:csi` cameras:
158156
| `width_px` | int | Optional | Width of the image this camera captures in pixels. <br> Default: `1920` |
159157
| `height_px` | int | Optional | Height of the image this camera captures in pixels. <br> Default: `1080` |
160158
| `frame_rate` | int | Optional | The image capture frame rate this camera should use. <br> Default: `30` |
161-
| `debug` | boolean | Optional | Whether or not you want debug input from this camera in your robot's logs. <br> Default: `false` |
162159

163160
Once configured, check the [Logs tab](https://docs.viam.com/program/debug/) of your robot in the Viam app to make sure your camera has connected and no errors are being raised.
164161

constraints.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#define DEFAULT_API_SUBTYPE "csi"
99

1010
// GST
11-
#define GST_GET_STATE_TIMEOUT 1
11+
#define GST_GET_STATE_TIMEOUT 1
1212
#define GST_CHANGE_STATE_TIMEOUT 5
1313

1414
// Pipeline

0 commit comments

Comments
 (0)